-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenapi.yaml
More file actions
776 lines (742 loc) · 21.3 KB
/
Copy pathopenapi.yaml
File metadata and controls
776 lines (742 loc) · 21.3 KB
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
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
openapi: 3.1.0
info:
title: OPF Service API Reference
version: "1.0.0"
description: |
Reference REST API shape for downstream services that parse, validate, convert, generate, or render presentations with OPF.
OPF (Open Presentation Format) is the JSON contract; schema URL: `https://openpresentation.org/schema/opf/v1`.
OpenPresentation does not host this API. Implementers may use this contract as a starting point for their own hosted services, internal tools, or self-hosted deployments.
**Authentication:** Send `Authorization: Bearer <token>` on authenticated requests. `POST /v1/preview` is shown as an optional unauthenticated preview endpoint for services that choose to expose one.
contact:
name: OpenPresentation
url: https://openpresentation.org
license:
name: MIT
url: https://opensource.org/licenses/MIT
servers:
- url: https://api.example.com
description: Downstream service endpoint
- url: http://localhost:3000/api
description: Example local development endpoint
tags:
- name: playground
description: Optional unauthenticated OPF preview helpers
- name: validate
description: OPF schema validation
- name: parse
description: Upload and inspect .pptx files
- name: convert
description: PPTX to OPF
- name: generate
description: OPF to PPTX and exports
- name: render
description: PPTX to web or raster/vector previews
security:
- bearerAuth: []
paths:
/v1/validate:
post:
operationId: validateOpf
tags: [validate]
summary: Validate OPF JSON
description: Validates an OPF document against the schema. Returns structured errors and warnings.
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/OpfDocument"
examples:
minimal:
summary: Minimal OPF
value:
$schema: "https://openpresentation.org/schema/opf/v1"
meta:
title: Example
design:
theme: corporate-minimal
slides:
- id: s1
layout: title-slide
elements:
- id: h1
type: text
content:
text: Hello
responses:
"200":
description: Validation result
content:
application/json:
schema:
$ref: "#/components/schemas/ValidateResponse"
"400":
description: Bad request (wrong Content-Type or invalid JSON)
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
"401":
$ref: "#/components/responses/Unauthorized"
"500":
$ref: "#/components/responses/InternalError"
/v1/preview:
post:
operationId: previewOpf
tags: [playground]
summary: OPF preview summary (anonymous)
description: |
Validates OPF JSON (body max 256 KB) for live preview without an API key.
Per-IP limits: 30 requests/minute and 500/hour (separate fixed windows).
`format=web` returns `textRuns` per slide (similar to `/v1/render?format=web`).
`format=svg|png` returns `svg: null` per slide with an `export` stub until the engine ships.
security: []
parameters:
- name: format
in: query
required: false
schema:
type: string
enum: [web, svg, png]
default: svg
description: Preview representation
- name: slides
in: query
required: false
schema:
type: string
description: Comma-separated 1-based slide numbers (subset of slides to return)
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/OpfDocument"
responses:
"200":
description: Valid OPF — preview payload (`slides` shape depends on `format`)
content:
application/json:
schema:
$ref: "#/components/schemas/PreviewResponse"
"400":
description: Bad request (wrong Content-Type, invalid JSON, bad `format`/`slides`)
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
"413":
description: Request body larger than 256 KB
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
"422":
description: OPF failed validation
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
"429":
description: Rate limit exceeded
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
"500":
$ref: "#/components/responses/InternalError"
/v1/parse:
post:
operationId: parsePptx
tags: [parse]
summary: Parse a .pptx upload
description: Upload a `.pptx` file and receive a `parseId` for follow-up GET endpoints.
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
required: [file]
properties:
file:
type: string
format: binary
description: PowerPoint file (.pptx)
responses:
"200":
description: Parse job created
content:
application/json:
schema:
$ref: "#/components/schemas/ParseAcceptedResponse"
"400":
description: Missing file or not a .pptx
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
"401":
$ref: "#/components/responses/Unauthorized"
"500":
$ref: "#/components/responses/InternalError"
/v1/convert:
post:
operationId: convertPptxToOpf
tags: [convert]
summary: Convert .pptx to OPF JSON
description: Reverse of `/v1/generate` — imports an existing deck as OPF.
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
required: [file]
properties:
file:
type: string
format: binary
responses:
"200":
description: OPF document
content:
application/json:
schema:
$ref: "#/components/schemas/OpfDocument"
"400":
description: Missing file or not a .pptx
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
"401":
$ref: "#/components/responses/Unauthorized"
"500":
$ref: "#/components/responses/InternalError"
/v1/generate:
post:
operationId: generateFromOpf
tags: [generate]
summary: Generate output from OPF
description: |
Validates OPF, then enqueues or returns generation status. Query `format` selects the target
(`pptx`, `pdf`, `png`, `svg`). The PPTX engine may return `202 Accepted` while work is stubbed or async.
parameters:
- name: format
in: query
required: false
schema:
type: string
enum: [pptx, pdf, png, svg]
default: pptx
description: Output format
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/OpfDocument"
responses:
"202":
description: Accepted — generation stub or async pipeline
content:
application/json:
schema:
$ref: "#/components/schemas/GenerateAcceptedResponse"
"400":
description: Invalid format or wrong Content-Type
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
"401":
$ref: "#/components/responses/Unauthorized"
"422":
description: OPF failed validation
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
"500":
$ref: "#/components/responses/InternalError"
/v1/render:
post:
operationId: renderPptx
tags: [render]
summary: Render a .pptx for web or export
description: |
Parses upload, stores result, and returns slide data (`format=web`) or an acceptance payload
for raster/vector engines (`svg`, `png`).
parameters:
- name: format
in: query
required: false
schema:
type: string
enum: [web, svg, png]
default: web
- name: slides
in: query
required: false
schema:
type: string
description: Comma-separated 1-based slide numbers (e.g. `1,3,5`)
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
required: [file]
properties:
file:
type: string
format: binary
responses:
"200":
description: Web slide payload
content:
application/json:
schema:
$ref: "#/components/schemas/RenderWebResponse"
"202":
description: Export pipeline not ready — stub response
content:
application/json:
schema:
$ref: "#/components/schemas/RenderAcceptedResponse"
"400":
description: Invalid format, slides, or missing file
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
"401":
$ref: "#/components/responses/Unauthorized"
"500":
$ref: "#/components/responses/InternalError"
/v1/parse/{parseId}/metadata:
get:
operationId: getParseMetadata
tags: [parse]
summary: Get document metadata for a parse
parameters:
- $ref: "#/components/parameters/ParseId"
responses:
"200":
description: Metadata buckets (core, app, custom)
content:
application/json:
schema:
$ref: "#/components/schemas/ParseMetadataResponse"
"400":
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
description: Parse expired or unknown
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/v1/parse/{parseId}/slides/{index}:
get:
operationId: getParseSlide
tags: [parse]
summary: Get one slide by index
parameters:
- $ref: "#/components/parameters/ParseId"
- name: index
in: path
required: true
schema:
type: integer
minimum: 0
description: Zero-based slide index
responses:
"200":
description: Slide payload
content:
application/json:
schema:
$ref: "#/components/schemas/ParseSlideResponse"
"400":
description: Invalid index
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
description: Parse or slide not found
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/v1/parse/{parseId}/text:
get:
operationId: getParseAllText
tags: [parse]
summary: Get flattened text for all slides
parameters:
- $ref: "#/components/parameters/ParseId"
responses:
"200":
description: Text per slide
content:
application/json:
schema:
$ref: "#/components/schemas/ParseTextResponse"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
description: Parse expired or unknown
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
description: Service-defined bearer token.
parameters:
ParseId:
name: parseId
in: path
required: true
schema:
type: string
description: Identifier returned by `POST /v1/parse` or `/v1/render`
responses:
Unauthorized:
description: Missing or invalid credentials
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
InternalError:
description: Server error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
schemas:
ErrorResponse:
type: object
required: [error]
properties:
error:
$ref: "#/components/schemas/ApiError"
ApiError:
type: object
required: [code, message, requestId]
properties:
code:
type: string
enum:
- invalid_request
- unauthorized
- forbidden
- not_found
- rate_limited
- idempotency_conflict
- internal_error
message:
type: string
details:
type: object
additionalProperties: true
description: Optional structured details for the error code.
requestId:
type: string
OpfDocument:
type: object
description: OPF v1 document. See https://openpresentation.org/schema/opf/v1 for the canonical schema.
additionalProperties: true
properties:
$schema:
type: string
const: "https://openpresentation.org/schema/opf/v1"
meta:
type: object
additionalProperties: true
design:
type: object
additionalProperties: true
slides:
type: array
items:
type: object
additionalProperties: true
ValidationIssue:
type: object
required: [path, message]
properties:
path:
type: string
message:
type: string
ValidateResponse:
type: object
required: [valid, errors, warnings]
properties:
valid:
type: boolean
errors:
type: array
items:
$ref: "#/components/schemas/ValidationIssue"
warnings:
type: array
items:
$ref: "#/components/schemas/ValidationIssue"
PreviewWebSlide:
type: object
required: [index, slideNumber, id, layout, hidden, textRuns, speakerNotes]
properties:
index:
type: integer
minimum: 0
slideNumber:
type: integer
minimum: 1
id:
type: string
layout:
type: string
hidden:
type: boolean
textRuns:
type: array
items:
type: object
additionalProperties: true
speakerNotes:
type: string
PreviewRasterSlide:
type: object
required: [index, slideNumber, id, layout, svg]
properties:
index:
type: integer
minimum: 0
slideNumber:
type: integer
minimum: 1
id:
type: string
layout:
type: string
svg:
type: string
nullable: true
PreviewExportStub:
type: object
required: [status, message]
properties:
status:
type: string
example: accepted
message:
type: string
PreviewResponse:
type: object
required: [status, format, slideCount, dimensions, meta, design, slides, warnings]
properties:
status:
type: string
example: ok
format:
type: string
enum: [web, svg, png]
slideCount:
type: integer
minimum: 0
dimensions:
type: object
required: [widthPx, heightPx, preset]
properties:
widthPx:
type: integer
heightPx:
type: integer
preset:
type: string
meta:
type: object
required: [title]
properties:
title:
type: string
filename:
type: string
description: Suggested download filename including extension (resolved from meta.filename or title).
subtitle:
type: string
design:
type: object
properties:
theme:
type: string
export:
$ref: "#/components/schemas/PreviewExportStub"
slides:
type: array
items:
oneOf:
- $ref: "#/components/schemas/PreviewWebSlide"
- $ref: "#/components/schemas/PreviewRasterSlide"
warnings:
type: array
items:
$ref: "#/components/schemas/ValidationIssue"
ParseAcceptedResponse:
type: object
required: [parseId, slideCount, width, height]
properties:
parseId:
type: string
slideCount:
type: integer
width:
type: integer
description: Slide width in EMUs
height:
type: integer
description: Slide height in EMUs
GenerateAcceptedResponse:
type: object
required: [status, message, format, slideCount, validationWarnings]
properties:
status:
type: string
example: accepted
message:
type: string
format:
type: string
filename:
type: string
description: Suggested output filename including extension (from meta.filename or title slug).
slideCount:
type: integer
validationWarnings:
type: array
items:
type: string
TextRun:
type: object
additionalProperties: true
properties:
text:
type: string
bold:
type: boolean
italic:
type: boolean
underline:
type: boolean
fontSize:
type: number
fontFamily:
type: string
color:
type: string
alignment:
type: string
RenderWebResponse:
type: object
required: [parseId, format, dimensions, slideCount, slides, metadata, viewerUrl]
properties:
parseId:
type: string
format:
type: string
enum: [web]
dimensions:
type: object
additionalProperties: true
slideCount:
type: integer
slides:
type: array
items:
type: object
additionalProperties: true
metadata:
type: object
additionalProperties: true
viewerUrl:
type: string
description: Relative URL to the web viewer
RenderAcceptedResponse:
type: object
required: [status, message, parseId, format, slideCount, viewerUrl]
properties:
status:
type: string
example: accepted
message:
type: string
parseId:
type: string
format:
type: string
slideCount:
type: integer
viewerUrl:
type: string
ParseMetadataResponse:
type: object
required: [parseId, core, app, custom]
properties:
parseId:
type: string
core:
type: object
additionalProperties: true
app:
type: object
additionalProperties: true
custom:
type: object
additionalProperties: true
ParseSlideResponse:
type: object
required: [index, slideNumber, hidden, width, height, textRuns]
properties:
index:
type: integer
slideNumber:
type: integer
hidden:
type: boolean
width:
type: integer
height:
type: integer
textRuns:
type: array
items:
$ref: "#/components/schemas/TextRun"
speakerNotes:
type: string
ParseTextResponse:
type: object
required: [parseId, slides]
properties:
parseId:
type: string
slides:
type: array
items:
type: object
additionalProperties: true