Improve parsing behavior and default property usage#357
Closed
A-312 wants to merge 41 commits intomozilla:feat-multi-packages-splitfrom
A-312:improve-parsing-behavior
Closed
Improve parsing behavior and default property usage#357A-312 wants to merge 41 commits intomozilla:feat-multi-packages-splitfrom A-312:improve-parsing-behavior
A-312 wants to merge 41 commits intomozilla:feat-multi-packages-splitfrom
A-312:improve-parsing-behavior
Conversation
Contributor
Author
- Add argument `debug` to `getSchema()`: If true, returns data schema (like it is stored in convict instance).
- .defaut() and .reset() errors - override parent errors
Contributor
Author
|
(I will try to finish this one before the end of the month) |
Contributor
Author
|
I had a doubt to know if I have to fix #355 (P1) or not because I didn't know on what case we have to do this and maybe is not the proper way to set After thinking, I find one case: And P1 will be usefull with P2 if |
…eplaced by `default` during the schema parsing.
_cvtFormat rename to _cvtValidateFormat
Add: '_cvtCoerce', '_cvtValidateFormat', '_cvtGetOrigin', 'format', 'required'
- format: [ Object ] and default is not defined should be parsing like a config schema property (current behavior) ; - format: [ String ] or format: [ typeof this !== 'object' ] should catch like convict property (format of last property) even if default is not set (new behavior).
7064166 to
051dd99
Compare
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.
Fix: #337
TODO :
1) fix: Add option: Properties with default of undefined [do/do not] behave like properties that have not been specified #355 fix: Providing a default of
undefinedprevents format from being checked #278 Addschema.required = trueto allow optional config property or not2) fix: Improve schema parsing and default property usage #337 Improve schema property parsing with
.format:property:format: [ Object ]anddefault is not definedshould be parsing like a config schema property (current behavior) ;format: [ String ]orformat: [ typeof this !== 'object' ]should catch like convict property (format of last property) even if default is not set (new behavior)..
3) fix: Incomprehensible errors when missing default property #88 fix: Validate the schema to require defaults #254 Add strict parameter for schema parsing:
convict(schema, { strictParsing: true })-> default and format are required, magic coerce is disabled. If they are forgotten, throw an error.4) fix: We can not do
convict(config.getSchema())#356 Fixconvict(config.getSchema()),.getSchema/getSchemaString()should return a convict schema and.getSchema(debug = true)should return convict data schema (for debug usage only).5) Find a way to be able to use
defaultlike config property and not like a convict property. Transform:$~defaulttodefaultduring the schema parsing ? And add opt:convict(schema, { acceptDefaultProperty: 'default' })6) Improve/add doc on parsing behavior:
$~default. P5required:falseanddefault:undefinedandvalue=undefined; Validate the schema to require defaults #254convict(schema, { strictParsing: true/false })and parsing behavior. P3.
7) fix: Improve .defaut() and .reset() errors for users #349 Incomprehensible errors when missing default property #88 Improve error for users : .defaut() and .reset() errors + parents rewrited error.
Breakchange :
format: [ typeof this !== 'object' ]during the parsing.EDIT :
_cvtCoerce,_cvtFormat, and_cvtGetOriginlike reservated word for getter name.formatandrequiredlike reservated word for getter name.