Repository navigation
fail finalize with a default that isn't allowed by its schema - #77
Merged
Merged
Conversation
A property default on a constrained newtype is constructed directly in the generated defaults:: function, so a value the newtype's TryFrom would refuse is accepted at finalize and baked into the output. The test expects Error::InvalidDefault instead and fails until the check lands.
A default on a constrained newtype is constructed directly in the generated code, so nothing applied the newtype's constraints to it: a value the newtype's TryFrom would refuse finalized and rendered. The default walk checks the value as it passes each newtype, through NewtypeConstraints::check_value beside the rendering it matches, and reports a violation as InvalidDefault. A float constraint compares in the inner type's precision; a list compares numbers by value. An allow or deny list of structs and a JSON schema constraint are not matched exactly, which the method's doc states. A pattern that does not compile is an InvalidConstraints error whether or not a default uses it. regress becomes a library dependency; the check compiles patterns. The known_gaps test moves to render.rs as two passing tests over every constraint kind and a whole-type default, plus one for the pattern error.
The schema is compiled once in check_constraints, so one that does not compile is refused there as InvalidConstraints, and check_value validates the default as written against it under the draft the rendered check uses. jsonschema moves from a dev-dependency to a dependency.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.