Comments (10)
@timburks I had additional_bindings
in my current API, so when I updated to the latest version it generated a schema which causes validation errors, but at least still renders in Swagger UI.
I haven't really tested it in other tools yet. I'm using OpenAPI as a fallback for users that can't use supported clients, so to support the widest variety of tools I want it to follow the spec.
I'll probably maintain a fork either way for my customizations, so I don't necessarily need this fixed upstream, just wanted to report it in case you considered it a bug/regression.
from gnostic.
@silas, thanks for noting this. I think it's unfortunate that this violates the OpenAPI spec because it seems consistent with the meaning of additional_bindings
to treat additional bindings as the same operation. Did something specifically break for you as a result of this?
from gnostic.
It would certainly break code generators that use the operation ID and are not prepared to handle duplications.
The easiest solution would probably be slapping a counter after the generated name for each additional binding.
In addition to the auto-generated
operationId
we'll need to figure out how to resolve it
when manually applied:
Personally, I wouldn't worry about that much. Manually supplied operationId
makes it a user responsibility.
from gnostic.
Personally, I wouldn't worry about that much. Manually supplied operationId makes it a user responsibility.
@sagikazarmark How the protobuf definitions are currently defined there is no way for the user to fix it. It only allows you to define the operation_id
at the method level:
service TestService {
rpc Test(TestRequest) returns (TestResponse) {
option (google.api.http) = {
get: "/test"
additional_bindings {
get: "/test2"
}
};
option (openapi.v3.operation) = {
operation_id: "test"
};
}
}
The above will create two operations with the same operationId
.
from gnostic.
But it's still because of the additional bindings which is a problem even without the custom operation id, isn't it?
from gnostic.
But it's still because of the additional bindings which is a problem even without the custom operation id, isn't it?
Correct.
from gnostic.
I'd treat it as a separate problem then (ie. see my earlier proposal for adding a counter at the end of the operation id).
I guess you are aiming at allowing the operation id to be set for each additional binding which is probably doable, but can't be the only solution as not setting it can still yield duplications.
from gnostic.
The format of operationId can be changed like this, the first one is set as operationId, and the rest are set as operationId_method_path
from gnostic.
@Adol1111 The operationId
is commonly used as a method name when generating clients from an OpenAPI spec. This is going to break that use-case.
operationId: 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.
from gnostic.
This seems to be an unsolvable problem, unless we don't use additional_bindings, or there could be another field to be used as method name
from gnostic.
Related Issues (20)
- Create a Buf plugin for `protoc-gen-openapi` HOT 8
- Custom Response Code HOT 3
- When the field type is uint, it is invalid when setting the minimum to 0 HOT 1
- protoc-gen-openapi: POST method with empty body generates a required `requestBody` HOT 1
- protoc-gen-openapi output file name problem HOT 1
- Adding Error message to OpenAPI component schema HOT 4
- [protoc-gen-openapi] how can i generate required query parama? HOT 1
- panic: proto: file "openapiv2/OpenAPIv2.proto" has a name conflict over openapi.v2.Xml HOT 1
- botched .pb
- How do I define the proto file to generate custom fields in openai.yaml? HOT 2
- Is there any correlation between "protoc-gen-openapi" and "protoc-gen-openapiv2"? HOT 2
- [proto-gen-openapi] Fields marked as deprecated in the proto should be marked as deprecated in the openapi yaml
- Tag release with #359? HOT 2
- path parameters that refer to request message subfields are not mapped
- Request to remove reference to deprecated module 'github.com/golang/protobuf'
- [proto-gen-openapi] Wrong message included when message with same name exists in imported proto HOT 1
- go get upgrade broke compilation HOT 1
- Import of gnostic-models and gnostic generated code leads to panic HOT 8
- We are unable to detect the CVE-2022-28948 vulnerability through our vulnerability scanning.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gnostic.