# generate-terriajs-schema

> Generates JSON schema files from TerriaJS source, used by DataSourceEditor (based on JSONEditor)

Latest version **1.5.0** (published 2020-04-16) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install generate-terriajs-schema
pnpm add generate-terriajs-schema
yarn add generate-terriajs-schema
bun add generate-terriajs-schema
```

Provides the command `gen-schema`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.5.0 |
| Published | 2020-04-16 |
| First published | 2016-01-19 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 24.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Data61 |
| Maintainers | artstr, kring, stevage, terria |

## Links

- npm: https://www.npmjs.com/package/generate-terriajs-schema
- Repository: https://github.com/TerriaJS/generate-terriajs-schema
- Homepage: https://github.com/TerriaJS/generate-terriajs-schema#readme
- Issues: https://github.com/TerriaJS/generate-terriajs-schema/issues
- npm.io page: https://npm.io/package/generate-terriajs-schema

## Dependencies (5)

- [when](https://npm.io/package/when.md) ^3.7.7
- [yargs](https://npm.io/package/yargs.md) ^3.32.0
- [esprima](https://npm.io/package/esprima.md) ^2.7.1
- [glob-all](https://npm.io/package/glob-all.md) ^3.0.1
- [jsdoc-to-markdown](https://npm.io/package/jsdoc-to-markdown.md) ^4.0.1

## Recent versions

- 1.5.0 (latest) — 2020-04-16
- 1.4.0 — 2019-02-19
- 1.3.0 — 2016-09-13
- 1.2.1 — 2016-02-16
- 1.1.1 — 2016-02-15
- 1.1.0 — 2016-02-12
- 1.0.2 — 2016-01-25
- 1.0.0 — 2016-01-20
- 0.4.0 — 2016-01-20
- 0.3.0 — 2016-01-20
- 0.2.0 — 2016-01-19
- 0.1.1 — 2016-01-19
- 0.1.0 — 2016-01-19

## README

## 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]
```

---
_Source: https://npm.io/package/generate-terriajs-schema · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
