问题
Swagger requires that the operationId value be unique for each endpoint.
However, if I have an endpoint that is shared by both default (http://localhost/endpoint_name) and the versioned endpoint (http://localhost/v1/endpoint_name), then how do I handle the swaggger for this?
If I set the operationId to any value, then it will get replicated for both the endpoints and it gives me an error due to reuse of the same operationId.
回答1:
OpenAPI V3 allows you to specify multiple URLs.
e.g.
openapi: 3.0.3
info:
title: TestAPI
version: 1.0.0
servers:
- url: 'http://localhost/endpoint_name'
- url: 'http://localhost/v1/endpoint_name'
paths: {}
来源:https://stackoverflow.com/questions/59675490/what-is-the-way-to-handle-swagger-operationid-value-for-default-and-versioned-en