Untitled

mail@pastecode.io avatar
unknown
yaml
2 years ago
2.1 kB
7
Indexable
Never
# swagger.yml

openapi: 3.0.0
info:
  title: "RP Flask REST API"
  description: "An API about people and notes"
  version: "1.0.0"

servers:
  - url: "/api"

components:
  schemas:
    Person:
      type: "object"
      required:
        - lname
      properties:
        fname:
          type: "string"
        lname:
          type: "string"
  parameters:
    lname:
      name: "lname"
      description: "Last name of the person"
      in: path
      required: true
      schema:
        type: "string"

paths:
  /people:
    get:
      operationId: "people.read_all"
      tags:
        - "People"
      summary: "Read the list of people"
      responses:
        "200":
          description: "Successfully read people list"
    post:
      operationId: "people.create"
      tags:
        - People
      summary: "Create a person"
      requestBody:
        description: "Person to create"
        required: true
        content:
          application/json:
            schema:
              x-body-name: "person"
              $ref: "#/components/schemas/Person"
      responses:
        "200":
          description: "Successfully created a person"
  /people/{lname}:
    get:
      operationId: "people.read_one"
      tags:
        - "People"
      summary: "Read one person"
      parameters:
        - $ref: "#/components/parameters/lname"
      responses:
        "200":
          description: "Successfully read a person"
    put:
      operationId: "people.update"
      tags:
        - "People"
      summary: "Update one person"
      parameters:
        - $ref: "#/components/parameters/lname"
      responses:
        "200":
          description: "Successsfully updated person"
      requestBody:
        content:
          application/json:
            schema:
              x-body-name: "person"
              $ref: "#/components/schemas/Person"
    delete:
      operationId: "people.delete"
      tags:
        - "People"
      summary: "Delete a person"
      parameters:
        - $ref: "#/components/parameters/lname"
      responses:
        "204":
          description: "Successsfully deleted person"