liuxiran edited a comment on pull request #1245:
URL: https://github.com/apache/apisix-dashboard/pull/1245#issuecomment-766587292
> @liuxiran @nic-chen
> The unit test and test cases have been supplemented. In the process of
testing, I found a problem:
>
> * At present, the path data structure of OpenAPI 3 is used to store URIs,
and the data structure is map [string]. If the URI is repeated, the data will
be covered, if the repeated URIs are directly covered, only one URI can be
exported, which will lead to the loss of user data.
> * My idea is to add a uniform suffix after the same URI when exporting, so
that the import can recognize the URI
> For example:
>
> ```
> {
> "components": {},
> "info": {
> "title": "RoutesExport",
> "version": "3.0.0"
> },
> "openapi": "3.0.0",
> "paths": {
> "/hello": {
> "get": {}
> }
> "/hello-repeaturi1": {
> "get": {}
> }
> "/hello-repeaturi2": {
> "get": {}
> }
> }
> }
> ```
>
> * My method also has the risk of repeating the user named URI
> * Do you have any better suggestions? We can discuss them. Thks.
>OpenAPI defines a unique operation as a combination of a path and an HTTP
method. This means that two GET or two POST methods for the same path are not
allowed – even if they have different parameters (parameters have no effect on
uniqueness)
refer from https://swagger.io/docs/specification/paths-and-operations/
After communicating with @Jaycean and @nic-chen there are three alternative
solutions:
- A: add a uniform suffix after the same URI when exporting, and add a
description to the user guide.
This solution can meet the platform-wide data is not lost, the disadvantage
is that when users need to use the swagger file to generate documents or sdk,
they need to modified manually.
- B: return error when exporting routes with same URI
In this way exported OAS3.0 file can be used directly, with the
disadvantage that there may be data loss for APISIX. The remedy is that we
provide additional import and export of platform-wide data, in accordance with
the apisix data format.
Neither scheme is perfect though, which one do you perfer? any suggestions
are welcome, thanks a lot
@Jaycean @nic-chen @membphis @starsz @juzhiyuan @imjoey
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]