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

Ignore unknown JSON fields when decoding requests. #60

Merged
merged 2 commits into from
Nov 5, 2020

Conversation

alusco-scratch
Copy link
Contributor

In version 3.7 of protobufs the option to ignore unknown JSON fields was
added. Setting this flag to true makes it so JSON encoded requests can be
mostly backwards compatible just like existing protobuf encoding.

This fixes #59.

In version 3.7 of protobufs the option to ignore unknown JSON fields was
added.  Setting this flag to true makes it so JSON encoded requests can be
mostly backwards compatible just like existing protobuf encoding.
Copy link
Collaborator

@marioizquierdo marioizquierdo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

It would be great to be able to ignore unknown fields for client requests, but fail for curl requests, because that helps with debugging, which is what JSON encoding is mainly trying to help with. But doing so would require more work and updating the protocol which is probably not worth it. This looks good, thanks!

@marioizquierdo marioizquierdo merged commit 95effbc into arthurnn:master Nov 5, 2020
@alusco-scratch
Copy link
Contributor Author

Ya if we did want to do that, we could add a JSON_STRICT and did the content type thing I was talking about of 'application/json; strict=true'

@alusco-scratch
Copy link
Contributor Author

I sent a PR for this #61 @marioizquierdo We can decide not to do it just wanted to throw it out there. I kind of like it to be honest.

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.

Twirp Ruby doesn't ignore unknown JSON Fields
2 participants