Problem mocking my own Iglu schema registry


#1

Hello,

I am trying to setup a JSON schema repository using simple python command:
python -m http.server

But, my enriched JSON is not getting validated. This is the error messge:

error: Could not find schema with key iglu:com.myown/self_describing_schema/jsonschema/1-0-0 in any repository, tried:
    level: "error"
    repositories: ["Iglu Central [HTTP]","Iglu Client Embedded [embedded]","Iglu MyOwn [HTTP]"]
"}],"failure_tstamp":"2018-02-20T13:20:31.554Z

Here is my iglu_resolver.json

{
  "schema": "iglu:com.snowplowanalytics.iglu/resolver-config/jsonschema/1-0-1",
  "data": {
    "cacheSize": 500,
    "repositories": [
      {
        "name": "Iglu Central",
        "priority": 0,
        "vendorPrefixes": [ "com.snowplowanalytics" ],
        "connection": {
          "http": {
            "uri": "http://iglucentral.com"
          }
        }
      },
      {
        "name": "Iglu MyOwn",
        "priority": 1,
        "vendorPrefixes": [ "com.myown" ],
        "connection": {
          "http": {
            "uri": "http://127.0.0.1"
          }
        }
      }
    ]
  }
}

Can anyone please help me figure out what I might be doing wrong?


#2

I’d recommend using one of the Snowplow Iglu repositories if you can (or testing on Snowplow Mini).

If you do want to get this running locally using Python for some reason python -m http.server will start the webserver on port 8000 by default (and your resolver refers to port 80), if you want to start the webserver on port 80 you can use python -m http.server 80.


#3

Thanks for letting me know about Snowplow Mini. Didn’t knew something like this existed.
I was making one more mistake: URL path structure. I was not using schemas/com.myown in URL path structure. My URL was like this:
http://127.0.0.1:8000/self_describing_schema/jsonschema/1-0-0
I couldn’t find this mentioned clearly on Snowplow wiki. Until I found:


and figured out that schemas directory, followed by vendor name might be required path structure.
Thanks for help.


#4

Yep - the URI for each schema is defined by the vendor/event/format/version format which should match the first part of the JSON schema definition. This directory structure makes things pretty easy to reason about and you can see the same structure in Iglu Central.