Skip to content

Instantly share code, notes, and snippets.

@abidr
Last active September 23, 2022 11:28
Show Gist options
  • Save abidr/61a9b5436f236b66bed4d781ad0b89d7 to your computer and use it in GitHub Desktop.
Save abidr/61a9b5436f236b66bed4d781ad0b89d7 to your computer and use it in GitHub Desktop.
Test
openapi: 3.0.0
x-stoplight:
id: vta5oergohysa
info:
title: Co Medic
version: '1.0'
servers:
- url: 'http://localhost:3000'
paths:
'/users/{userId}':
parameters:
- schema:
type: integer
name: userId
in: path
required: true
description: Id of an existing user.
get:
summary: Get User Info by User ID
tags: []
responses:
'200':
description: User Found
content:
application/json:
schema:
$ref: '#/components/schemas/User'
examples:
Get User Alice Smith:
value:
id: 142
firstName: Alice
lastName: Smith
email: [email protected]
dateOfBirth: '1997-10-31'
emailVerified: true
signUpDate: '2019-08-24'
'404':
description: User Not Found
operationId: get-users-userId
description: Retrieve the information of the user with the matching user ID.
patch:
summary: Update User Information
operationId: patch-users-userId
responses:
'200':
description: User Updated
content:
application/json:
schema:
$ref: '#/components/schemas/User'
examples:
Updated User Rebecca Baker:
value:
id: 13
firstName: Rebecca
lastName: Baker
email: [email protected]
dateOfBirth: '1985-10-02'
emailVerified: false
createDate: '2019-08-24'
'404':
description: User Not Found
'409':
description: Email Already Taken
description: Update the information of an existing user.
requestBody:
content:
application/json:
schema:
type: object
properties:
firstName:
type: string
lastName:
type: string
email:
type: string
description: 'If a new email is given, the user''s email verified property will be set to false.'
dateOfBirth:
type: string
examples:
Update First Name:
value:
firstName: Rebecca
Update Email:
value:
email: [email protected]
Update Last Name & Date of Birth:
value:
lastName: Baker
dateOfBirth: '1985-10-02'
description: Patch user properties to update.
/user:
post:
summary: Create New User
operationId: post-user
responses:
'200':
description: User Created
content:
application/json:
schema:
$ref: '#/components/schemas/User'
examples:
New User Bob Fellow:
value:
id: 12
firstName: Bob
lastName: Fellow
email: [email protected]
dateOfBirth: '1996-08-24'
emailVerified: false
createDate: '2020-11-18'
'400':
description: Missing Required Information
'409':
description: Email Already Taken
requestBody:
content:
application/json:
schema:
type: object
properties:
firstName:
type: string
lastName:
type: string
email:
type: string
dateOfBirth:
type: string
format: date
required:
- firstName
- lastName
- email
- dateOfBirth
examples:
Create User Bob Fellow:
value:
firstName: Bob
lastName: Fellow
email: [email protected]
dateOfBirth: '1996-08-24'
description: Post the necessary fields for the API to create a new user.
description: Create a new user.
/patients:
get:
summary: Your GET endpoint
tags: []
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Patient'
examples: {}
operationId: get-patients
description: ''
components:
schemas:
User:
title: User
type: object
description: ''
x-examples:
Alice Smith:
id: 142
firstName: Alice
lastName: Smith
email: [email protected]
dateOfBirth: '1997-10-31'
emailVerified: true
signUpDate: '2019-08-24'
properties:
id:
type: integer
description: Unique identifier for the given user.
firstName:
type: string
lastName:
type: string
email:
type: string
format: email
dateOfBirth:
type: string
format: date
example: '1997-10-31'
emailVerified:
type: boolean
description: Set to true if the user's email has been verified.
createDate:
type: string
format: date
description: The date that the user was created.
required:
- id
- firstName
- lastName
- email
- emailVerified
Patient:
title: Patient
x-stoplight:
id: cfnzf1utrdf73
type: object
properties:
id:
type: integer
profileImage:
type: string
first_name:
type: string
last_name:
type: string
date_of_birth:
type: string
gender:
type: string
ssn:
type: string
weight:
type: object
properties:
value:
type: integer
updatedAt:
type: string
pain:
type: object
properties:
value:
type: integer
updatedAt:
type: string
blood_pressure:
type: object
properties:
value:
type: integer
updatedAt:
type: string
edema:
type: object
properties:
value:
type: integer
updatedAt:
type: string
care_providers:
type: array
items:
$ref: '#/components/schemas/Doctor'
Doctor:
title: Doctor
x-stoplight:
id: cfnzf1utrdf73
type: object
description: ''
properties:
id:
type: integer
profileImage:
type: string
first_name:
type: string
last_name:
type: string
date_of_birth:
type: string
gender:
type: string
ssn:
type: string
designation:
type: string
speciality:
type: array
items:
type: string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment