-
Notifications
You must be signed in to change notification settings - Fork 1.2k
doc: JSON schema for cockpit manifest.json
#22441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Then we can have it on the website as a recommendation: {
"$schema": "https://cockpit-project.org/doc/guide/static/manifest.schema.json"
...
}And to test locally before it's published:
{
"$schema": "../../doc/guide/static/manifest.schema.json",
"name": "network",
"conditions": [
{"path-exists": "/usr/share/dbus-1/system.d/org.freedesktop.NetworkManager.conf"}
],
"menu": {
"index": {
"label": "Networking",
"order": 40,
"docs": [
{
"label": "Managing networking bonds",
"url": "https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/9/html/configuring_and_managing_networking/configuring-network-bonding_configuring-and-managing-networking#proc_configuring-a-network-bond-by-using-the-rhel-web-console_configuring-network-bonding"
},
{
"label": "Managing networking teams",
"url": "https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/9/html/configuring_and_managing_networking/configuring-network-teaming_configuring-and-managing-networking#proc_configuring-a-network-team-by-using-the-rhel-web-console_configuring-network-teaming"
},
{
"label": "Managing networking bridges",
"url": "https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/9/html/configuring_and_managing_networking/configuring-a-network-bridge_configuring-and-managing-networking#proc_configuring-a-network-bridge-by-using-the-rhel-web-console_configuring-a-network-bridge"
},
{
"label": "Managing VLANs",
"url": "https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/9/html/configuring_and_managing_networking/configuring-vlan-tagging_configuring-and-managing-networking#proc_configuring-vlan-tagging-by-using-the-rhel-web-console_configuring-vlan-tagging"
},
{
"label": "Managing firewall",
"url": "https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/9/html/configuring_firewalls_and_packet_filters/using-and-configuring-firewalld_firewall-packet-filters#enabling-services-on-firewall-using-the-web-console_controlling-network-traffic-using-firewalld"
}
],
"keywords": [
{
"matches": ["network", "interface", "bridge", "vlan", "bond", "team", "port", "mac", "ipv4", "ipv6"]
},
{
"matches": ["firewall", "firewalld", "zone", "tcp", "udp"],
"goto": "/network/firewall"
}
]
}
}
} |
| } | ||
| }, | ||
| "tools": { | ||
| "description": "todo", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"tools" and "dashboard" should be the same as "menu", i.e."#/$defs/menu-type".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack thanks! Lots of lines so explains why I missed a few things
|
This seems to still be draft, right? |
|
@Venefilyn, in case you haven't already, please have a look at |
|
I like this! We should validate our own manifests according to this schema in test/common/static-code. |
Depends. What do we want to accomplish with this? For now I would say we stick to just recommending this schema and over time move our manifest validation script over to use the schema. But need tests for that which I'm not sure we have
Ack. Anything missing at the moment that you can think of?
Shouldn't be too difficult. There is a python package for this that we could use https://github.com/python-jsonschema/jsonschema Since I assume we don't have limitations on what test dependencies we have this would be fine to use right? |
Our `manifest.json` is currently only documented through our docs, and in there it can be quite confusing. We tend to instead copy from other repos or pages and I assume other projects do too. But modifying it can be tedious. Setting this JSON schema as a `$schema` property in your `manifest.json` file will make all properties validated against. Assisted-by: ramalama+olmo2:7b-1124-instruct-q8_0 Signed-off-by: Freya Gustavsson <[email protected]>
2069307 to
c12b9d7
Compare
allisonkarlitskaya
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this sounds ridiculous but could we write this file in yaml? It would be a lot easier to read...
Otherwise: before we commit to this I think I want a firmer idea of where the schema will live. In particular:
- we need to run our linters and stuff offline, which implies that the schema needs to live in the cockpit repo in a place where the subprojects can also hit it
- you seemed to suggest that we'll replace the relative path with a URL during publishing but we don't perform any transformations on our manifest.json files anymore (which was a hard-fought victory). Will the symlink be broken when the file is installed? Will we install the schema on the system?
- will the bridge break if it notices this field and doesn't recognize it? I guess/hope not?
There aren't really yaml schema validation AFAIK.
This wouldn't really change the existing syntax whatsoever though. But I also hope that we don't break cockpit if it detects a top level property "$schema" on a
But yeah I don't suggest we throw out our validation we have now for this, but rather recommend to use this schema for your |
|
We discussed a bit in calls and I forgot to make a note about it. In short:
|
|
We can also generate AsciiDoc files from JSON Schema using something like https://github.com/CesiumGS/wetzel |
|
I'm gonna block this on #21515 to make things easier for myself |
Our
manifest.jsonis currently only documented through our docs, andin there it can be quite confusing. We tend to instead copy from other
repos or pages and I assume other projects do too. But modifying it can
be tedious.
Setting this JSON schema as a
$schemaproperty in yourmanifest.jsonfile will make all properties validated against.
I feel like having it in this repo is better than the website repo given it is
code-related.
We might also want to version the schema file and add an optional
version property in the schema itself. That way we can even have
(automated) scripts to migrate future changes to the
manifest.jsonAssisted-by: ramalama+olmo2:7b-1124-instruct-q8_0
Signed-off-by: Freya Gustavsson [email protected]