google / google/gnostic

cmd/protoc-gen-openapi: additional_bindings duplicate operationId

Open
#372 14 comments 4 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
2.3k
Forks
279
PR merge metrics
No merged PRs in 30d

Description

It looks like the changes merged in #367 generate duplicate `operationId`'s.

You can see this in the test example:

* https://github.com/google/gnostic/blob/3751138311725a0e9d353b805b2e121c94155d18/cmd/protoc-gen-openapi/examples/tests/additional_bindings/openapi.yaml#L13
* https://github.com/google/gnostic/blob/3751138311725a0e9d353b805b2e121c94155d18/cmd/protoc-gen-openapi/examples/tests/additional_bindings/openapi.yaml#L37

According to the spec these must be unique:

> Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is RECOMMENDED to follow common programming naming conventions.

- [Source](https://github.com/OAI/OpenAPI-Specification/blob/3.0.1/versions/3.0.1.md#operationId)

In addition to the auto-generated `operationId` we'll need to figure out how to resolve it when manually applied:

```protobuf
service TestService {
rpc Test(TestRequest) returns (TestResponse) {
option (google.api.http) = {
get: "/test"
additional_bindings {
get: "/test2"
}
};
option (openapi.v3.operation) = {
operation_id: "test"
};
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.