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

Invalid swagger json/yaml generated for Rest DSL

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.22.0
    • 2.23.2, 2.24.0, 3.0.0
    • camel-swagger
    • None
    • Unknown

    Description

      Swagger rests description is generated with invalid responseSchema element. You can see example I found on stackoverflow.

      From camel 2.2 swagger-core was upgraded from 1.5.17 to 1.5.20.

      In Swagger 1.5.19 new ResponseSchemaMixin was added to default object mapper https://github.com/swagger-api/swagger-core/commit/8b97df3667559fca1783da845607afc30e550b83#diff-58c27954db290a19d4fadbfe34b0bbf3

      Camel creates ObjectMapper manually, and does not add this mixin, which results in incorrect json/yaml generated. See https://github.com/apache/camel/blob/camel-2.22.0/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerSupport.java#L216 and line 235

      Fix can be either add ResponseSchemaMixin to manually created objectmappers OR call Json.mapper() and Yaml.mapper() to use swagger logic and don't create mapper manually.

      Attachments

        Activity

          People

            dmvolod Dmitry Volodin
            ssavenko Sergey Savenko
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: