-
Notifications
You must be signed in to change notification settings - Fork 35
loosen validation to support unrecognized enum values #285
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
Merged
dguo-coursera
merged 12 commits into
coursera:master
from
dplaha-coursera:deep/courier_deserialize_unknown_enum
Apr 21, 2022
Merged
loosen validation to support unrecognized enum values #285
dguo-coursera
merged 12 commits into
coursera:master
from
dplaha-coursera:deep/courier_deserialize_unknown_enum
Apr 21, 2022
Conversation
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
65b3341 to
2cca58b
Compare
|
Kudos, SonarCloud Quality Gate passed!
|
Contributor
Author
|
Tested 0.11.6-alpha5 in infra-services -- verified that deserializing unknown enums no longer throws an exception. |
dplaha-coursera
added a commit
to dplaha-coursera/naptime
that referenced
this pull request
Apr 25, 2022
dguo-coursera
pushed a commit
that referenced
this pull request
May 19, 2022
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.








Duplicate of #283 with two changes:
$UNKNOWNinstead of throwing an exception.Original PR Description
This PR changes the validation logic used by courier to ignore unrecognized enum values instead of returning a JsError.
I copied the 3.1.1 version of ValidateDataAgainstSchema into the naptime repo, re-writing from java to scala. This class has a lot of options, so I removed support for options we're not using.
To begin with, I just changed the invocation from the rest.li version to this version of the class in CourierSerializer. This was the only change required to get the framework to deserialize unknown enums in arrays or records without throwing an exception. There are a few other invocations of ValidateDataAgainstSchema.validate scattered across the naptime repo, but I wanted to limit the blast radius of this PR.