Uploaded image for project: 'Kogito'
  1. Kogito
  2. KOGITO-7154

Modify the algorithm that auto-generates the open api specification for DMN models

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • None
    • 1.20.0.Final
    • DMN Engine
    • None
    • 2022 Week 20-22 (from May 16), 2022 Week 23-25 (from Jun 6)

       

      Could be possibile to modify the algorithm that auto-generates the openapi specification for the RestController classes corrisponding to the DMN models

      There would be 2 goals :

      • The first is to find a way to uses fixed names for methods and parameters, and prevent that the creation of a new dmn model will change the operationId (i think operationID is not even mandatory on openapi spec) and the schema for input and output of the previous and non modified DMN.  For example if there is a ValidateDoc DMN with the following openapi autogenerated specification:

       

       /ValidateDoc:
          get:
            tags:
            - validate-doc-resource
            operationId: dmn_1
            responses:
              "200":
                description: OK
                content:
                  application/xml:
                    schema:
                      type: string
          post:
            tags:
            - validate-doc-resource
            operationId: dmn_2
            requestBody:
              description: DMN input
              content:
                application/json:
                  schema:
                    $ref: /dmnDefinitions.json#/definitions/InputSet1
            responses:
              default:
                description: DMN output
                content:
                  application/json:
                    schema:
                      $ref: /dmnDefinitions.json#/definitions/OutputSet1
        

      If another DMN is created, when re-generating the client the specification of the original DMN will be changed (InputSet1 could be changed to InputSet2, and so on), this could be a problem if codegen plugin if used to auto-generate the client for invoking the DMN (because will change class and methods names) .

       

       

      • The seconds goal will be to avoid the use of underscore for preventing schema duplication.  When using underscore as prefix on the models or schemas in openapi spec (for example @io.swagger.v3.oas.annotations.media.Schema(ref = "/dmnDefinitions.json#/definitions/__InputSetDS114")) to prevent to override another model (for example @io.swagger.v3.oas.annotations.media.Schema(ref = "/dmnDefinitions.json#/definitions/InputSetDS114")) this will will generates a conflict if java codegen openapi plugin is used to auto generate the client for invoke dmn models.  The reason is that openapi-generator-maven-plugin (for java) try creates classes in camel case format, this creates  a conflincts because it will be two classes with the same name (InputSetDS114)

       

      The conversation regarding this argument: https://groups.google.com/g/kogito-development/c/fSeWJzz2LNo

       

       

       

              mmortari@redhat.com Matteo Mortari
              francisco.boato francisco boato (Inactive)
              Daniel Rosa Daniel Rosa
              Daniel Rosa Daniel Rosa
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: