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

BUG: Field containing number are are inconsistent with proto JSON Mapping done by gateway #52

Open
zoido opened this issue May 12, 2023 · 1 comment

Comments

@zoido
Copy link

zoido commented May 12, 2023

When the message filed contains number it's name in the generated typescript is not consistent with the JSON Mapping done by the grpc-gateway runtime. See example below.

Example input message:

syntax = "proto3";

package example.v1;

message Example { string k8s_field = 1; }

Result:

/* eslint-disable */
// @ts-nocheck
/*
* This file is a generated Typescript file for GRPC Gateway, DO NOT MODIFY
*/
export type Example = {
  k8SField?: string
}

Expected result

export type Example = {
  k8sField?: string
}

Generator uses fieldName function that effectively uses strcase.ToLoweCamel that also uppers the case of characters after any number.

@zoido
Copy link
Author

zoido commented May 12, 2023

IMHO this the generated code incompatible with the grpc-gateway back-ends as the ts field names are used for JSON parsing if I am reading the code well.

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

No branches or pull requests

1 participant