Skip to content

This is a sample project that demonstrates how to store and validate schemas on top of iglu https://github.com/snowplow/iglu

Notifications You must be signed in to change notification settings

ramkumarvenkat/iglu-json-schema-validator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

iglu-json-schema-validator

This is a sample project that demonstrates how to store and validate schemas on top of iglu

Details

The project exposes the following end-points:

POST    /schema/SCHEMAID        - Upload a JSON Schema with unique `SCHEMAID`
GET     /schema/SCHEMAID        - Download a JSON Schema with unique `SCHEMAID`
POST    /validate/SCHEMAID      - Validate a JSON document against the JSON Schema identified by `SCHEMAID`

The schemas are stored and retrieved from iglu and validated against json-schema using json-schema-validator

Development Setup

The project is a play 2.X app. It also needs docker for running iglu locally. All the service APIs and the necessary iglu APIs can be found in the postman collection

  • Setup iglu server on docker by follwing the instructions here and here
  • Make sure you insert the super API key into the running postgres
  • Generate the keys from the keygen API, the API can also be invoked from the postman collection
  • Take the write token and update iglu.token in application.conf
  • Run the app as a play app

Tests

Right now, the tests need a locally running iglu server. The instructions above can be used here. The tests can then be run as sbt test

TODO

  • Making schemas versioned. Iglu supports this, but this application doesn't. Instead, it overwrites the same version on every POST /schema/SCHEMAID API call
  • Fetch the keys once at application startup and fetch it again if it expires or on authentication errors
  • Using testcontainers instead of making it mandatory to run docker containers separately
  • Making the tests transactional, either by starting a new iglu server (enables parallel execution) for each test or by cleaning up the uploaded schemas after each test

About

This is a sample project that demonstrates how to store and validate schemas on top of iglu https://github.com/snowplow/iglu

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages