Skip to content

Instantly share code, notes, and snippets.

@yihuang
Last active May 14, 2022 15:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yihuang/10f4f642da663304c2b77bebe679e9e2 to your computer and use it in GitHub Desktop.
Save yihuang/10f4f642da663304c2b77bebe679e9e2 to your computer and use it in GitHub Desktop.
{
"openapi": "3.0.2",
"info": {
"title": "FastAPI",
"version": "0.1.0"
},
"paths": {
"/token": {
"post": {
"summary": "Login",
"operationId": "login_token_post",
"requestBody": {
"content": {
"application/x-www-form-urlencoded": {
"schema": {
"$ref": "#/components/schemas/Body_login_token_post"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/me": {
"get": {
"summary": "Me",
"operationId": "me_me_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/User"
}
}
}
}
},
"security": [
{
"OAuth2PasswordBearer": [
]
}
]
}
},
"/update": {
"post": {
"summary": "Update Api",
"operationId": "update_api_update_post",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Player"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
},
"security": [
{
"OAuth2PasswordBearer": [
]
}
]
}
},
"/buy_plane": {
"post": {
"summary": "Buy Plane",
"operationId": "buy_plane_buy_plane_post",
"parameters": [
{
"required": true,
"schema": {
"title": "Plane",
"type": "integer"
},
"name": "plane",
"in": "query"
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
},
"security": [
{
"OAuth2PasswordBearer": [
]
}
]
}
},
"/update_team": {
"post": {
"summary": "Update Team",
"operationId": "update_team_update_team_post",
"requestBody": {
"content": {
"application/json": {
"schema": {
"title": "Team",
"type": "array",
"items": {
"type": "integer"
}
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
},
"security": [
{
"OAuth2PasswordBearer": [
]
}
]
}
},
"/fight": {
"post": {
"summary": "Fight Api",
"operationId": "fight_api_fight_post",
"parameters": [
{
"required": true,
"schema": {
"title": "Planet",
"type": "integer"
},
"name": "planet",
"in": "query"
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/FightResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
},
"security": [
{
"OAuth2PasswordBearer": [
]
}
]
}
}
},
"components": {
"schemas": {
"Body_login_token_post": {
"title": "Body_login_token_post",
"required": [
"username",
"password"
],
"type": "object",
"properties": {
"grant_type": {
"title": "Grant Type",
"pattern": "password",
"type": "string"
},
"username": {
"title": "Username",
"type": "string"
},
"password": {
"title": "Password",
"type": "string"
},
"scope": {
"title": "Scope",
"type": "string",
"default": ""
},
"client_id": {
"title": "Client Id",
"type": "string"
},
"client_secret": {
"title": "Client Secret",
"type": "string"
}
}
},
"FightResponse": {
"title": "FightResponse",
"required": [
"me",
"enemy",
"result"
],
"type": "object",
"properties": {
"me": {
"title": "Me",
"type": "array",
"items": {
"$ref": "#/components/schemas/PlaneInstance"
}
},
"enemy": {
"title": "Enemy",
"type": "array",
"items": {
"$ref": "#/components/schemas/PlaneInstance"
}
},
"result": {
"$ref": "#/components/schemas/FightResult"
}
}
},
"FightResult": {
"title": "FightResult",
"required": [
"win",
"first_move",
"rounds"
],
"type": "object",
"properties": {
"win": {
"title": "Win",
"type": "boolean"
},
"first_move": {
"title": "First Move",
"type": "boolean"
},
"rounds": {
"title": "Rounds",
"type": "array",
"items": {
"$ref": "#/components/schemas/RoundResult"
}
}
}
},
"HTTPValidationError": {
"title": "HTTPValidationError",
"type": "object",
"properties": {
"detail": {
"title": "Detail",
"type": "array",
"items": {
"$ref": "#/components/schemas/ValidationError"
}
}
}
},
"Plane": {
"title": "Plane",
"required": [
"id",
"proto_id",
"level",
"buffs"
],
"type": "object",
"properties": {
"id": {
"title": "Id",
"type": "integer"
},
"proto_id": {
"title": "Proto Id",
"type": "integer"
},
"level": {
"title": "Level",
"type": "integer"
},
"buffs": {
"title": "Buffs",
"type": "array",
"items": {
"type": "integer"
}
}
}
},
"PlaneInstance": {
"title": "PlaneInstance",
"required": [
"plane",
"plane_attrs"
],
"type": "object",
"properties": {
"plane": {
"$ref": "#/components/schemas/Plane"
},
"plane_attrs": {
"$ref": "#/components/schemas/RealisedPlane"
},
"hp": {
"title": "Hp",
"type": "integer",
"default": 0
},
"buffs": {
"title": "Buffs",
"type": "array",
"items": {
"type": "integer"
}
}
}
},
"Player": {
"title": "Player",
"type": "object",
"properties": {
"gold": {
"title": "Gold",
"type": "integer",
"default": 0
},
"level": {
"title": "Level",
"type": "integer",
"default": 0
},
"planes": {
"title": "Planes",
"type": "object",
"additionalProperties": {
"$ref": "#/components/schemas/Plane"
}
},
"team": {
"title": "Team",
"type": "array",
"items": {
"type": "integer"
},
"default": [
null,
null,
null,
null,
null,
null
]
}
}
},
"RealisedPlane": {
"title": "RealisedPlane",
"required": [
"level",
"hp",
"atk",
"def_",
"crit",
"anti",
"hit",
"dodge"
],
"type": "object",
"properties": {
"level": {
"title": "Level",
"type": "integer"
},
"hp": {
"title": "Hp",
"type": "integer"
},
"atk": {
"title": "Atk",
"type": "integer"
},
"def_": {
"title": "Def ",
"type": "integer"
},
"crit": {
"title": "Crit",
"type": "integer"
},
"anti": {
"title": "Anti",
"type": "integer"
},
"hit": {
"title": "Hit",
"type": "integer"
},
"dodge": {
"title": "Dodge",
"type": "integer"
}
},
"description": "plane fight data after realized levels and buffs"
},
"RoundResult": {
"title": "RoundResult",
"required": [
"from",
"to"
],
"type": "object",
"properties": {
"from": {
"title": "From",
"type": "integer"
},
"to": {
"title": "To",
"type": "integer"
},
"dmg": {
"title": "Dmg",
"type": "integer",
"default": 0
},
"crit": {
"title": "Crit",
"type": "boolean",
"default": false
},
"dodge": {
"title": "Dodge",
"type": "boolean",
"default": false
},
"dead": {
"title": "Dead",
"type": "boolean",
"default": false
}
}
},
"User": {
"title": "User",
"required": [
"id",
"name"
],
"type": "object",
"properties": {
"id": {
"title": "Id",
"type": "integer"
},
"name": {
"title": "Name",
"type": "string"
},
"attrs": {
"$ref": "#/components/schemas/Player"
}
}
},
"ValidationError": {
"title": "ValidationError",
"required": [
"loc",
"msg",
"type"
],
"type": "object",
"properties": {
"loc": {
"title": "Location",
"type": "array",
"items": {
"anyOf": [
{
"type": "string"
},
{
"type": "integer"
}
]
}
},
"msg": {
"title": "Message",
"type": "string"
},
"type": {
"title": "Error Type",
"type": "string"
}
}
}
},
"securitySchemes": {
"OAuth2PasswordBearer": {
"type": "oauth2",
"flows": {
"password": {
"scopes": {
},
"tokenUrl": "token"
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment