-
Notifications
You must be signed in to change notification settings - Fork 151
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
Restrict extra props #928
Restrict extra props #928
Conversation
Signed-off-by: Matthias Pichler <[email protected]>
Signed-off-by: Matthias Pichler <[email protected]>
Signed-off-by: Matthias Pichler <[email protected]>
Signed-off-by: Matthias Pichler <[email protected]>
a787371
to
93dcd34
Compare
@@ -5,6 +5,7 @@ type: object | |||
properties: | |||
document: | |||
type: object | |||
unevaluatedProperties: false |
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.
@JBBianchi Spot on, totally agree with you!
I wonder if this PR isn't a bit too drastic (but it might not be). An important feature of the spec is its extensibility. By restricting everything, we might lose a some of the flexibility. For instance (as I commented earlier before deletion), the The author of a workflow also have access to very powerful variables, namely $workflow and $task. Therefore, he can define custom properties (e.g. I'm not sure how to verify we didn't restrict the author too much here. At a glance, I think it's quite ok but it's not a very empirical approach ^^' |
Very good points here, however I feel like I have to counter with the fact that I came across the issue because some example workflows behaved differently than expected 😅 After updating the schema I had to fix 3 examples in the repo and none of us caught these errors. So on behalf of authors I would advocate for better feedback from tooling which need a schema. Maybe we could introduce a dedicated field for metadata similar to JSON API 🤔 |
I agree with @JBBianchi that we should preserve extensibility, without however, as pointed out by @matthias-pichler-warrify, loosing (schema-based) validation features.
Maybe we could reintroduce that property in specific places, indeed. Maybe even everywhere? I don't really have a strong opinion on that subject, so I'll leave it up to you guys 😉 |
@cdavernas what I also thought of just now: document: {}
do:
- getPet:
call: http
with: {}
$foo: bar no preference for any given prefix on my side though |
Why not? Good idea, even though I personally am not a huge fan of it, as I think it would "dirty" the definition. But again, no strong opinion here anyways. @JBBianchi @fjtirado @ricardozanini What do you guys think? |
I think we might add a "custom" key in those places where we think implementors might add custom stuff. For example
|
Yeah so |
@matthias-pichler-warrify Sure authors would use them and implementors might implement it ;) |
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.
LGTM, cheers! ❤️
We will however need to open a new issue/PR addressing @JBBianchi's comments ;)
|
@JBBianchi is this portion of the schema are you referring too? - title: CallFunction
$ref: '#/$defs/taskBase'
type: object
unevaluatedProperties: false
required: [ call ]
properties:
call:
type: string
not:
enum: ["asyncapi", "grpc", "http", "openapi"]
description: The name of the function to call.
with:
type: object
additionalProperties: true
description: A name/value mapping of the parameters, if any, to call the function with. If so, I think it's correct. It's the A way of validating this PR is to add an example that breaks the rule on purpose. We should always add examples/test cases to PRs that change the schema. I'll try to reinforce that in the CI. |
You're absolutely right, I wasn't looking at the right place? |
Is there anything else needed to merge this? |
@matthias-pichler-warrify Not that I know of. Merged, thanks for the reminder! |
Signed-off-by: Matthias Pichler [email protected]
Please specify parts of this PR update:
Discussion or Issue link:
What this PR does:
I added a lot of
unevaluatedProperties: false
to restrict extra propsAdditional information: