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

swagger - Model schema not including nested objects

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.16.0
    • 2.16.1, 2.17.0
    • camel-swagger
    • None
    • Unknown

    Description

      This issue relates to the new camel-swagger-java component and not the camel-swagger component. JIRA is not yet updated for the new camel-swagger-java component.

      When there are nested objects in the Api model for swagger, they are not being represented correctly in the model schema. See below for an example:

      SomeRequest.java
      @ApiModel
      public class SomeRequest {
          @ApiModelProperty
          private List<SomeObject> someObjects;
          ...
      }
      
      SomeObject.java
      @ApiModel
      public class SomeObject {
          @ApiModelProperty
          private String somePropertyOne;
          @ApiModelProperty
          private String somePropertyTwo;
          ...
      }
      

      Should have a model in swagger of:

      { 
        "someObjects": [ 
          { 
            "somePropertyOne": "", 
            "somePropertyTwo": "" 
          } 
        ] 
      }
      

      But instead has:

      { 
        "someObjects": [ 
          "SomeObject" 
        ] 
      }
      

      This model is invalid and makes the swagger documentation useless as no one knows what the request model is supposed to be.

      Note: this worked correctly on camel 2.15.3 with the scala based camel-swagger component.

      Attachments

        Activity

          People

            davsclaus Claus Ibsen
            wheadonj Jason Wheadon
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: