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

OpenApi Specification Generator - Support multiple tags for an operation

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.14.2
    • 3.17.0
    • camel-openapi-java
    • None
    • Unknown

    Description

      Hi

       

      The OpenAPI specification supports multiple tags per operation allowing applications to use the tags for custom purposes. Camel only supports 1 tag per operation.

      https://swagger.io/docs/specification/grouping-operations-with-tags/

       

      Add support for , delimited values in the setTag() method.

       

      The generator can will utilise this metadata with , delimiters to set multiple tags on the Oas object to represent multiple tags in the schema generated.

       

      The following OpenApi metadata 

                      rest("/tag")
                          .get("single")
                          .tag("Organisation")
                          .consumes("application/json")
                          .produces("application/json")
                          .to("log:bye")
                      ;
      
                      rest("/tag")
                          .get("multiple/a")
                          .tag("Organisation,Group A")
                          .consumes("application/json")
                          .produces("application/json")
                          .to("log:bye")
                      ;
      
                      rest("/tag")
                          .get("multiple/b")
                          .tag("Organisation,Group B")
                          .consumes("application/json")
                          .produces("application/json")
                          .to("log:bye")
                      ; 

      Will produce the following OpenAPI specification

      ...
          "/tag/single" : {
            "get" : {
              "consumes" : [ "application/json" ],
              "produces" : [ "application/json" ],
              "tags" : [ "Organisation" ],
      ...
          "/tag/multiple/a" : {
            "get" : {
              "consumes" : [ "application/json" ],
              "produces" : [ "application/json" ],
              "tags" : [ "Organisation", "Group A" ],
      ...
          "/tag/multiple/b" : {
            "get" : {
              "consumes" : [ "application/json" ],
              "produces" : [ "application/json" ],
              "tags" : [ "Organisation", "Group B" ],
      ...
        "tags" : [ {
          "name" : "Group B"
        }, {
          "name" : "Organisation"
        }, {
          "name" : "Group A"
        }, {
          "name" : "/hello"
        } ]
      ....

       

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              johnathani Johnathan Ingram
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: