-
Notifications
You must be signed in to change notification settings - Fork 145
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
Improve parsing behavior and default property usage #357
Improve parsing behavior and default property usage #357
Conversation
- Add argument `debug` to `getSchema()`: If true, returns data schema (like it is stored in convict instance).
- .defaut() and .reset() errors - override parent errors
(I will try to finish this one before the end of the month) |
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
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
undefined
prevents format from being checked #278 Addschema.required = true
to 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 defined
should 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
default
like config property and not like a convict property. Transform:$~default
todefault
during the schema parsing ? And add opt:convict(schema, { acceptDefaultProperty: 'default' })
6) Improve/add doc on parsing behavior:
$~default
. P5required:false
anddefault:undefined
andvalue=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_cvtGetOrigin
like reservated word for getter name.format
andrequired
like reservated word for getter name.