Skip to content

Conversation

@jhump
Copy link
Member

@jhump jhump commented May 29, 2024

This should make it easier to troubleshoot issues caused by accidentally using a non-conformant JSON format. For example, it turns out that Dart's default JSON format is not the format defined by the proto3 mapping spec but some bespoke format that uses tag numbers instead of names.

Previously, a server or client would accept such messages and just ignore unrecognized fields (which could be all of them). This could result in hard-to-troubleshoot errors, since the server would behave like it got a partial or empty request message.

This will cause the codec to complain about the unrecognized field name, which should produce more intuitive errors.

We do similar for the Protobuf binary format, too, disallowing unrecognized fields in the data.

@jhump jhump requested a review from smaye81 May 29, 2024 20:24
@jhump jhump force-pushed the jh/strict-json-format branch from 51308ae to 1164264 Compare May 29, 2024 20:25
@jhump
Copy link
Member Author

jhump commented May 29, 2024

@smaye81, I realized that it would likely be advantageous to do the same for the protobuf codec. Please take another look at the last commits.

@jhump jhump changed the title Use strict JSON codec in reference client and server Use strict codecs in reference client and server May 29, 2024
@jhump jhump merged commit 392a61d into main May 30, 2024
@jhump jhump deleted the jh/strict-json-format branch May 30, 2024 14:25
@jhump jhump mentioned this pull request Aug 13, 2024
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