This commit is contained in:
Damien HENRY 2022-06-04 20:30:25 +02:00
parent f1760a084b
commit 58a3d042ba

View File

@ -4,17 +4,17 @@ info:
description: "Nodejs API server for https://mydraft.cc - UI"
title: "Mydraft Nodejs server"
contact:
website: www.mytinydc.com
url: www.mytinydc.com
license:
name: "MIT Licence"
url: "https://mit-license.org/"
tags:
- name: "manage"
- name: "manage"
description: "Load/Save draft"
servers:
- url: 'http://localhost:4000'
- url: "http://localhost:4000"
components:
schemas:
@ -32,7 +32,7 @@ components:
error:
type: string
diagrammestructure:
diagramstructure:
type: array
items:
type: object
@ -48,26 +48,47 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/diagrammestructure'
$ref: "#/components/schemas/diagramstructure"
examples:
JsonOK:
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}}}]
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'
value: "This is not JSON format"
responses:
"200":
description: "successful operation"
content:
application/json:
schema:
$ref: '#/components/schemas/serverresponsestore'
$ref: "#/components/schemas/serverresponsestore"
"500":
description: "Server Internal ERROR"
content:
application/json:
schema:
$ref: '#/components/schemas/internalerror'
$ref: "#/components/schemas/internalerror"
security: [] # no authentication
/{tokenToRead}/{tokenToWrite}:
@ -83,9 +104,9 @@ paths:
type: "string"
examples:
GoodId:
value: 'f9e48fc9-da3d-aa39-1ab5-0641b0a0f59a'
value: "f9e48fc9-da3d-aa39-1ab5-0641b0a0f59a"
WronId:
value: 'not the good id'
value: "not the good id"
- name: "tokenToWrite"
in: "path"
required: true
@ -93,75 +114,92 @@ paths:
type: "string"
examples:
GoodId:
value: 'f9e48fc9-da3d-aa39-1ab5-0641b0a0f59a'
value: "f9e48fc9-da3d-aa39-1ab5-0641b0a0f59a"
WronId:
value: 'not the good id'
value: "not the good id"
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/diagrammestructure'
$ref: "#/components/schemas/diagramstructure"
examples:
JsonOK:
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}}}]
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'
value: "This is not JSON format"
responses:
"200":
description: "successful operation"
content:
application/json:
schema:
$ref: '#/components/schemas/serverresponsestore'
$ref: "#/components/schemas/serverresponsestore"
"400":
description: "probleme with body content JSON structure"
content:
application/json:
schema:
$ref: '#/components/schemas/internalerror'
$ref: "#/components/schemas/internalerror"
"500":
description: "Server Internal ERROR"
content:
application/json:
schema:
$ref: '#/components/schemas/internalerror'
$ref: "#/components/schemas/internalerror"
security: [] # no authentication
/get/{diagramID}:
get:
tags:
- "manage"
summary: "return JSON Object"
summary: "to get a draft document (json object)"
parameters:
- name: "diagramID"
in: "path"
description: "diagramme ID"
description: "diagram ID"
required: true
schema:
type: "string"
examples:
GoodId:
value: 'f9e48fc9-da3d-aa39-1ab5-0641b0a0f59a'
value: "f9e48fc9-da3d-aa39-1ab5-0641b0a0f59a"
WronId:
value: 'not the good id'
value: "not the good id"
RunDir:
value: '../f9e48fc9-da3d-aa39-1ab5-0641b0a0f59a'
value: "../f9e48fc9-da3d-aa39-1ab5-0641b0a0f59a"
responses:
"200":
description: "successful operation"
content:
application/json:
schema:
$ref: '#/components/schemas/diagrammestructure'
$ref: "#/components/schemas/diagramstructure"
"500":
description: "Server Internal ERROR"
content:
application/json:
schema:
$ref: '#/components/schemas/internalerror'
$ref: "#/components/schemas/internalerror"
security: [] # no authentication