This repository has been archived on 2022-06-10. You can view files and clone it, but cannot push or open issues or pull requests.
mydraftcc-nodejs-server/server/openapi.yaml

206 lines
5.8 KiB
YAML
Raw Permalink Normal View History

2022-06-04 18:04:25 +00:00
openapi: 3.0.0
info:
version: 3.0.0
description: "Nodejs API server for https://mydraft.cc - UI"
title: "Mydraft Nodejs server"
contact:
2022-06-04 18:30:25 +00:00
url: www.mytinydc.com
2022-06-04 18:04:25 +00:00
license:
name: "MIT Licence"
url: "https://mit-license.org/"
tags:
2022-06-04 18:30:25 +00:00
- name: "manage"
description: "Load/Save draft"
2022-06-04 18:04:25 +00:00
servers:
2022-06-04 18:30:25 +00:00
- url: "http://localhost:4000"
2022-06-04 18:04:25 +00:00
components:
schemas:
serverresponsestore:
type: object
properties:
writeToken:
type: string
readToken:
type: string
internalerror:
type: object
properties:
error:
type: string
2022-06-04 18:30:25 +00:00
diagramstructure:
2022-06-04 18:04:25 +00:00
type: array
items:
type: object
paths:
/:
post:
tags:
- "manage"
summary: "Store new draft document"
requestBody:
required: true
content:
application/json:
schema:
2022-06-04 18:30:25 +00:00
$ref: "#/components/schemas/diagramstructure"
2022-06-04 18:04:25 +00:00
examples:
JsonOK:
2022-06-04 18:30:25 +00:00
value:
[
{
"type": "diagram/add",
"payload":
{
"diagramId": "f9e48fc9-da3d-aa39-1ab5-0641b0a0f59a",
"timestamp": 1654256184083,
},
},
{
"type": "items/addVisual",
"payload":
{
"diagramId": "f9e48fc9-da3d-aa39-1ab5-0641b0a0f59a",
"timestamp": 1654256186400,
"shapeId": "82170ec5-2cc5-c0f2-1414-38e8e477dd01",
"renderer": "Button",
"position": { "x": 199.5, "y": 119.30000305175781 },
},
},
]
badFormat:
value: "This is not JSON format"
2022-06-04 18:04:25 +00:00
responses:
"200":
description: "successful operation"
content:
application/json:
schema:
2022-06-04 18:30:25 +00:00
$ref: "#/components/schemas/serverresponsestore"
2022-06-04 18:04:25 +00:00
"500":
description: "Server Internal ERROR"
content:
application/json:
schema:
2022-06-04 18:30:25 +00:00
$ref: "#/components/schemas/internalerror"
security: [] # no authentication
2022-06-04 18:04:25 +00:00
/{tokenToRead}/{tokenToWrite}:
put:
tags:
2022-06-04 18:30:25 +00:00
- "manage"
2022-06-04 18:04:25 +00:00
summary: "Update draft document"
parameters:
2022-06-04 18:30:25 +00:00
- name: "tokenToRead"
in: "path"
required: true
schema:
type: "string"
examples:
GoodId:
value: "f9e48fc9-da3d-aa39-1ab5-0641b0a0f59a"
WronId:
value: "not the good id"
- name: "tokenToWrite"
in: "path"
required: true
schema:
type: "string"
examples:
GoodId:
value: "f9e48fc9-da3d-aa39-1ab5-0641b0a0f59a"
WronId:
value: "not the good id"
2022-06-04 18:04:25 +00:00
requestBody:
required: true
content:
application/json:
schema:
2022-06-04 18:30:25 +00:00
$ref: "#/components/schemas/diagramstructure"
2022-06-04 18:04:25 +00:00
examples:
JsonOK:
2022-06-04 18:30:25 +00:00
value:
[
{
"type": "diagram/add",
"payload":
{
"diagramId": "f9e48fc9-da3d-aa39-1ab5-0641b0a0f59a",
"timestamp": 1654256184083,
},
},
{
"type": "items/addVisual",
"payload":
{
"diagramId": "f9e48fc9-da3d-aa39-1ab5-0641b0a0f59a",
"timestamp": 1654256186400,
"shapeId": "82170ec5-2cc5-c0f2-1414-38e8e477dd01",
"renderer": "Button",
"position": { "x": 199.5, "y": 119.30000305175781 },
},
},
]
badFormat:
value: "This is not JSON format"
2022-06-04 18:04:25 +00:00
responses:
"200":
description: "successful operation"
content:
application/json:
schema:
2022-06-04 18:30:25 +00:00
$ref: "#/components/schemas/serverresponsestore"
2022-06-04 18:04:25 +00:00
"400":
description: "probleme with body content JSON structure"
content:
application/json:
schema:
2022-06-04 18:30:25 +00:00
$ref: "#/components/schemas/internalerror"
2022-06-04 18:04:25 +00:00
"500":
description: "Server Internal ERROR"
content:
application/json:
schema:
2022-06-04 18:30:25 +00:00
$ref: "#/components/schemas/internalerror"
security: [] # no authentication
2022-06-04 18:04:25 +00:00
/get/{diagramID}:
get:
tags:
2022-06-04 18:30:25 +00:00
- "manage"
summary: "to get a draft document (json object)"
2022-06-04 18:04:25 +00:00
parameters:
2022-06-04 18:30:25 +00:00
- name: "diagramID"
in: "path"
description: "diagram ID"
required: true
schema:
type: "string"
examples:
GoodId:
value: "f9e48fc9-da3d-aa39-1ab5-0641b0a0f59a"
WronId:
value: "not the good id"
RunDir:
value: "../f9e48fc9-da3d-aa39-1ab5-0641b0a0f59a"
2022-06-04 18:04:25 +00:00
responses:
"200":
description: "successful operation"
content:
application/json:
schema:
2022-06-04 18:30:25 +00:00
$ref: "#/components/schemas/diagramstructure"
2022-06-04 18:04:25 +00:00
"500":
description: "Server Internal ERROR"
content:
application/json:
schema:
2022-06-04 18:30:25 +00:00
$ref: "#/components/schemas/internalerror"
security: [] # no authentication