1

I have recently started learning Swagger for APi documentation. However, when I go to localhost:5000/apidocs, I see APIs that I added but all APIs are with no parameters even when I have described parameters in my yml file. I couldn't find anything relevant on the internet.

Here is my YML code:

paths:
  /api/ppp:
    get:
      tags:
      - "user"
      summary: "Find User by uID"
      description: "Returns a single user info"
      operationId: "getuserById"
      produces:
        - "application/xml"
        - "application/json"
      parameters:
        - name: "userId"
          in: "path"
          description: "ID of user to return"
          required: true
          type: "uuid"

and here is how I am adding swagger to the api @swag_from('pathto/swagger.yml')

Similarly, I have another doubt. We define schema in the yml specification file. I want to know what exactly those schema represent and is it necessary to use them?

Attached is a screenshot of the APIdocs page enter image description here

1 Answers1

-1

try this:

tags:
- user
summary: "Find User by uID"
description: "Returns a single user info"
operationId: "getuserById"
produces:
  - "application/xml"
  - "application/json"
parameters:
  - name: "userId"
    in: "path"
    description: "ID of user to return"
    required: true
    type: "uuid"
  • 2
    Please don't post only code as answer, but also provide an explanation what your code does and how it solves the problem of the question. Answers with an explanation are usually more helpful and of better quality, and are more likely to attract upvotes. – Mark Rotteveel May 01 '21 at 07:29