Validate schema instance against draft

Yo

A little dream item for me here: would it be possible to validate a schema instance against a drafted schema? Doesn’t appear to be possible now, but I dream of a world where I could:

  • Publish a draft of a schema instance
  • Create an instance of the custom event I am trying to track with that schema
  • Curl some $IGLU_API/drafts/validate endpoint with my schema instance
  • If it’s invalid, update my draft prior to publishing/committing to a schema version number

Any reason this isn’t allowed? I’d be interested in submitting a PR to Iglu to add this functionality if it’s not explicitly prohibited for some reason :smile:

Hi @pearsonhenri,

That’s exactly what Snowplow Mini is for. Spin one up and test schemas/tracking in a sandboxed environment to your heart’s content.

Best,

Ah interesting. Well at the risk of being a little over-scrupulous, an issue I have with this flow is that you still need to commit to a version number to test successive versions of your schema while iterating. Then, when you finally arrive at a schema format you want, you need to change the schema’s self.version field back to 1-0-0 (or whatever) and publish it to your actual Iglu, and also update the code where you’ve inserted your tracker to point to the new version as well. This is the part that strikes me as a bit error prone. It seems like this is sorta the exact thing the schema draft service was created to avoid, right?

Basically I want to avoid the case where I’ve created a new_schema/1-0-12.json while devving against one Iglu instance (be it in SnowplowMini or my own staging Iglu instance), then publish that exact same schema as new_schema/1-0-0.json in a different Iglu instance.

You can overwrite the schemas in Snowplow Mini, so you don’t need to increment for each test.

By design, once a schema goes to production it is immutable though - this is necessary to assure successful loading to DB (and is one reason SP Mini doesn’t load to a DB).

BTW, for Snowplow Insights customers this whole process is managed through our console, and is a really smooth workflow. So if you/anyone else is interested feel free to request a demo!

/shameless plug