Skip to content

Instantly share code, notes, and snippets.

@tosin2013
Last active July 9, 2023 17:07
Show Gist options
  • Save tosin2013/d207c37958249119448a918f6c7720e0 to your computer and use it in GitHub Desktop.
Save tosin2013/d207c37958249119448a918f6c7720e0 to your computer and use it in GitHub Desktop.
openapi: 3.0.0
info:
title: My Python API
version: 1.0.0
servers:
- url: http://localhost:8000
paths:
/users:
get:
summary: Get all users
responses:
'200':
description: OK
post:
summary: Create a new user
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name:
type: string
age:
type: integer
responses:
'201':
description: Created
/users/{id}:
get:
summary: Get a user by ID
parameters:
- name: id
in: path
required: true
schema:
type: integer
responses:
'200':
description: OK
'404':
description: User not found
put:
summary: Update a user by ID
parameters:
- name: id
in: path
required: true
schema:
type: integer
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name:
type: string
age:
type: integer
responses:
'200':
description: OK
'404':
description: User not found
delete:
summary: Delete a user by ID
parameters:
- name: id
in: path
required: true
schema:
type: integer
responses:
'204':
description: No Content
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment