Add initial API documentation

This commit is contained in:
Eirik Witterso 2024-01-27 23:06:56 +01:00
parent fae6bc2a5e
commit 6676e1cdff
1 changed files with 174 additions and 0 deletions

174
openapi.yaml Normal file
View File

@ -0,0 +1,174 @@
openapi: 3.1.0
info:
title: PVV Ozai
description: PVV Ozai
version: 1.0.0
servers:
- url: https://ozai.pvv.ntnu.no
paths:
/{gameId}:
get:
summary: Find pet by ID
description: Returns a single pet
operationId: getGameById
parameters:
- name: gameId
in: path
description: ID of game
required: true
schema:
type: integer
format: int64
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/GameState'
application/xml:
schema:
$ref: '#/components/schemas/GameState'
'400':
description: Invalid ID supplied
'404':
description: Game not found
put:
summary: Submit move
description: ''
operationId: submitMove
parameters:
- name: gameId
in: path
description: ID of pet that needs to be updated
required: true
schema:
type: integer
format: int64
- name: move
in: query
description: Mov
schema:
type: string
- name: status
in: query
description: Status of pet that needs to be updated
schema:
type: string
responses:
'400':
description: Invalid input
components:
schemas:
GameState:
type: object
properties:
currentPlayer:
type: integer
format: int32
bag:
$ref: '#/components/schemas/TileSet'
lid:
$ref: '#/components/schemas/TileSet'
factories:
type: array
items:
$ref: '#/components/schemas/TileSet'
market:
$ref: '#/components/schemas/TileSetWithStart'
players:
type: array
items:
$ref: '#/components/schemas/Player'
TileSet:
type: object
properties:
blue:
type: integer
format: int32
yellow:
type: integer
format: int32
red:
type: integer
format: int32
black:
type: integer
format: int32
white:
type: integer
format: int32
TileSetWithStart:
type: object
properties:
start:
type: integer
format: int32
blue:
type: integer
format: int32
yellow:
type: integer
format: int32
red:
type: integer
format: int32
black:
type: integer
format: int32
white:
type: integer
format: int32
Player:
type: object
properties:
points:
type: integer
format: int32
patternLines:
type: array
items:
$ref: '#/components/schemas/PatternLine'
wall:
$ref: '#/components/schemas/Wall'
floor:
$ref: '#/components/schemas/TileSetWithStart'
PatternLine:
type: object
properties:
color:
$ref: '#/components/schemas/Color'
number:
type: integer
format: int32
Color:
enum: ["blue", "yellow", "red", "black", "white"]
Wall:
type: object
properties:
blue:
type: boolean
yellow:
type: boolean
red:
type: boolean
black:
type: boolean
white:
type: boolean
Move:
type: object
properties:
player:
type: integer
format: int32
market:
type: boolean
factory:
type: integer
format: int32
color:
$ref: '#/components/schemas/Color'
patternLine:
type: integer
format: int32