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

openapi-java: REST DSL param arrayType with allowableValues can lead to NoSuchMethodException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.21.2, 4.0.2, 4.2.0
    • 4.3.0
    • camel-openapi-java
    • None
    • Unknown

    Description

      There is some logic in the openapi-java component to handle different array types:

      https://github.com/apache/camel/blob/main/components/camel-openapi-java/src/main/java/org/apache/camel/openapi/RestOpenApiReader.java#L498-L534

      If you provide a set of allowable values, then you end up in method convertAndSetItemsEnum:

      https://github.com/apache/camel/blob/main/components/camel-openapi-java/src/main/java/org/apache/camel/openapi/RestOpenApiReader.java#L705

      The problem is that the code attempts to invoke static method valueOf. This will only be present for types that are standard JDK types (Integer, Float, Double etc). For types like ByteArraySchema, BinarySchema etc, no such method exists hence Camel startup will fail with NoSuchMethodException.

      Attachments

        Issue Links

          Activity

            People

              zhfeng Zheng Feng
              jamesnetherton James Netherton
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: