refactor: json-schema feature#3110
Closed
AbdelrahmanHafez wants to merge 39 commits into
Closed
Conversation
…ies, and preferences re hapijs#3108
…d preferences
- Fix alternatives.match('all') producing anyOf instead of allOf
- Skip rule jsonSchema handlers when args contain Refs
- Handle _invalids as not: { enum: [...] }
- Exclude forbidden keys and stripped keys (output mode) from properties
- Add all object dependency handlers (with, without, and, nand, or, xor, oxor)
- Add string.alphanum pattern and string.domain pattern with options
- Add number.precision as multipleOf
- Add date.timestamp with ECMA-262 range limits
- Register id'd child schemas in $defs for Joi.link() without .shared()
- Respect preferences: allowUnknown, stripUnknown, presence, noDefaults
re hapijs#3108
…tripUnknown edge case re hapijs#3108
…own object check re hapijs#3108
…ng, and domain TLD handling re hapijs#3108
Author
|
Closing this stacked refactor PR because the commits are now folded into #3109. |
Author
|
Merged into #3109 to avoid complicating this further. |
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.
Context: stacked on top of #3109
This PR is a cleanup refactor of the Standard JSON Schema implementation. It is not meant to change behavior, the goal is to move the JSON Schema-specific code out of the core Joi files and make the feature easier to follow and maintain.
This PR:
$_jsonSchema()conversion pipeline fromlib/base.jsintolib/json-schema/base.jslib/json-schema/when()hoisting logic out oflib/types/keys.jsintolib/json-schema/object.jsalternatives()andbinary()intolib/json-schema/alternatives.jsandlib/json-schema/binary.jsI left the JSON Schema test requirements unchanged for this refactor and ran the full suite after the move, so this should be behavior-preserving.