Skip to content

json_name and required field annotations not reflected in generated TypeScript output #36

@hishamank

Description

@hishamank

Describe the bug

When generating TypeScript code using this fork of protoc-gen-grpc-gateway-ts, I’ve noticed two issues:
1. Fields using the json_name option in proto definitions are not reflected in the generated TypeScript output.
2. Fields marked as required using both the -required comment and [(buf.validate.field).required = true]; are still generated as optional in TypeScript.

To reproduce

1. json_name issue

Proto file example:
Image

Generated TypeScript output:
Image

Expected: The field name should match the json_name specified in the proto.

2. Required field issue

Proto file example:
Image

Generated TypeScript output:
Image

Expected: Fields marked as required should be generated as non-optional.

Expected behavior
• TypeScript interfaces should respect the json_name mapping from the proto.
• Fields marked as required should not be marked optional in the output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions