Here is a basic schema based on YoRyan's examples on the first page, added my own wishes of having nested objects, and being able to define a constraint.
For the top level tags:
{ "$schema": "http://json-schema.org/2019-09/schema", "title": "train-or", "type": "object", "description": "The new OpenRails consist format", "properties": { "List": { "type": "array", "description": "An array of listElements. This ultimately represents a block or consist ordered sequence.", "items": { "$ref": "listElement.schema.json" }, }, "Random": { "type": "array", "description": "An array of randomElements. This ultimately represents an inventory list to pick units from.", "items": { "$ref": "randomElement.schema.json" }, }, "DisplayName": { "type": "string", "description": "The name that can be referenced in Consist or Train tags", }, "MaxVelocityMpS": { "type": "number", "description": "Maximum velocity of the sub-elements", }, "Durability": { "type": "number", "default": 1.0, "minimum": 0.0, "maximum": 1.0, "description": "Durability percentage", }, "PlayerDrivable": { "type": "boolean", "default": "true", "description": "Whether it is to be listed in the player train/consist list", }, }, }
This is for the ordered list tag under "List[]":
{ "$schema": "http://json-schema.org/2019-09/schema", "title": "listElement", "type": "object", "description": "Ordered list of unit selections", "properties": { "Engine": { "type": "string", "description": "Reference to an MSTS .eng", }, "Wagon": { "type": "string", "description": "Reference to an MSTS .wag", }, "Consist": { "type": "string", "description": "Reference to another List type element", }, "Train": { "type": "string", "description": "Reference to a Random type element", }, "Flip": { "type": "boolean", "default": "false", "description": "Flips the (sequence of) unit(s)", }, "Count": { "type": "integer", "default": 1, "minimum": 1, "description": "Selects and includes multiple of the referenced unit(s)", }, "ConstraintOnSubSelections": { "type": "boolean", "default": "true", "description": "The sub-Train/Random should select always from the same pool", }, }, }
And this is for the random inventory list under "Random[]":
{ "$schema": "http://json-schema.org/2019-09/schema", "title": "randomElement", "type": "object", "description": "An inventory of units to select from", "properties": { "Engine": { "type": "string", "description": "Reference to an MSTS .eng", }, "Wagon": { "type": "string", "description": "Reference to an MSTS .wag", }, "Consist": { "type": "string", "description": "Reference to a List type element", }, "Train": { "type": "string", "description": "Reference to another Random type element", }, "Probability": { "type": "number", "minimum": 0.0, "maximum": 1.0, "description": "weight of probability", }, }, }