Skip to content

Supporting duplicate models (different packages) in protoc-gen-openapi #309

@SoftMemes

Description

@SoftMemes

I have a setup where the same model name is used in different packages (or different versions of the same package). In my protos, these are in separate directories (/foo/v1/bar.proto and /foo/v2/bar.proto, both declaring Bar).

The openapi (v2) generator from grpc-gateway handles this by including the version or if needed full package name in the generated model types, whereas with gnostic, I get duplicate types and errors in later tooling using the openapi spec.

What I would ideally want is to get the same style output in JavaScript based on the openapi spec as I do with other tooling directly using the grpc/proto definitions, with models keeping their names but packaged up in directories matching the proto package / directory structure, though I'm not sure if there's a way of representing this in openapi.

Is there a way of either getting the gnostic protoc-gen-openapi tool to work with this sort of setup, or alternatively, best practices for grpc/proto that means that this would not be a problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions