mirror of
https://git.rwth-aachen.de/acs/public/villas/web-backend-go/
synced 2025-03-30 00:00:12 +01:00
experimenting with swagger, Makefile currently not working, WIP
This commit is contained in:
parent
3bc6c8f11f
commit
85473f5786
2 changed files with 161 additions and 31 deletions
|
@ -6,7 +6,7 @@ index.html: swagger-codegen-cli.jar api.yaml
|
|||
java -jar swagger-codegen-cli.jar generate -i api.yaml -l html2 -o ./
|
||||
|
||||
swagger-codegen-cli.jar:
|
||||
wget http://central.maven.org/maven2/io/swagger/swagger-codegen-cli/2.3.1/swagger-codegen-cli-2.3.1.jar -O swagger-codegen-cli.jar
|
||||
wget http://central.maven.org/maven2/io/swagger/swagger-codegen-cli/2.4.4/swagger-codegen-cli-2.4.4.jar -O swagger-codegen-cli.jar
|
||||
|
||||
clean:
|
||||
rm -rf index.html swagger-codegen-cli.jar
|
||||
|
|
194
doc/api/api.yaml
194
doc/api/api.yaml
|
@ -1,44 +1,174 @@
|
|||
swagger: "2.0"
|
||||
openapi: 3.0.1
|
||||
info:
|
||||
title: "VILLASweb API"
|
||||
description: "API for VILLASweb. Documentation in progress... please be patient"
|
||||
version : "1.0.0"
|
||||
host: "aaa.bbb.ccc.ddd:port"
|
||||
basePath: "/api/v1"
|
||||
title: VILLASweb API
|
||||
description: API for VILLASweb. Documentation in progress... please be patient
|
||||
version: 1.0.0
|
||||
servers:
|
||||
- url: http://111.222.333.444:5555/api/v1
|
||||
tags:
|
||||
- name: "simulations"
|
||||
description: "Manage Simulations"
|
||||
schemes:
|
||||
- "http"
|
||||
- name: simulations
|
||||
description: Manage Simulations
|
||||
paths:
|
||||
/simulations:
|
||||
get:
|
||||
tags:
|
||||
- simulations
|
||||
summary: Get all available simulations
|
||||
description: Return a JSON representation of all simulations
|
||||
operationId: getSimulations
|
||||
tags:
|
||||
- "simulations"
|
||||
summary: "Get the available simulations"
|
||||
description: "Return a JSON representation of all simulations"
|
||||
produces:
|
||||
- "appilcation/json"
|
||||
responses:
|
||||
200:
|
||||
description: "Success"
|
||||
500:
|
||||
description: "Internal Server Error"
|
||||
/simulations/{userID}:
|
||||
put:
|
||||
operationId: postSimulationForUser
|
||||
400:
|
||||
description: Unable to receive simulations
|
||||
content: {}
|
||||
post:
|
||||
tags:
|
||||
- "simulation"
|
||||
summary: "Add simulation for user with ID userID"
|
||||
parameters:
|
||||
- name: "userId"
|
||||
in: path
|
||||
description: "ID of the user to which the simulation shall be added"
|
||||
- simulations
|
||||
summary: Add a new simulation to the database
|
||||
operationId: addSimulation
|
||||
requestBody:
|
||||
description: "Simulation object to add to DB"
|
||||
required: true
|
||||
type: "integer"
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Simulation'
|
||||
example:
|
||||
name: Test
|
||||
|
||||
responses:
|
||||
400:
|
||||
description: Unable to find user or unable to create simulation
|
||||
content: {}
|
||||
500:
|
||||
description: Unable to save user
|
||||
content: {}
|
||||
put:
|
||||
tags:
|
||||
- simulation
|
||||
summary: Add simulation for user with ID userID
|
||||
operationId: putSimulationForUser
|
||||
parameters:
|
||||
- name: userId
|
||||
in: path
|
||||
description: ID of the user to which the simulation shall be added
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
responses:
|
||||
200:
|
||||
description: "Success"
|
||||
description: Success
|
||||
content: {}
|
||||
500:
|
||||
description: "Internal server error"
|
||||
description: Internal server error
|
||||
|
||||
|
||||
components:
|
||||
schemas:
|
||||
Project:
|
||||
required:
|
||||
- name
|
||||
- simulation
|
||||
- user
|
||||
type: object
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
user:
|
||||
type: string
|
||||
simulation:
|
||||
type: string
|
||||
visualizations:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
Visualization:
|
||||
required:
|
||||
- name
|
||||
- project
|
||||
- user
|
||||
type: object
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
user:
|
||||
type: string
|
||||
project:
|
||||
type: string
|
||||
widgets:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
User:
|
||||
required:
|
||||
- password
|
||||
- role
|
||||
- username
|
||||
type: object
|
||||
properties:
|
||||
username:
|
||||
type: string
|
||||
password:
|
||||
type: string
|
||||
role:
|
||||
type: string
|
||||
projects:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
mail:
|
||||
type: string
|
||||
simulations:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
files:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
Simulation:
|
||||
required:
|
||||
- name
|
||||
type: object
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
running:
|
||||
type: boolean
|
||||
models:
|
||||
type: object
|
||||
properties: {}
|
||||
projects:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Project'
|
||||
user:
|
||||
$ref: '#/components/schemas/User'
|
||||
startParameters:
|
||||
type: object
|
||||
properties: {}
|
||||
File:
|
||||
required:
|
||||
- date
|
||||
- name
|
||||
- path
|
||||
- size
|
||||
- type
|
||||
- user
|
||||
type: object
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
path:
|
||||
type: string
|
||||
type:
|
||||
type: string
|
||||
size:
|
||||
type: integer
|
||||
height:
|
||||
type: integer
|
||||
width:
|
||||
type: integer
|
||||
user:
|
||||
type: string
|
||||
date:
|
||||
type: string
|
||||
|
|
Loading…
Add table
Reference in a new issue