Skip to content
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

loosen validation to support unrecognized enum values #283

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

zdrudi
Copy link
Contributor

@zdrudi zdrudi commented Oct 8, 2021

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.

@dguo-coursera dguo-coursera self-requested a review October 8, 2021 19:33
@zdrudi zdrudi marked this pull request as ready for review October 26, 2021 19:16
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

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.

3 participants