Commit a2d46a60 authored by hengwen's avatar hengwen
Browse files

Add OpenAPI documentation

parent eec564c1
swagger: "2.0"
info:
description: "API doc for MontiSim server"
version: "1.0.0"
title: "MontiSim simulator server"
host: "localhost:8080"
basePath: "/"
tags:
- name: "map"
description: "map management"
- name: "scenario"
description: "scenario management"
- name: "simulation"
description: "simulation operations"
schemes:
- "http"
paths:
/map:
post:
tags:
- "map"
summary: "Upload a map to server"
description: ""
operationId: "uploadMap"
consumes:
- "multipart/form-data"
produces:
- "application/json"
parameters:
- in: "formData"
name: "file"
type: "file"
description: "A map file in OpenStreetMap format"
required: true
responses:
200:
description: "File uploaded"
schema:
$ref: "#/definitions/GetMapResp"
get:
tags:
- "map"
summary: "List all available map"
operationId: "listMap"
produces:
- "application/json"
responses:
200:
description: "All available maps"
schema:
$ref: "#/definitions/ListMapResp"
/map/{id}:
get:
tags:
- "map"
summary: "Get map by id"
parameters:
- name: "id"
in: "path"
description: "ID of map to return"
required: true
type: "integer"
format: "int64"
produces:
- "application/json"
responses:
200:
description: "success"
schema:
$ref: "#/definitions/GetMapResp"
/scenario:
post:
tags:
- "scenario"
summary: "Upload a scenario to server"
description: ""
consumes:
- "multipart/form-data"
produces:
- "application/json"
parameters:
- in: "formData"
name: "file"
type: "file"
description: "A scenario file"
required: true
responses:
200:
description: "Scenario uploaded"
schema:
$ref: "#/definitions/GetScenarioResp"
get:
tags:
- "scenario"
summary: "List all available scenarios"
produces:
- "application/json"
responses:
200:
description: "All available scenarios"
schema:
$ref: "#/definitions/ListScenarioResp"
/simulation/{id}/start:
post:
tags:
- "simulation"
summary: "Start simulation"
parameters:
- name: "id"
in: "path"
description: "ID of simulation to start"
required: true
type: "integer"
format: "int64"
produces:
- "application/json"
responses:
200:
description: "success"
500:
description: "server error"
/simulation/{id}/status:
get:
tags:
- "simulation"
summary: "Get simulation status"
parameters:
- name: "id"
in: "path"
description: "ID of simulation to check"
required: true
type: "integer"
format: "int64"
produces:
- "application/json"
responses:
200:
description: "success"
schema:
type: string
enum: [running, finished, not_found]
/simulation/{id}/map-data/{sectorIdx}:
get:
tags:
- "simulation"
summary: "Get map data, including streets, bounds, buildings, etc."
parameters:
- name: "id"
in: "path"
description: "ID of simulation to start"
required: true
type: "integer"
format: "int64"
- name: "sectorIdx"
in: "path"
description: "Index of the sector in the simulation"
required: true
type: "integer"
format: "int64"
produces:
- "application/json"
responses:
200:
description: "success"
schema:
$ref: "#/definitions/MapDataResp"
/simulation/{id}/result:
get:
tags:
- "simulation"
summary: "Get simulation result"
parameters:
- name: "id"
in: "path"
description: "ID of simulation to start"
required: true
type: "integer"
format: "int64"
produces:
- "application/json"
responses:
200:
description: "success"
schema:
$ref: "#/definitions/SimulationResult"
/simulation:
post:
tags:
- "simulation"
summary: "Create a simulation task"
description: ""
consumes:
- "application/x-www-form-urlencoded"
produces:
- "application/json"
parameters:
- in: "formData"
name: "scenario_id"
type: "integer"
description: "ID of scenario that is available on the server"
required: true
- in: "formData"
name: "num_sectors"
type: "integer"
description: "The number of sectors the simulation task(the virtual world) should be split into"
required: true
responses:
200:
description: "Simulation created"
schema:
$ref: "#/definitions/CreateSimulationResp"
get:
tags:
- "simulation"
summary: "List all available scenarios"
produces:
- "application/json"
responses:
200:
description: "All available scenarios"
schema:
$ref: "#/definitions/ListScenarioResp"
/scenario/{id}:
get:
tags:
- "scenario"
summary: "Get scenario by id"
parameters:
- name: "id"
in: "path"
description: "ID of scenario to return"
required: true
type: "integer"
format: "int64"
produces:
- "application/json"
responses:
200:
description: "success"
schema:
$ref: "#/definitions/GetScenarioResp"
definitions:
GetMapResp:
type: "object"
properties:
id:
type: "integer"
format: "int64"
ListMapResp:
type: "array"
items:
$ref: "#/definitions/GetMapResp"
GetScenarioResp:
type: "object"
properties:
id:
type: "integer"
format: "int64"
name:
type: "string"
ListScenarioResp:
type: "array"
items:
$ref: "#/definitions/GetScenarioResp"
CreateSimulationResp:
type: "object"
properties:
id:
type: "integer"
format: "int64"
scenarioID:
type: "integer"
format: "int64"
numSectors:
type: "integer"
format: "int64"
Node:
type: "object"
properties:
id:
type: "integer"
format: "int64"
longitude:
type: "number"
latitude:
type: "number"
altitude:
type: "number"
Street:
type: "object"
properties:
id:
type: "integer"
format: "int64"
width:
type: "number"
nodes:
type: "array"
items:
$ref: "#/definitions/Node"
intersections:
type: "array"
items:
$ref: "#/definitions/Node"
type:
type: "string"
enum: [MOTORWAY, A_ROAD, STREET, LIVING_STREET]
streetPavements:
type: "string"
enum: [PAVED, UNPAVED, QUALITY, STONE, DIRT, GRAS]
speedLimit:
type: "number"
oneWay:
type: "boolean"
Bounds:
type: "object"
properties:
minX:
type: "number"
minY:
type: "number"
minZ:
type: "number"
maxX:
type: "number"
maxY:
type: "number"
maxZ:
type: "number"
Building:
type: "object"
properties:
type:
type: "string"
enum: [UNIVERSITY, HOUSE, GARAGES, CHURC]
nodes:
type: "array"
items:
$ref: "#/definitions/Node"
MapDataResp:
type: "object"
properties:
streets:
type: "array"
items:
$ref: "#/definitions/Street"
buildings:
type: "array"
items:
$ref: "#/definitions/Building"
bounds:
$ref: "#/definitions/Bounds"
SimulationResult:
type: "array"
items:
$ref: "#/definitions/VehicleDataFrames"
DataFrame:
type: "object"
properties:
posX:
type: "number"
posY:
type: "number"
posZ:
type: "number"
steering:
type: "number"
engine:
type: "number"
brake:
type: "number"
deltaTime:
type: "integer"
format: "int64"
totalTime:
type: "integer"
format: "int64"
VehicleDataFrames:
type: "object"
properties:
id:
type: "string"
frames:
type: "array"
items:
$ref: "#/definitions/DataFrame"
externalDocs:
description: "MontiSim server"
url: "https://git.rwth-aachen.de/monticore/EmbeddedMontiArc/simulators/server"
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment