Uses PRMD spec to generate a single json schema file from individual yaml schemas files
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
schemata
test
.dockerignore
Dockerfile
Gemfile
Gemfile.lock
README.md
docker-compose.yml
env.list
meta.json
schema.json

README.md

Uses PRMD spec to generate a single json schema file from individual yaml schemas files.

Following these instructions will generate a schema file. This can be used with z-schema to validate data against schemas (see json-schema-validator repo)

Usage

  • Create or modify meta.json (or file specified by $META_PATH) as needed.
  • Include yaml schema files in ./schemata (or path specified by $SCHEMATA_PATH). See schemata.md for structure details
  • Ensure ./schema.json (or file specified by $SCHEMATA_PATH) is writable
  • Generate and verify generation in one step with docker run --rm -v $(pwd):/usr/src/app shinydocker/schema-generator

Customize

  • Modify env.list with custom paths
  • Run with docker run --rm -v $(pwd):/usr/src/app --env-file=env.list schema-generator

Using docker-compose

  • Run with docker-compose up with the docker-compose.yml in this repo as a template
schema-generator:
  image: shinydocker/schema-generator
  volumes:
    - ./:/usr/src/app
  env_file:
    - ./env.list

Where env.list contains

META_PATH=meta.json
SCHEMATA_PATH=schemata/
SCHEMA_PATH=schemas/schema.json

Testing

  • modify .yml schemata and generate schema as documented above
  • Go to ./test
  • run ./node_modules/.bin/mocha ./validate.js