experimenting with swagger, Makefile currently not working, WIP

This commit is contained in:
Sonja Happ 2019-04-11 13:20:32 +02:00
parent 3bc6c8f11f
commit 85473f5786
2 changed files with 161 additions and 31 deletions

View file

@ -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 ./ java -jar swagger-codegen-cli.jar generate -i api.yaml -l html2 -o ./
swagger-codegen-cli.jar: 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: clean:
rm -rf index.html swagger-codegen-cli.jar rm -rf index.html swagger-codegen-cli.jar

View file

@ -1,44 +1,174 @@
swagger: "2.0" openapi: 3.0.1
info: info:
title: "VILLASweb API" title: VILLASweb API
description: "API for VILLASweb. Documentation in progress... please be patient" description: API for VILLASweb. Documentation in progress... please be patient
version : "1.0.0" version: 1.0.0
host: "aaa.bbb.ccc.ddd:port" servers:
basePath: "/api/v1" - url: http://111.222.333.444:5555/api/v1
tags: tags:
- name: "simulations" - name: simulations
description: "Manage Simulations" description: Manage Simulations
schemes:
- "http"
paths: paths:
/simulations: /simulations:
get: get:
tags:
- simulations
summary: Get all available simulations
description: Return a JSON representation of all simulations
operationId: getSimulations operationId: getSimulations
tags:
- "simulations"
summary: "Get the available simulations"
description: "Return a JSON representation of all simulations"
produces:
- "appilcation/json"
responses: responses:
200: 400:
description: "Success" description: Unable to receive simulations
500: content: {}
description: "Internal Server Error" post:
/simulations/{userID}:
put:
operationId: postSimulationForUser
tags: tags:
- "simulation" - simulations
summary: "Add simulation for user with ID userID" summary: Add a new simulation to the database
parameters: operationId: addSimulation
- name: "userId" requestBody:
in: path description: "Simulation object to add to DB"
description: "ID of the user to which the simulation shall be added"
required: true 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: responses:
200: 200:
description: "Success" description: Success
content: {}
500: 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