Skip to content

Conversation

kkalass
Copy link

@kkalass kkalass commented Nov 27, 2017

An often-used pattern in conjunction with oneOf is to use a single value
enum as a constant where each oneOf alternative typically has a different
constant.

If the corresponding property is set in the json node (and thus is
textual) we can skip all alternatives that have a different constant
value defined for that property since they will definitely not match.

For schemas with many alternatives and a lot of items that need to run
through those alternatives, I found this to speedup validation
considerably (30% faster in my case).

Please note that this commit contains the semantics from PR "unresolved-refs-are-errors" as well - if you object to that one, I can adjust this PR.

Klas Kalaß and others added 3 commits November 27, 2017 10:46
An often-used pattern in conjunction with oneOf is to use a single value
enum as a constant where each oneOf alternative typically has a different
constant.

If the corresponding property is set in the json node (and thus is
textual) we can skip all alternatives that have a different constant
value defined for that property since they will definitely not match.

For schemas with many alternatives and a lot of items that need to run
through those alternatives, I found this to speedup validation
considerably (30% faster in my case).
@stevehu stevehu merged commit bdfb117 into networknt:master Dec 10, 2017
@stevehu
Copy link
Contributor

stevehu commented Dec 10, 2017

@kkalass Thanks a lot for your help. The update is pretty significant and I have to review it multiple times to ensure no API is broken. Also, the last several weeks were crazy for me with other projects. I will do some future tests and release it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants