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

NPE when using reference to parameter in openapi-rest-dsl-generator

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.1.0
    • Fix Version/s: 3.2.0
    • Component/s: tooling
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      When using reference parameters with openapi-rest-dsl-generator, such as in this example:

      {
          "openapi": "3.0.2",
          "info": {
              "title": "Test API",
              "version": "1.0.0",
              "description": "A brand new API with no content.  Go nuts!"
          },
          "paths": {
              "/test/{myparam}": {
                  "get": {
                      "parameters": [
                          {
                              "$ref": "#/components/parameters/MyParam"
                          }
                      ],
                      "responses": {
                          "200": {
                              "description": "response"
                          }
                      },
                      "operationId": "op"
                  }
              }
          },
          "components": {
              "parameters": {
                  "MyParam": {
                      "name": "myparam",
                      "in": "path",
                      "required": true
                  }
              }
          }
      }
      

      NullPointerException is raised:

      Caused by: java.lang.NullPointerException
          at org.apache.camel.generator.openapi.OperationVisitor.emit (OperationVisitor.java:77)
          at org.apache.camel.generator.openapi.OperationVisitor.lambda$visit$1 (OperationVisitor.java:194)
          at java.util.ArrayList.forEach (ArrayList.java:1257)
          at org.apache.camel.generator.openapi.OperationVisitor.visit (OperationVisitor.java:193)
          at java.util.LinkedHashMap.forEach (LinkedHashMap.java:684)
          at org.apache.camel.generator.openapi.PathVisitor.visit (PathVisitor.java:57)
          at java.util.ArrayList.forEach (ArrayList.java:1257)
          at org.apache.camel.generator.openapi.RestDslXmlGenerator.generate (RestDslXmlGenerator.java:59)
          at org.apache.camel.maven.generator.openapi.GenerateXmlMojo.execute (GenerateXmlMojo.java:116)
      

        Attachments

          Activity

            People

            • Assignee:
              zregvart Zoran Regvart
              Reporter:
              zregvart Zoran Regvart
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: