refactor: create separate schema for Ajv validation#504
Merged
Conversation
|
Node: 14 MAIN: Node: 16 MAIN: Node: 18 MAIN: |
Contributor
|
It makes sense to me. |
787dd9a to
b2d55a0
Compare
b2d55a0 to
e6fcbe9
Compare
Member
Author
|
There are two updates.
|
climba03003
approved these changes
Aug 29, 2022
Member
climba03003
left a comment
There was a problem hiding this comment.
The code itself look good to me and the changes on debug output is breaking.
@ivan-tymoshenko
You are the one focusing on this package. Can I ask how many breaking changes are you expected in the near future? I am considering should we group a bunch of them before another major.
| } | ||
| this.insertSchemaBySchemaId(schema, schemaId) | ||
| this.insertSchemaSubschemas(schema, schemaId) | ||
| if (this.getSchema(schemaId) === undefined) { |
Member
There was a problem hiding this comment.
Is this changes itself self contained?
Do we need a test case for it?
Member
Author
There was a problem hiding this comment.
I didn't add this check. I just moved it inside the class.
Line 113 in b0bb1a6
Member
Author
|
@climba03003 I can leave the Ajv instance and remove it in the next major release. |
2 tasks
2 tasks
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.
How it's working now:
It takes a user-defined schema, adds necessary adjustments for Ajv (now it's only for date type), and then works with modified schema.
How it will work:
It will clone a user-defined schema, modify it and pass it to the Ajv. Serialization will work with the original schema. The only requirement we must follow is that the schema must not change its structure during the modification. In other words, the JSON pointers must match in two schemas, but the schemas themselves (type, format, keywords, ... etc.) may differ.
Motivation:
It's too complicated to maintain one syntax for serialization and validation rules. Our code depends on Ajv validation syntax.
Depends on #507