Conversation
…metarhia-master # Conflicts: # CHANGELOG.md # lib/schema.js # test/schema.js
Metarhia master
georgolden
requested changes
Aug 3, 2022
| return null; | ||
| } | ||
|
|
||
| static concat(...sources) { |
Member
There was a problem hiding this comment.
try to use Schema.protoype.toJSON to reduce amount of code. You can create new Schema with just typings from toJSON
| // Q: How to merge options? | ||
| for (const schema of schemas) { | ||
| resultSchema.updateFromSchema(schema); | ||
| // Q: Can we have conflicts with indexes? |
Member
There was a problem hiding this comment.
I need examples of it, write tests please
| const schema2 = Schema.from({ c: 'string', d: 'number' }); | ||
| const schema3 = Schema.from({ e: 'string', f: 'number' }); | ||
| test.strictEqual( | ||
| Schema.concat(schema1, schema2, schema3).toString(), |
| } | ||
| const schema3 = Schema.from({ Custom: {}, type: 'string' }); | ||
| const schema4 = Schema.from({ Custom: {}, type: 'number' }); | ||
| try { |
Member
There was a problem hiding this comment.
use test.throws(() => fn(), new Error(your error message))
| (test) => { | ||
| const schema1 = Schema.from({ a: 'string', b: 'number' }); | ||
| const schema2 = Schema.from({ Custom: {}, type: 'string' }); | ||
| try { |
| } | ||
| } | ||
| const resultSchema = Schema.from(defs); | ||
| // Q: How to merge options? |
Member
There was a problem hiding this comment.
we don't need to merge options and concat validate functions
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.
npm t)npm run fmt)