-
Notifications
You must be signed in to change notification settings - Fork 160
Bug in functions
schema
#794
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
Comments
Which spec version? Main? Yes, we are missing a CI to validate our schemas indeed. |
Just follow my link and click "blame" to see it was introduced in bb5fa9f. No idea which spec versions that covers, 0.8+? |
The See: https://github.com/serverlessworkflow/specification/blob/main/schema/workflow.json#L94-L95 We have a few SDKs using these files to validate and generate workflows, and no one has reported a bug like this before. Do you mind giving more details of how are you validating on your end? I'll try to do something on my side too using AJV. |
Ah, I see, if you use I got confused because You could consider removing these top-level keys, and perhaps adding a comment, to make it more clear that the file isn't meant to be used standalone. |
@jscheid yes, these files are part of the bundle. This is a good suggestion since one might use only the functions schema to validate a single EDIT: My gut feeling says that if we add {
"functions": {
"functions": {}
}
} (attributes left in blank on purpose) So what we can do is to have another schema, say The best of both worlds would be to have |
You could move |
Actually, that might work. I'll run an experiment to have a CI check on the schema + examples with this. |
@jscheid I quickly tried locally with Ajv and if I change to: "type": "object",
"oneOf": [
{
"type": "string",
"format": "uri",
"description": "URI to a resource containing function definitions (json or yaml)"
},
{
"type": "array",
"description": "Workflow function definitions",
"items": {
"type": "object",
"$ref": "#/definitions/function"
},
"additionalItems": false,
"minItems": 1
}
], Won't work since In the workflow schema I did: "functions": {
"$ref": "functions.json#"
} |
Ideally, we should study removing the So we would have:
Instead of:
|
@ricardozanini My initial reaction was to tell you that you are crazy, that we already have all SDKs implementing it some sort of PITA way. In conclusion, I'm game, but we'd have to advertize such breaking change before proceeding IMHO. |
Sure, we can do as part of 0.9. :) |
But arent't you moving the |
@jscheid @cdavernas I made the "oneOf": [
{
"type": "string",
"format": "uri",
"description": "URI to a resource containing function definitions (json or yaml)"
},
{
"type": "array",
"description": "Workflow function definitions",
"items": {
"type": "object",
"$ref": "#/definitions/function"
},
"additionalItems": false,
"minItems": 1
}
] Just had to remove |
In this case, we can add all the properties and require everything (like |
What seems off:
The
functions
key isn't nested insideproperties
here:specification/schema/functions.json
Line 6 in 8a7152e
I think it is meant to be?
What you expected to be:
Nested inside
properties
.Anything else we need to know?:
It might be a good idea to run all the schemas through a strict validator. ajv's strict mode would fit the bill, it reports:
Environment:
The text was updated successfully, but these errors were encountered: