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

Workflowdata input schema name should be different in the generated OpenAPI

XMLWordPrintable

    • False
    • None
    • False
    • Added workflow ID as a prefix for OpenAPI input schemas
    • ---
    • ---
    • 2022 Week 32-34 (from Aug 8), 2022 Week 38-40 (from Sept 19), 2022 Week 41-43 (from Oct 10)

      When a workflow definition has a dataInputSchema attribute defined, the resulting OpenAPI generated by the quarkus workflow application will include a schema reference to the workflow input like this one:

      components: 
        schemas: 
          workflowdata: 
            required: 
            - SSN
            - term
            - amount
            type: object
            properties: 
              amount: 
                type: integer
              term: 
                type: integer
              SSN: 
                pattern: "^\\d{3}-\\d{2}-\\d{4}$"
                type: string
      

      The problem is that if we have more than one workflow definition in the same project, the resulting OpenAPI file will fail since the schema name (workflowdata) is the same.

      This name should have a prefix associated with the ModelInput. For example, in this case we have:

      LoanbrokerModelInput: 
            type: object
            properties: 
              workflowdata: 
                allOf: 
                - $ref: '#/components/schemas/JsonNode'
                - $ref: '#/components/schemas/workflowdata'
      

      The property has the correct naming, but the schema should be loanbroker_workflowdata (loanbroker is the workflow ID). This way, it won't conflict with another input schema in the same project.

      One more thing, the "JsonNode" schema shouldn't be referenced in the model schema if the file has a dataInputSchema.

            hbelmiro@redhat.com Helber Belmiro
            rhn-support-zanini Ricardo Zanini
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: