RailToolKit Schema
About
This repo collects the descriptions of the structure and the validation constraints of tools in the railtoolkit in JSON schemas. It is, therefore, an alternative to RailML. The JSON schemas enable the validation of YAML files in TrainRun.jl and rolling-stock.
Prerequisite
You will need a validator to validate the schema against data. This example uses the Ajv JSON schema validator.
$ npm install -g ajv-cli && npm install -g ajv-formats
Usage
You will need the schema and some data. The repo contains among others the rolling-stock schema and example data:
$ git clone https://github.com/railtoolkit/schema.git && cd schema
You can now validate if the data follows the schema:
$ ajv --spec=draft2020 -c ajv-formats -s src/rolling-stock.json -d doc/rolling-stock.example.yaml
This will return:
$ doc/rolling-stock.example.yaml valid
Or:
$ ajv --spec=draft2020 -c ajv-formats -s src/running-path.json -d doc/running-path.example.yaml
This will return:
$ doc/running-path.example.yaml valid
Documentation
see Rolling-Stock.md and Running-Path.md for information about the used attributes.
Contributing
see CONTRIBUTING.md file
Roadmap
- include breaking model in rolling-stock schema
License
Copyright (c) 2022, Martin Scheidt <m.scheidt@tu-bs.de> (ISC License)
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.