This provides a simple service that returns the JSON schema for a given typename.
This project is provides a simple example of how to use seneca for a useful micro-service. The main logic is in the seneca plugin src/ts/schemas-plugin.ts, which is contained in the JSON Schema service.
The Schema service consists of two parts:
- a JSON Schema service
This takes a JSON request, looks up a schema from its typename, and returns it.
This service wraps tv4-via-typenames-node - a Web Schema service
This takes a REST request, and passes a JSON request to the schemas service
A sequence diagram showing how this fits into a system:
make setup
make build
make test
make
In one command shell, run:
node schemas-pin-service.js --seneca.log=plugin:schemas
And in another command shell, run:
node schemas-app.js --seneca.log=plugin:web,plugin:api
Using a browser that can display JSON (I use the JSONView Chrome extension), Issue these queries that should return a schema:
and this query that should return an error:
If you have any questions, suggestions, or problems, please email me at my address given on npm, or file an issue.