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

JSON transcoding has backwards incompatible change in 1.27.0, due to json_name field always populated by protoc #5890

Open
C0mbatwombat opened this issue Sep 4, 2024 · 3 comments

Comments

@C0mbatwombat
Copy link

C0mbatwombat commented Sep 4, 2024

Hi,

In #5193 functionality was added so that if a user sets the json_name field in the .proto file explicitly, it is used to resolve the path & query params when doing transcoding. This makes perfect sense, if it weren't for a bug in protoc: the proto compiler always populates the json_name field since 3.1.0.

This means that to retain our existing behaviour (using the original field which might contain underscores) we have to add json_name = <field_name> to all our proto definitions.

The Protobuf code base also acknowledges it as a bug and has a workaround to deal with it.

I suppose Armeria needs to use the same workaround as the protobuf codebase: if the json_name that is set is the same as the default calculated one, assume it was not set explicitly by the user.

Thanks!

@mbgit2
Copy link

mbgit2 commented Oct 16, 2024

Any update on this? I'm currently stuck on 1.26.4 due to this.

@ikhoon
Copy link
Contributor

ikhoon commented Oct 16, 2024

I suppose Armeria needs to use the same workaround as the protobuf codebase: if the json_name that is set is the same as the default calculated one, assume it was not set explicitly by the user.

It makes sense. We may provide a new option to ignore json_name. Let us handle it in the next version.

@ikhoon ikhoon added the defect label Oct 16, 2024
@ikhoon ikhoon added this to the 1.31.0 milestone Oct 16, 2024
@ikhoon
Copy link
Contributor

ikhoon commented Oct 17, 2024

I've compiled a proto file with protoc 3.25.1 and json_name was empty if it is not set.

protobuf = "3.25.1"

image
Was that bug fixed in recent versions or am I missing something to reproduce the problem?

@ikhoon ikhoon removed this from the 1.31.0 milestone Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants