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

View File

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