OAS3 - Request Body's inner object content type

165 Views Asked by At

Is it possible to have content type for a request body's inner object in OAS3 and get it displayed in the swagger UI's generated curl command when invoking the call? Is this a supported feature in OAS3? An example is given below. Reporter is the inner object.

paths:
  "/incidents/{incidentId}/type/file":
    post:
      summary: Add an image
      description: "Image"
      parameters:
        - name: incidentId
          in: path
          description: Incident ID
          required: true
          schema:
            type: string
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - file
              properties:
                file:
                  type: string
                  description: File to upload
                  format: binary
                type:
                  type: string
                  description: Type
                teamId:
                  type: string
                  description: Team ID
                incidentCreation:
                  type: string
                  description: "Test"
                professionalId:
                  type: string
                  description: Professional ID
                reporter:
                  type: object
                  properties:
                    name:
                      type: string
                    actingAs:
                      type: string
                    contact:
                      type: object
                      properties:
                        emailAddress:
                          type: string
                        phoneNumber:
                          type: string
                        language:
                          type: object
                          properties:
                            user:
                              type: string
                            address:
                              type: string
            encoding:
              file:
                contentType: application/octet-stream
              reporter:
                contentType: application/json
        required: true
      responses:
        "200":
          description: ""
          content: {}
      x-auth-type: "Application & Application User"
      x-throttling-tier: Unlimited
      x-codegen-request-body-name: Payload

The following is the curl command generated in the wso2am-2.2.0 store portal.

curl -k -X POST "https://192.168.8.101:8243/api/1.1.0/incidents/1232387912/type/file" -H "accept: */*" -H "Content-Type: multipart/form-data" -H "Authorization: Bearer 5eb36aea-1ed3-3a90-b578-356e89c79c99" -d {"type":"","teamId":"","incidentCreation":"","professionalId":"","reporter":"{ \"name\": \"string\", \"actingAs\": \"string\", \"contact\": { \"emailAddress\": \"string\", \"phoneNumber\": \"string\", \"language\": { \"user\": \"string\", \"address\": \"string\" } }}","file":{}}
0

There are 0 best solutions below