-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathopenapi.yml
382 lines (371 loc) · 9.72 KB
/
openapi.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
openapi: 3.0.0
info:
title: Mermaid Chart
description: |
These are the subset of MermaidChart APIs that's required to create plugins to display diagrams for users.
User authentication SHOULD be done using OAuth, with the PKCE flow.
The clientID and redirectURL should be registered by submitting a request to the MermaidChart team.
version: 0.1.0
tags:
- name: user
description: User details
- name: project
description: Project details
- name: document
description: Document details
servers:
- url: https://mermaidchart.com
- url: https://stage.mermaidchart.com
security:
- mermaidchart_auth:
- read
- bearer_auth: []
components:
schemas:
User:
type: object
properties:
fullName:
type: string
emailAddress:
type: string
required:
- fullName
- emailAddress
Project:
type: object
properties:
id:
type: string
title:
type: string
required:
- id
- title
Document:
type: object
description: |
MermaidChart document that may contain a diagram.
properties:
projectID:
type: string
title:
type: string
required:
- documentID
- projectID
- title
DiagramDocument:
type: object
description: |
MermaidChart diagram document, without any Document metadata.
properties:
documentID:
description: |
The id of the document that this diagram is linked to.
type: string
format: uuid
major:
type: integer
minor:
type: integer
id:
type: string
format: uuid
description: |
The id of this diagram, required for `setDocument()`.
code:
type: string
description: |
The Mermaid
[`application/vnd.mermaid`](https://www.iana.org/assignments/media-types/application/vnd.mermaid)
code for this diagram.
required:
- documentID
- id
MCDocument:
description: |
MermaidChart diagram document.
allOf:
- $ref: "#/components/schemas/Document"
- $ref: "#/components/schemas/DiagramDocument"
securitySchemes:
bearer_auth:
type: http
scheme: bearer
bearerFormat: JWT
mermaidchart_auth:
type: oauth2
flows:
authorizationCode:
authorizationUrl: /oauth/authorize
tokenUrl: /oauth/token
scopes:
read: Read data
paths:
/rest-api/users/me:
get:
tags:
- user
summary: Get details of the user
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/User'
/rest-api/projects:
get:
tags:
- project
summary: Get projects for the user
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Project'
/rest-api/projects/{projectID}/documents:
get:
tags:
- project
summary: Get documents for a project
parameters:
- name: projectID
in: path
required: true
description: The ID of the project to get documents for
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/MCDocument'
post:
tags:
- project
summary: Add a new document to the project.
operationId: createDocument
parameters:
- name: projectID
in: path
required: true
description: The ID of the project to add a document to.
schema:
type: string
requestBody:
description: Currently unused, as long as it's not a form.
required: true
content:
application/json:
schema:
type: object
responses:
'200':
description: |
The newly created diagram document.
content:
application/json:
schema:
$ref: '#/components/schemas/MCDocument'
/app/projects/{projectID}/diagrams/{documentID}/version/{version}:
get:
tags:
- document
summary: Get details for a document
parameters:
- name: projectID
in: path
required: true
description: The ID of the project to get diagram data for
schema:
type: string
- name: documentID
in: path
required: true
description: The ID of the document to get diagram data for
schema:
type: string
- name: version
in: path
required: true
description: The version of the document to get diagram data for
schema:
type: string
example: v0.1
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/MCDocument'
/rest-api/documents/{documentID}:
get:
tags:
- document
summary: Gets the given diagram
operationId: getDocument
parameters:
- name: documentID
in: path
required: true
description: The ID of the document to get diagram data for
schema:
type: string
- name: version
in: query
required: false
description: |
The version of the document to get diagram data for.
If not set, defaults to the highest version.
schema:
type: string
example: v0.1
security:
- mermaidchart_auth:
- read
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/MCDocument'
'404':
description: File Not Found
put:
tags:
- document
summary: Update the given document.
operationId: setDocument
parameters:
- name: documentID
in: path
required: true
description: The ID of the document to update.
schema:
type: string
requestBody:
description: Document and diagram settings to update.
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/MCDocument'
security:
- mermaidchart_auth: []
responses:
'200':
description: |
Update status.
content:
application/json:
schema:
type: object
# TODO: update this once MC-1060 is fixed.
# properties:
# result:
# type: string
# enum:
# - ok
# - failed
delete:
tags:
- document
summary: Delete the given document.
operationId: deleteDocument
parameters:
- name: documentID
in: path
required: true
description: The ID of the document to delete.
schema:
type: string
security:
- mermaidchart_auth: []
responses:
'200':
description: The deleted document.
content:
application/json:
schema:
# currently only returns the document, no diagram data!!!!
$ref: '#/components/schemas/Document'
/raw/{documentID}:
get:
tags:
- document
summary: Get raw diagram data in SVG or PNG format
parameters:
- name: documentID
in: path
required: true
description: The ID of the document to get raw data for
schema:
type: string
- name: version
in: query
required: true
description: The version of the document to get raw data for
schema:
type: string
example: v0.1
- name: theme
in: query
required: true
description: The theme to use for the raw data
schema:
type: string
enum:
- light
- dark
- name: format
in: query
required: true
description: The format of the raw data to return
schema:
type: string
enum:
- svg
- png
responses:
'200':
description: OK
/app/projects/{projectID}/diagrams/{documentID}/version/{version}/edit:
get:
tags:
- document
summary: Edior URL to edit the diagram in the browser.
parameters:
- name: projectID
in: path
required: true
description: The ID of the project to get diagram data for
schema:
type: string
- name: documentID
in: path
required: true
description: The ID of the document to get diagram data for
schema:
type: string
- name: version
in: path
required: true
description: The version of the document to get diagram data for
schema:
type: string
example: v0.1
responses:
'200':
description: OK