Skip to content

Allow optional repeated #21832

Open
Open
@gQuezM

Description

@gQuezM

What language does this apply to?
TypeScript, GRPC client transformed to HTTP server

Describe the problem you are trying to solve.
GRPC doesn't allow optional repeated. This feature is important because an empty array is not the same as undefined or null in terms of data. Many adapter libraries that translate a GRPC client to an HTTP server generate the request and response types according to the proto definition. Most of them translate a repeated newField to type newField: Array. Imagine you have to add a new repeated field to one of your API's, as optional repeated field is not allowed then the type wouldn't have an optional operator in the type (like this: newField?: Array<Type>) this would generate a breaking change for the current implementation.

Describe the solution you'd like
allow optional repeated

Describe alternatives you've considered
Sending an empty array is not an option, as the message couldn't have multiple implementations

Additional context
Many type errors were thrown after the proto was updated by adding a new repeated field

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions