Forum Discussion

Tarun515's avatar
Tarun515
New Contributor
2 years ago

Swagger UI - Request Object is not shown correctly

Endpoint: 

/sftp/sftpput:
post:
description: put - save file to server
tags:
- SFTP Operations
operationId: sftpput
x-queue: sftp.operation.putFile
x-queuePath: product
x-async: false
parameters:
- $ref: "#/components/parameters/Product"
- $ref: "#/components/parameters/Path"
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SftpPutRequest'

components:
schemas:
SftpPutRequest:
type: object
properties:
payload:
description: base64 encoded file
type: string
format: byte
size:
type: integer
description: size of file

 

I was expecting Request with properties payload and size will be visible in the Swagger UI but it is not showing it.

Could you please check and let me know if I am doing something wrong?

 

4 Replies

  • chichepo's avatar
    chichepo
    Champion Level 3

    Hi Tarun515 

     

    I tried your definition (I guess you are on OpenAPI 3) and I get the both properties displayed:
    (Note that I had to "neutralize" the parameters clause)

    Let us know

    • Tarun515's avatar
      Tarun515
      New Contributor

      /sftp/sftpput:
      post:
      description: put - save file to server
      tags:
      - SFTP Operations
      operationId: sftpput
      x-queue: sftp.operation.putFile
      x-queuePath: product
      x-async: false
      parameters:
      - $ref: "#/components/parameters/Product"
      - $ref: "#/components/parameters/Path"
      requestBody:
      required: true
      content:
      application/json:
      schema:
      $ref: '#/components/schemas/SftpPutRequest'

      components:
      schemas:
      SftpPutRequest:
      type: object
      properties:
      payload:
      description: base64 encoded file
      type: string
      format: byte
      size:
      type: integer
      description: size of file

      parameters:
      Product:
      name: product
      description: product name
      in: path
      required: true
      schema:
      type: string
      Path:
      name: path
      in: query
      required: true
      schema:
      type: string

       

      Sorry, parameters are also defined in the yml file.

      • Tarun515's avatar
        Tarun515
        New Contributor

        Also, we are using below swagger dependencies in our project:

        io.swagger:swagger-annotations:1.6.6

        io.swagger.core.v3:swagger-annotations:2.2.0

        org.springdoc:springdoc-openapi-ui:1.6.9