Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-17457

camel-openapi-java - Incorrect tags in openapi

    XMLWordPrintableJSON

Details

    • Unknown

    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:

      "/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"
        }
      }

      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:

      // 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);

      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!

      Attachments

        Issue Links

          Activity

            People

              klease78 Karen Lease
              ncasaux ncasaux
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: