A JSON schema for validating an app_info.json
of a PLCnext Control App according to rules specified in the official documentation.
The schema is built using JSON Schema draft 2020-12
and is tested within this repository.
The schema file may be used in different ways.
Many editors support schema files out of the box and allow validation and completions while editing a JSON file.
Therefore, a $schema
property containing a permalink to the raw schema file can be added:
{
"$schema": "https://github.com/PLCnext/App-Info-Schema/blob/ea31bc3bf3b0222f1f05c94d78ae2313c04e1c9d/app-info-schema.json",
"plcnextapp": {
...
}
}
To ensure updates are available as soon as they are pushed to main, a dynamic link can be used instead:
{
"$schema": "https://raw.githubusercontent.com/PLCnext/App-Info-Schema/refs/heads/main/app-info-schema.json",
"plcnextapp": {
...
}
}
The schema can also be referenced as a local file:
{
"$schema": "./app_info.schema.json",
"plcnextapp": {
...
}
}
Additionally, the schema file can be set up to be used for any app_info.json
in Visual Studio Code as specified in the documentation.
There are libraries available for a broad range of programming languages, that implement JSON Schema and can be used easily.
Some examples:
- Python: https://python-jsonschema.readthedocs.io/en/stable/
- JavaScript: https://ajv.js.org/
- .NET: https://docs.json-everything.net/schema/basics/
- Go: https://github.com/kaptinlin/jsonschema
There are command line tools, that implement the validation against JSON schemas and come in handy when used in a CICD pipeline or as part of a local build process of the PLCnext Control App.
To quickly verify the validity without any installed tools, you may use an online JSON schema validator, that supports draft 2020-12
.
Currently, contributions to this repository are not possible. Nevertheless, upcoming issues can be provided the usual way.