ncasaux created CAMEL-17457:
-------------------------------

             Summary: 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


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)

Reply via email to