-
Notifications
You must be signed in to change notification settings - Fork 40
generate a json-schema file #45
Comments
since the schema is gonna change, I'm hoping we can automate the generation of the schema as part of the build from the source - am sure the kubernetes project does something like this for its swagger stuff? |
For reference:
We need to figure out how do we create a swagger API or openAPI. |
@surajssd Thanks for recording all the links here. Will be helpful. @jstrachan I think, we will take this up this sprint in small pieces. This will help PM validation as well.
|
BTW here's the project which we use to generate Java DTOs & JSON Schemas for kubernetes and openshift |
Right now the work is being done in https://github.com/surajssd/kedgeSchema It can generate the schema but not sure if the schema is complete or correct |
removing the image field $ cat ./example/db.json
{
"name": "database",
"containers": [
{
"name": "db",
"env": [
{
"name": "MYSQL_ROOT_PASSWORD",
"value": "rootpasswd"
},
{
"name": "MYSQL_PASSWORD",
"value": "wordpress"
}
],
"envFrom": [
{
"configMapRef": {
"name": "database"
}
}
]
}
],
... trying to validate $ jsonschema -F "{error.message}" -i ./example/db.json ./configs/appspec.json
u'image' is a required property errors out changing the field type of $ cat ./example/db.json
{
"name": 1,
"containers": [
{
... errors out as: $ jsonschema -F "{error.message}" -i ./example/db.json ./configs/appspec.json
1 is not of type u'string' The file configs/appspec.json is the schema for kedge if I am not mistaken. |
@surajssd This is a great start. We should break this issue into multiple issues and have checklist. WDYT? |
Yes I think so we can create a checklist to do that |
|
could we create new subcommand for generating current jsonschema? Something like
solved by above ;-)
depends on how we solve #141
if we have sub command for outputting JSON schema we don't need that. |
how will #119 impact Json schema generation? |
@kadel not sure how it will impact the jsonschema I wil need to find that because now we won't have one struct but multiple ones, so can't say anything now! |
We need to make sure the generated json schema are stored as artifacts some where in the repository. And this file should be generated by CI for every release for now. |
Generation code resides in https://github.com/kedgeproject/kedge-jsonschema
The repo has documentation of how to generate the configs, also the way code works can be understood by reading comments in code
This needs to be done filed an issue for this one #280
right now it is based on k8s 1.7 https://github.com/kedgeproject/kedge-jsonschema/blob/master/scripts/k8s-release
this needs to be evaluated |
Is there a place where I can find JSON schema for the latest release? |
it'd be nice to generate a json schema file so we can include support for kapp inside tools like this: https://github.com/gorkem/vscode-k8s/ so that we can get automatic completion and validation in VS Code / Che / Eclipse.
I wonder if we maybe need to add a line like:
to make it easier to know what schema to use in the IDE plugin?
The text was updated successfully, but these errors were encountered: