Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ You can find current call coordinates and dates in [our wiki](https://github.com

For detailed information see our [contribution guide](CONTRIBUTING.md)!

### Machine-readable node schema

`schemas/vspec-node.schema.json` is a [JSON Schema 2020-12](https://json-schema.org/draft/2020-12/schema) document that describes every field a vspec YAML node may carry. Third-party tooling authors can validate against it so that unknown or misspelled fields are caught at parse time, and any future field additions to the spec are automatically a visible, reviewable diff to the schema. The `additionalProperties: false` constraint is intentional — it makes the schema normative rather than just descriptive.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not know how easy it would be to create a minimal example on how this could be used, that we potentially could execute as part of CI to verify that std catalog and the schema are in sync. I am thinking of something

  • vspec export yaml or vspec export json
  • And then some command that checks that it complies with schema
    Have you done any checks like that to verify that the schema works with the current std catalog?


### VSS version and release handling

Both VSS (this repository) and [VSS-tools](https://github.com/COVESA/vss-tools) use a [PEP](https://peps.python.org/pep-0440/)
Expand Down
61 changes: 61 additions & 0 deletions schemas/vspec-node.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://covesa.github.io/vehicle_signal_specification/schemas/vspec-node.schema.json",
"title": "VSS vspec node",
"description": "A single node in a VSS vspec YAML file.",
"type": "object",
"required": ["type"],
"properties": {
"type": {
"type": "string",
"enum": ["branch", "sensor", "actuator", "attribute"],
"description": "Node kind. branch = non-leaf container; sensor/actuator/attribute = leaf."
},
"datatype": {
"type": "string",
"description": "Value type for leaf nodes, e.g. float, uint8, string, boolean. Required for sensor/actuator/attribute; not used on branch."
},
"description": {
"type": "string",
"description": "Human-readable description of the signal or branch."
},
"unit": {
"type": "string",
"description": "Unit of measure. Should be a value from the VSS unit catalogue (spec/units.yaml)."
},
"min": {
"description": "Minimum valid value (numeric). Applies to leaf nodes only."

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type number?

},
"max": {
"description": "Maximum valid value (numeric). Applies to leaf nodes only."

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

number type

},
"default": {
"description": "Default value for the signal at startup. Type must match datatype."
},
"comment": {
"type": "string",
"description": "Informative note, not part of the normative definition."
},
"deprecation": {
"type": "string",
"description": "Non-empty string indicates this node is deprecated; value is the deprecation notice including the version when it was deprecated."
},
"instances": {
"description": "Instance expansion expression (string or array of strings) for parameterised branches.",
"oneOf": [
{ "type": "string" },
{ "type": "array", "items": { "type": "string" }, "minItems": 1 }
]
},
"allowed": {
"type": "array",
"description": "Enumerated allowed values for the signal. Items should match the datatype.",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"description": "Enumerated allowed values for the signal. Items should match the datatype.",
"description": "Enumerated allowed values for the signal. Items must match the datatype.",

"minItems": 1
},
"pattern": {
"type": "string",
"description": "Regular expression that the signal value must match."
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enum is missing

},
"additionalProperties": false
}
Loading