Skip to content

Coding guidelines~Schema management

Cory Crowley edited this page Mar 9, 2022 · 2 revisions

3D Scenes Configuration Schema

The schema for the 3D Scenes Configuration JSON document lives under the schemas path of the repository. Once this repository goes public, this can be referenced like a CDN by any JSON document which adheres to this schema.

https://github.com/microsoft/iot-cardboard-js/blob/main/schemas/3DScenesConfiguration/v1.0.0/3DScenesConfiguration.schema.json

The schema grouping and versioning uses the following pattern:

/schemas
  / eg: 3DScenesConfiguration
    / eg: 1.0.0
      .schema.json eg: 3DScenesConfiguration.schema.json

To create a new schema version, follow the semantic versioning rules and duplicate the schema to a new version folder.

Automatic type generation from the 3D Scenes Configuration Schema

To generate TypeScript types from the schema, use the json-schema-to-typescript node utility script.

The contents of this script can be updated to generate types based on a specific schema version - as well as outputting a versioned .d.ts type file.

To run this script, from the root project folder run: node .\tools\generate-3d-schema-types.js

Clone this wiki locally