Skip to content

Creating JSON schema objects for Alliance

Edith edited this page May 14, 2020 · 1 revision

General reference for JSON schemas: https://json-schema.org/
Alliance schema is currently using draft-04 (http://json-schema.org/draft-04/schema#)

  1. Make a branch off of ‘master’ (https://github.com/alliance-genome/agr_schemas/tree/master) in your own repo. Master may or may not be the same as the current release.

  2. Stuff in Alliance schema github:

    • bin directory contains validation scripts
    • data_dictionary contains files describing the different objects.
    • ingest directory -- where all the schema objects are stored.
    • lib directory - validation java script
  3. Make new json schema in the ‘ingest’ directory. Reuse the existing json objects as much as possible. Make sample data soon after you make your schema. It helps to make sure the schema captures all the data.

  4. Run the validator script (agr_validate.py) with your sample data and schema. It helps to make sure your schema and sample data are correct.
    How to use: agr_validate.py -d test_data.json -s base_schema.json
    EX: agr_validate.py -s ingest/htp/dataset/datasetMetaDataDefinition.json -d ingest/htp/dataset/exampleSuperseriesDataset.json

  5. Add to Travis for validation - Once your sample data validates, add a line (or two) to .travis.yml file, under ‘script:’ section.
    EX: "python bin/agr_validate.py -s ingest/htp/dataset/datasetMetaDataDefinition.json -d ingest/htp/dataset/exampleSuperseriesDataset.json"

  6. Add a yaml file for the new schema object should be added to data_dictionary after the JSON object schema is created.
    EX: allele.yaml

  7. Push changes back to ‘master’ branch.

**NOTE: If you are making changes for a schema release after it has been created, but before it has been released, you should make a branch from that specific release branch and pull request changes there. Otherwise, branch and make pull request changes to ‘master.’