You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "ncasaux (Jira)" <ji...@apache.org> on 2022/01/09 14:26:00 UTC

[jira] [Updated] (CAMEL-17457) Incorrect tags in openapi

     [ https://issues.apache.org/jira/browse/CAMEL-17457?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

ncasaux updated CAMEL-17457:
----------------------------
    Description: 
Hello,

I'm using provided example: Spring Boot Example with Camel REST DSL and OpenApi ([https://github.com/apache/camel-spring-boot-examples/tree/main/rest-openapi-springdoc)]

I noticed that the generated tags are incorrect and contains some duplicate values, for example:
{code:java}
"/api/users" : {
  "get" : {
    "tags" : [ "/api/users/users" ],
    "responses" : {
      "200" : {
        "content" : {
          "application/json" : {
            "schema" : {
              "type" : "array",
              "items" : {
                "$ref" : "#/components/schemas/User"
              }
            }
          }
        },
        "description" : "All users successfully returned"
      }
    },
    "operationId" : "verb1",
    "summary" : "Find all users"
  }
}{code}
Note the value "{{{}/api/users/users"{}}}

I tried to investigate in the source code of the component, and I found this line of code in class RestOpenApiReader:
{code:java}
// we need to group the operations within the same tag, so use the path as default if not configured
String opPath = OpenApiHelper.buildUrl(buildBasePath(camelContext, rest), getValue(camelContext, rest.getPath()));
String pathAsTag = getValue(camelContext, rest.getTag() != null ? rest.getTag() : opPath);{code}
I don't really understand the purpose of the opPath value, which contains the concatenation of "/api/users" and "/users"/. I guess it should be "/api/users" ?

It explains however why the pathAsTag value is consequently incorrect.

Hope it helps!

  was:
Hello,

I'm using provided example: Spring Boot Example with Camel REST DSL and OpenApi ([https://github.com/apache/camel-spring-boot-examples/tree/main/rest-openapi-springdoc)]

I noticed that the generated tags are incorrect and contains some duplicate values, for example:
{code:java}
"/api/users" : {
  "get" : {
    "tags" : [ "/api/users/users" ],
    "responses" : {
      "200" : {
        "content" : {
          "application/json" : {
            "schema" : {
              "type" : "array",
              "items" : {
                "$ref" : "#/components/schemas/User"
              }
            }
          }
        },
        "description" : "All users successfully returned"
      }
    },
    "operationId" : "verb1",
    "summary" : "Find all users"
  }
}{code}
Note the value "{{{}/api/users/users"{}}}

I tried to investigate in the source code of the component, and I found this line of code in class RestOpenApiReader:
{code:java}
// we need to group the operations within the same tag, so use the path as default if not configured
String opPath = OpenApiHelper.buildUrl(buildBasePath(camelContext, rest), getValue(camelContext, rest.getPath()));
String pathAsTag = getValue(camelContext, rest.getTag() != null ? rest.getTag() : opPath);{code}
I don't really understand the purpose of the opPath value, which contains the concatenation of "/api/users" and "/users"/. I guess it should be "/api/users".

It explains however why the pathAsTag value is consequently incorrect.

Hope it helps!


> Incorrect tags in openapi
> -------------------------
>
>                 Key: CAMEL-17457
>                 URL: https://issues.apache.org/jira/browse/CAMEL-17457
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-openapi-java
>    Affects Versions: 3.14.0, 3.15.0
>            Reporter: ncasaux
>            Priority: Minor
>
> Hello,
> I'm using provided example: Spring Boot Example with Camel REST DSL and OpenApi ([https://github.com/apache/camel-spring-boot-examples/tree/main/rest-openapi-springdoc)]
> I noticed that the generated tags are incorrect and contains some duplicate values, for example:
> {code:java}
> "/api/users" : {
>   "get" : {
>     "tags" : [ "/api/users/users" ],
>     "responses" : {
>       "200" : {
>         "content" : {
>           "application/json" : {
>             "schema" : {
>               "type" : "array",
>               "items" : {
>                 "$ref" : "#/components/schemas/User"
>               }
>             }
>           }
>         },
>         "description" : "All users successfully returned"
>       }
>     },
>     "operationId" : "verb1",
>     "summary" : "Find all users"
>   }
> }{code}
> Note the value "{{{}/api/users/users"{}}}
> I tried to investigate in the source code of the component, and I found this line of code in class RestOpenApiReader:
> {code:java}
> // we need to group the operations within the same tag, so use the path as default if not configured
> String opPath = OpenApiHelper.buildUrl(buildBasePath(camelContext, rest), getValue(camelContext, rest.getPath()));
> String pathAsTag = getValue(camelContext, rest.getTag() != null ? rest.getTag() : opPath);{code}
> I don't really understand the purpose of the opPath value, which contains the concatenation of "/api/users" and "/users"/. I guess it should be "/api/users" ?
> It explains however why the pathAsTag value is consequently incorrect.
> Hope it helps!



--
This message was sent by Atlassian Jira
(v8.20.1#820001)