Skip to content

Ignore unknown JSON fields when decoding requests.#60

Merged
marioizquierdo merged 2 commits intoarthurnn:masterfrom
alusco-scratch:settableencoding
Nov 5, 2020
Merged

Ignore unknown JSON fields when decoding requests.#60
marioizquierdo merged 2 commits intoarthurnn:masterfrom
alusco-scratch:settableencoding

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