-
Notifications
You must be signed in to change notification settings - Fork 218
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
Allow constraint trait errors on error example inputs #1949
Allow constraint trait errors on error example inputs #1949
Conversation
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 don't think error definitions using values that don't match the types of for the error are possible to use. If examples let you give exact HTTP messages or something, then sure. But they're structured based on the model. So I think we would want to disable constraints, but not type checking.
6556b90
to
a378fdb
Compare
Updated this PR to only allow lowering specific trait validations. Type checking validation issues are still emitted as an |
smithy-model/src/main/java/software/amazon/smithy/model/traits/ExamplesTrait.java
Outdated
Show resolved
Hide resolved
@@ -61,7 +61,7 @@ The configuration file accepts the following properties: | |||
projection. Plugins are a mapping of :ref:`plugin IDs <plugin-id>` to | |||
plugin-specific configuration objects. | |||
* - ignoreMissingPlugins | |||
- ``bool`` | |||
- ``boolean`` |
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.
Updated for consistency, since we use boolean
elsewhere in the docs.
2f7261d
to
05d809a
Compare
05d809a
to
5fe3341
Compare
5fe3341
to
2655235
Compare
The values provided for the ``input`` and ``output`` members MUST be | ||
compatible with the shapes and constraints of the corresponding structure. | ||
These values use the same semantics and format as | ||
* - disableConstraints |
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.
Shouldn't this only be allowed for errors?
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.
ExamplesTraitsValidator checks that this is only set when errors are also present. Updated the docs to make this clear.
RANGE_TRAIT_ZERO_VALUE_WARNING, | ||
|
||
// Lowers severity of constraint trait validations to WARNING. | ||
DISABLE_CONSTRAINTS; |
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.
This name seems weird because it doesn't disable validation of constraints but lowers the severity. DISABLE_CONSTRAINTS -> IGNORE_CONSTRAINTS?
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.
Updated to allowConstraintError
in e5bcfd3
This PR adds a
disableConstraints
boolean to the @examples trait, allowing for input constraint trait validations to be lowered fromERROR
toWARNING
.By lowering the severity from an
ERROR
, Smithy model authors can include examples of invalid inputs and their corresponding errors.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.