Skip to content

abusix/xarf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

2c73cb7 · Feb 17, 2020

History

85 Commits
Oct 23, 2018
Feb 13, 2020
Sep 11, 2018
Feb 17, 2020
Feb 13, 2020
Feb 13, 2020
Feb 13, 2020
Feb 13, 2020

Repository files navigation

schema-discussion

This is the place to share and discuss new xarf schemas. The schemas are written in json schema and use its extension mechanisms to allow sharing common sub schemas.

Latest Release

Find the latest schema release on the releases page.

  • xarf_bundled_<VERSION>.schema.json
    • all schema definitions in one file
    • contains only internal references
    • small file size
    • best for most use cases, when the used tool is good enough to understand complex internal references (multiple hops)
  • xarf_deref_<VERSION>.schema.json
    • all schema definitions in one file
    • contains no references
    • pretty big file size
    • can be useful for some not-so-sophisticated code generation tools that can't handle references

Build status

Build Status

Validating json-schema samples

Command line

npm install -g jsonfile json-schema-ref-parser ajv-cli
ajv -s xarf.schema.json -d "samples/*.json" -r "schemas/*.schema.json"

Project structure

File(s) Content
xarf.schema.json contains links to all specific schemas
schemas/xarf_shared.schema.json reusable sub schemas
schemas/*.schema.json specific schemas
samples/*.json example documents for the schemas
create_full_schema_file.js allows combining the schema into a single file

Adding a new schema

  1. Add a new schema as [subtype].schema.json and try to reuse as much as possible from xarf_shared.schema.json
  2. Add an example sample to samples/*
  3. Add the new schema to the list in xarf.schema.json
  4. Discuss and improve

Writing the schema to a single file:

Use create_full_schema_file.js to create a single file schema.

npm install jsonfile json-schema-ref-parser
node create_full_schema_file.js

It will generate two files:

File Content
xarf_bundled.schema.json bundled and minimized using internal refs, might not work with all json schema tools
xarf_deref.schema.json bundled and completely derefed. might be bigger in size, but should work with all tools