Skip to content
This repository has been archived by the owner on Dec 11, 2023. It is now read-only.

NodeJS tool which generates JSON schema files from TerriaJS source, used by DataSourceEditor (based on JSONEditor)

Notifications You must be signed in to change notification settings

TerriaJS/generate-terriajs-schema

Repository files navigation

Generate-TerriaJS-Schema

This utility scans the TerriaJS source code in order to build a JSON Schema that validates catalog "init" files. This has two purposes:

  1. Automatically generating an editor for catalog files (included in NationalMap at .../editor)
  2. Validating catalog files.

Tags

It uses JSdoc-style tags embedded as comments in the source code.

These class-level tags are supported:

  • @editortitle (uses class name, munged, if not present)
  • @editordescription (uses JSdoc description, if not present)

These property-level tags are supported:

  • @type
  • @editortype (in same format as @type, uses @type if not present)
  • @editordescription
  • @editorformat (customising the choice of editor, eg tabs, table, checkbox)
  • @editoritemstype (type of each thing in the array. Generally better to use @type {Number[]} where possible.
  • @editoritemstitle (name of each thing in the array, like Filter)
  • @editoritemsdescription (description of each thing in the array)

Command-line usage

generate-terriajs-schema v1.1.1
gen-schema [options] --source <dir> --dest <dir>

Options:
  --source           TerriaJS directory to scan.        [default: "../terriajs"]
  --minify           Generate minified JSON
  --dest             Output directory                      [default: "./schema"]
  --quiet            Suppress non-error output.                        [boolean]
  --editor           Generates JSON-editor friendly version of schema. [boolean]
  --noversionsubdir  Don't add TerriaJS version as subdirectory.       [boolean]
  --help             Show help                                         [boolean]

About

NodeJS tool which generates JSON schema files from TerriaJS source, used by DataSourceEditor (based on JSONEditor)

Resources

Stars

Watchers

Forks

Packages

No packages published