Allow constraint trait errors on error example inputs#1949
Allow constraint trait errors on error example inputs#1949srchase merged 5 commits intosmithy-lang:mainfrom
Conversation
mtdowling
left a comment
There was a problem hiding this comment.
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
| plugin-specific configuration objects. | ||
| * - ignoreMissingPlugins | ||
| - ``bool`` | ||
| - ``boolean`` |
There was a problem hiding this comment.
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.
Shouldn't this only be allowed for errors?
There was a problem hiding this comment.
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.
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.
Updated to allowConstraintError in e5bcfd3
This PR adds a
disableConstraintsboolean to the @examples trait, allowing for input constraint trait validations to be lowered fromERRORtoWARNING.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.