SAE410_TP2/swagger.yml
2024-03-27 17:04:51 +01:00

227 lines
4.5 KiB
YAML

openapi: '3.0.2'
info:
title: API Jo
version: '1.0'
servers:
- url: http://localhost/
components:
schemas:
Athlete:
type: object
properties:
name:
type: string
surname:
type: string
email:
type: string
country:
type: string
isDisabled:
type: boolean
default: false
Sport:
type: object
properties:
name:
type: string
place:
type: string
category:
type: string
Medal:
type: object
properties:
rank:
type: string
enum:
- gold
- silver
- bronze
sportID:
type: integer
athleteID:
type: integer
paths:
/athletes:
get:
tags:
- Athletes
summary: Display athletes list
responses:
'200':
description: OK
post:
tags:
- Athletes
summary: Add a new athlete
responses:
'200':
description: OK
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Athlete'
/athletes/{id}:
parameters:
- name: id
in: path
required: true
schema:
type: integer
example: 1
get:
tags:
- Athletes
summary: Display one athlete using the ID
responses:
'200':
description: 'OK'
content:
application/json:
schema:
$ref: '#/components/schemas/Athlete'
'404':
description: 'Not found'
patch:
tags:
- Athletes
summary: Modify a athlete using the ID
responses:
'200':
description: 'OK'
delete:
tags:
- Athletes
summary: Delete an athlete using the ID
responses:
'200':
description: 'OK'
'404':
description: 'Athete not found'
/sports:
get:
tags:
- Sports
summary: List all available sports
responses:
'200':
description: OK
post:
tags:
- Sports
summary: Add a sport
responses:
'200':
description: OK
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Sport'
/sports/{id}:
get:
tags:
- Sports
summary: Display a specific sport using the ID
responses:
'200':
description: 'OK'
content:
application/json:
schema:
$ref: '#/components/schemas/Sport'
'404':
description: 'Not found'
parameters:
- name: id
in: path
required: true
schema:
type: integer
example: 1
patch:
tags:
- Sports
summary: Edit a specific sport using the ID
responses:
'200':
description: 'OK'
delete:
tags:
- Sports
summary: Delete a specific sport using the ID
responses:
'200':
description: 'OK'
'404':
description: 'Sport not found'
/medal:
get:
tags:
- Medal
summary: Display medals list
responses:
'200':
description: OK
post:
tags:
- Medal
summary: Add a new medal
responses:
'200':
description: OK
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Medal'
/medals/{id}:
get:
tags:
- Medal
summary: Display a medal
responses:
'200':
description: 'OK'
content:
application/json:
schema:
$ref: '#/components/schemas/Medal'
'404':
description: 'Not found'
parameters:
- name: id
in: path
required: true
schema:
type: integer
example: 1
patch:
tags:
- Medal
summary: Modify element from medal
responses:
'200':
description: 'OK'
'404':
description: 'Medal not found'
delete:
tags:
- Medal
summary: Delete medal from Id
responses:
'200':
description: 'OK'
'404':
description: 'Medal not found'