fix(objectschema)!: omit id from schema returned by without + only#195
Merged
aboutlo merged 1 commit intofastify:masterfrom Oct 3, 2022
Merged
Conversation
Contributor
Author
|
anything left to do here? or does anyone else need to look at this? |
Contributor
Author
|
@aboutlo ? |
Contributor
Author
|
@aboutlo thoughts? |
Collaborator
|
Hey @esatterwhite thank you for your PR 💪 Could you add the changes in the documentation aka:
Then I can merge and make a release with these breaking changes and the drop of the old node versions |
239fe77 to
088ad2d
Compare
the methods without and only return new schema objects with the same id that was found on the original. In terms of schema reuse, this creates two different schemas with the same id which is technically invalid. Additionally, it was not possible to set the id property on an object schema that had properties defined. This problem originates from the setattribute function which will always set the attribute on the schema properties if they are defined. In the case of the object schema, this is almost always the case. This changes the id function on the object schema to always generate a new schema with the id set on the object schema rather than its properties BREAKING CHANGE: ObjectSchema.id() will always set the id on the root object BREAKING CHANGE: ObjectSchema.without() will omit id from the return schema BREAKING CHANGE: ObjectSchema.only() will omit id from the return schema
088ad2d to
16a1bd4
Compare
Contributor
Author
|
@aboutlo Done |
esatterwhite
commented
Oct 3, 2022
| @@ -1 +1 @@ | |||
| v12.14.0 | |||
| v14.19.0 | |||
Contributor
Author
There was a problem hiding this comment.
This doesn't actually work on node 12 anymore
Pull Request Test Coverage Report for Build 3175096857
💛 - Coveralls |
Pull Request Test Coverage Report for Build 3175096857
💛 - Coveralls |
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.
the methods without and only return new schema objects with the same id that was found on the original. In terms of schema reuse, this creates two different schemas with the same id which is technically invalid. Additionally, it was not possible to set the id property on an object schema that had properties defined. This problem originates from the
setattributefunction which will always set the attribute on the schema properties if they are defined. In the case of the object schema, this is almost always the case. This changes the id function on the object schema to always generate a new schema with the id set on the object schema rather than its propertiesBREAKING CHANGE: ObjectSchema.id() will always set the id on the root object
BREAKING CHANGE: ObjectSchema.without() will omit id from the return schema
BREAKING CHANGE: ObjectSchema.only() will omit id from the return schema
Checklist
npm run testandnpm run benchmarkand the Code of conduct