Proposal: allow undeclared properties by default, but optionally disallow them · Issue #3 · tylerchr/jstn · GitHub
More Web Proxy on the site http://driver.im/
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a two-part proposal to change the spec for JSTN validators.
Part 1 of the proposal
...is to allow JSON documents with additional undeclared properties to be considered valid by default, so long as all declared properties are valid according to the other validator conditions.
Essentially, this proposal is to remove condition #3 from the spec under the Validators section:
No object properties exist in the JSON document that are not declared in the JSTN type declaration
The justification for the proposed change is to make life easier for APIs described by JSTN declaration when evolving over time. If JSTN validators were to allow undeclared properties to exist in the JSON document, then the transition path for an API that wants to add a property to its data becomes possible, without simultaneously updating all clients.
Part 2 of the proposal
... is to add a "Strict Mode" to the validator spec, which preserves the old (current) behavior.
The idea would be that validators would use the behavior described in part 1 of this proposal as their default implementation... but optionally also implement a "strict mode" validator, which disallows the presence of undeclared properties.
Check out my pull request #1 to see an example of this in action, as well as some proposed verbiage for the SPEC.md file to describe this.
The text was updated successfully, but these errors were encountered:
This is a two-part proposal to change the spec for JSTN validators.
Part 1 of the proposal
...is to allow JSON documents with additional undeclared properties to be considered valid by default, so long as all declared properties are valid according to the other validator conditions.
Essentially, this proposal is to remove condition #3 from the spec under the Validators section:
The justification for the proposed change is to make life easier for APIs described by JSTN declaration when evolving over time. If JSTN validators were to allow undeclared properties to exist in the JSON document, then the transition path for an API that wants to add a property to its data becomes possible, without simultaneously updating all clients.
Part 2 of the proposal
... is to add a "Strict Mode" to the validator spec, which preserves the old (current) behavior.
The idea would be that validators would use the behavior described in part 1 of this proposal as their default implementation... but optionally also implement a "strict mode" validator, which disallows the presence of undeclared properties.
Check out my pull request #1 to see an example of this in action, as well as some proposed verbiage for the
SPEC.md
file to describe this.The text was updated successfully, but these errors were encountered: