Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-22175

Camel-openapi-java RestModelConverters.processSchema() ignores Swagger @Schema annotations

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • fuse-7.13-GA
    • fuse-7.12-GA
    • Camel
    • None
    • False
    • None
    • False
    • % %
    • Todo
    • Hide

      i) Install Fuse 7.11 on EAP 7.4.

      ii) Build the project WAR (mvn clean package) and deploy to EAP.

      iii) Attach debugger and set breakpoint on RestModelConverters.processSchema(OasSchema model, Schema schema)

      iv) Notice the properties annotations are not converted to OasSchema during the function:

      schema.getProperties().forEach((p, v) ->

      {...}
      Show
      i) Install Fuse 7.11 on EAP 7.4. ii) Build the project WAR (mvn clean package) and deploy to EAP. iii) Attach debugger and set breakpoint on RestModelConverters.processSchema(OasSchema model, Schema schema) iv) Notice the properties annotations are not converted to OasSchema during the function: schema.getProperties().forEach((p, v) -> {...}
    • Very Likely

    Description

      org.apache.camel.openapi.RestModelConverters.processSchema(OasSchema, Schema) is the method which converts from swagger schema to OpenAPI schema and also this is where data is lost.

      io.swagger.v3.oas.annotations.media.Schema has all annotations metadata including "maxLength", "example", "description", "title". However when converted to OpenApi Schema (OasSchema) this information is ignored.

      I notice that the when the properties (e.g. streamId) from the Request class are being converted to OasSchema in the RestModelConverters class, the attributes in the @Schema annotation are dropped off.

      It seems the defect is missed conversions of the attributes after line 131:

      OasSchema property = model.createPropertySchema((String) p);

      Where the OasSchema property instance should additionally set the attributes coming from the io.swagger.v3.oas.models.media.Schema annotation's attributes.

      Endpoint testable at 'curl http://localhost:8080/rest/api-docs'.

      Attachments

        Activity

          People

            rnetuka@redhat.com Radovan Netuka
            rdorobek@redhat.com Russell Dorobek
            Branislav Smolicek Branislav Smolicek
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: