Skip to content

Instantly share code, notes, and snippets.

@tslmy
Created October 15, 2022 06:59
Show Gist options
  • Save tslmy/b4386032e69849503bb7d3cf4a44a1c2 to your computer and use it in GitHub Desktop.
Save tslmy/b4386032e69849503bb7d3cf4a44a1c2 to your computer and use it in GitHub Desktop.
OpenAPI 3.0 Contract of zgzgorg/iam-backend
openapi: 3.0.0
paths:
/account/approve_registers:
post:
responses:
"200":
description: approve accounts successful
"400":
description: approve accounts have some fails
summary: get account infomation from database
description: approve accounts
operationId: post_approve_registers
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/approving_accounts"
required: true
tags:
- account
/account/info:
patch:
responses:
"200":
description: update information successful
"401":
description: unauthorized
"409":
description: email conflict
summary: update account infomation
description: Update account infomation except `join_date`, `type` and `id`
operationId: patch_info
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/approved_account"
required: true
tags:
- account
get:
responses:
"200":
description: get information successful
summary: get account infomation from database
description: Get account infomation
operationId: get_info
tags:
- account
/account/register:
post:
responses:
"200":
description: register account successful
"409":
description: account exists
summary: register user and insert data to database
description: user register
operationId: post_register_account
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/account"
required: true
tags:
- account
/auth/login:
get:
responses:
"200":
description: login successful
"401":
description: unauthorized
summary: login via google OAuth2
description: login account
operationId: get_login
tags:
- auth
/auth/logout:
post:
responses:
"200":
description: logout successful
summary: logout and clear session
description: logout account
operationId: post_logout
tags:
- auth
/auth/token:
post:
responses:
"201":
description: create token successful with a return token
summary: Create account token
description: create account token
operationId: post_token
tags:
- auth
get:
responses:
"200":
description: get tokens successful
summary: get account token list not expired
description: get lists of account token
operationId: get_token
tags:
- auth
delete:
responses:
"200":
description: delete token successful
"400":
description: token not found
summary: delete account token
description: create account token
operationId: delete_token
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/token"
required: true
tags:
- auth
info:
title: API
version: "1"
tags:
- name: account
- name: auth
servers:
- url: //127.0.0.1:5000/api/v1
components:
responses:
ParseError:
description: When a mask can't be parsed
MaskError:
description: When any error occurs on mask
schemas:
account:
required:
- email
- first_name
- last_name
- phone_number
properties:
email:
type: string
format: email
example: email@domain.com
first_name:
type: string
example: Jack
last_name:
type: string
example: Wong
chinese_name:
type: string
example: 王傑克
nickname:
type: string
example: JJ
phone_number:
type: string
format: phone
example: +10001112222;3,44
shirt_size:
type: string
example: XXL
company:
type: string
example: Space X
school:
type: string
example: Moon College
dietary_restriction:
type: string
example: No Vag
reimbursement_platform:
type: string
description: can be 'paypal', 'zelle', or 'None'
example: paypal
reimbursement_method:
type: string
example: email
reimbursement_phone_number:
type: string
example: "1234567890"
reimbursement_email:
type: string
format: email
example: email@domain.com
join_date:
type: string
format: date
birthday:
type: string
format: date
memo:
type: object
description: json notes
additionalProperties:
type: string
type:
type: string
description: can be 'bot' or 'person'
example: person
type: object
approved_account:
properties:
email:
type: string
format: email
example: email@domain.com
first_name:
type: string
example: Jack
last_name:
type: string
example: Wong
chinese_name:
type: string
example: 王傑克
nickname:
type: string
example: JJ
phone_number:
type: string
format: phone
example: +10001112222;3,44
shirt_size:
type: string
example: XXL
company:
type: string
example: Space X
school:
type: string
example: Moon College
dietary_restriction:
type: string
example: No Vag
reimbursement_platform:
type: string
description: can be 'paypal', 'zelle', or 'None'
example: paypal
reimbursement_method:
type: string
example: email
reimbursement_phone_number:
type: string
example: "1234567890"
reimbursement_email:
type: string
format: email
example: email@domain.com
join_date:
type: string
format: date
birthday:
type: string
format: date
memo:
type: object
description: json notes
additionalProperties:
type: string
type:
type: string
description: can be 'bot' or 'person'
example: person
id:
type: string
example: JackW
type: object
approving_accounts:
required:
- emails
properties:
emails:
type: array
items:
type: string
type: object
token:
properties:
token:
type: string
description: API access token
type: object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment