Description of the limitation and why it is relevant to address
As a developer I want to be assisted in editing viktor.config.toml
in my code editor, so I’m sheltered from typo or other mistakes.
I think this is relevant for the VIKTOR platform because it prevent “silly” errors, which will only show up once a developer tries to publish an app.
I’m aware it’s a really small and niche “feature”, so perhaps the workaround is fine.
Submitter proposed design
I’m using the Even Better TOML extension in VS Code, that support schema validation through schema json files. Below is an example I made.
By specifying the schema, it can validate the content of the tom file. Here’s a screenshot of a typo I hadn’t noticed before. Apparently I missed the “s” in assets_path
It would be nice if the schema could be uploaded to json-schema.org, so we developers can all use the same schema. In that way you could update the schema once there are new options.
Example schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Viktor configuration file",
"description": "The `viktor.config.toml` file is used to set configuration settings for your app, and is placed on the top-level of the application folder.",
"type": "object",
"properties": {
"app_type": {
"description": "The type of app",
"type": "string",
"enum": [
"editor",
"simple",
"tree"
]
},
"assets_path": {
"description": "Defines the directory where assets (e.g. images) are stored",
"type": "string"
},
"enable_privileged_api": {
"description": "With this key, the application code is able to bypass user access restrictions",
"type": "boolean"
},
"python_version": {
"description": "Specify the Python version to publish the application with",
"type": "string",
"enum": [
"3.8",
"3.9",
"3.10",
"3.11"
]
},
"welcome_text": {
"description": "A welcome text can be customized, which will be shown to the user upon entering the application dashboard. The value is a path pointing to a file located relative to viktor.config.toml. The file supports styling with Markdown.",
"type": "string"
}
},
"required": [
"app_type"
],
"additionalProperties": false
}
Current workarounds
Manually check the file, or try to publish it. Or use the above schema just locally.