-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
fix(objectschema)!: omit id from schema returned by without + only #195
fix(objectschema)!: omit id from schema returned by without + only #195
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.
lgtm
anything left to do here? or does anyone else need to look at this? |
@aboutlo ? |
@aboutlo thoughts? |
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
@aboutlo Done |
@@ -1 +1 @@ | |||
v12.14.0 | |||
v14.19.0 |
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 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 |
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 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 test
andnpm run benchmark
and the Code of conduct