@nasebanal/cli 0.12.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1587 @@
1
+ openapi: 3.0.3
2
+ info:
3
+ title: NASEBANAL Specs API
4
+ description: "Backend of the own API specs on the NASEBANAL API Specs site. A person on the Free plan keeps up to 20 specs of their own; an organization on the Enterprise plan keeps up to 100. Either uploads OpenAPI documents, keeps their versions and reads them in the same reference view as the NASEBANAL APIs. A spec belongs to exactly one owner, the person or the organization: every request names it in `X-Active-Organization-Id` (an organization id, or `personal`), and only the owner (for an organization, its members) can see or change its specs. Authenticates users via Auth0 JWT and Personal Access Tokens (PAT) and integrates with the Account API (membership and the Enterprise subscription). Every response is wrapped as `{ success, data }` (or `{ success: false, error }`)."
5
+ version: 1.5.0
6
+ contact:
7
+ name: NASEBANAL
8
+ url: https://www.nasebanal.com
9
+ servers:
10
+ - url: http://localhost:8792
11
+ description: Local dev (wrangler dev)
12
+ - url: https://api.specs.nasebanal.com
13
+ description: Production
14
+ security:
15
+ - BearerAuth: []
16
+ tags:
17
+ - name: Health
18
+ description: Health check endpoints
19
+ - name: Access
20
+ description: Whether the active owner (the person or the organization) may use the feature
21
+ - name: Groups
22
+ description: "Groups: the boxes specs are filed in. A group is created first, then specs are registered inside it"
23
+ - name: Repositories
24
+ description: "Repositories: where the owner's APIs are implemented, and the parent of their specs. A monorepo is one repository with several specs. Registered by name from a pipeline or a screen; the id it returns is what the pipeline passes on."
25
+ - name: Specs
26
+ description: An owner's named OpenAPI documents, each filed in one of the owner's groups
27
+ - name: Versions
28
+ description: Immutable versions of a spec, one per upload
29
+ - name: Docs
30
+ description: "The description document of a spec: one markdown page the catalog renders next to the API reference"
31
+ - name: Public
32
+ description: Read-only links to the latest version of a spec for the people who consume the API
33
+ paths:
34
+ /api/v1/health:
35
+ get:
36
+ tags:
37
+ - Health
38
+ operationId: getHealth
39
+ summary: Health check
40
+ description: Returns the health status of the API.
41
+ security: []
42
+ responses:
43
+ "200":
44
+ description: API is healthy
45
+ content:
46
+ application/json:
47
+ schema:
48
+ type: object
49
+ required:
50
+ - success
51
+ - data
52
+ properties:
53
+ success:
54
+ type: boolean
55
+ enum:
56
+ - true
57
+ data:
58
+ type: object
59
+ required:
60
+ - status
61
+ - timestamp
62
+ properties:
63
+ status:
64
+ type: string
65
+ example: ok
66
+ timestamp:
67
+ type: string
68
+ format: date-time
69
+ examples:
70
+ valid:
71
+ value:
72
+ success: true
73
+ data:
74
+ status: ok
75
+ timestamp: 2026-05-14T12:00:00Z
76
+ /api/v1/access:
77
+ get:
78
+ tags:
79
+ - Access
80
+ operationId: getAccess
81
+ summary: Get access for the active owner
82
+ description: "Tells a screen what to show: the full feature, an upgrade notice, or nothing to do here. A person (`personal`) is always allowed, with `max_specs` 20; an organization is allowed with `max_specs` 100 when the caller is a member and it is on the Enterprise plan, and otherwise answers `allowed: false` with `max_specs` 0. Never refuses for a missing plan - that is what `allowed: false` is for - so the screen can explain instead of showing an error. The other endpoints enforce the plan again and answer `403 ENTERPRISE_REQUIRED` for an organization."
83
+ parameters:
84
+ - $ref: "#/components/parameters/ActiveOrganization"
85
+ responses:
86
+ "200":
87
+ description: Access
88
+ content:
89
+ application/json:
90
+ schema:
91
+ type: object
92
+ required:
93
+ - success
94
+ - data
95
+ properties:
96
+ success:
97
+ type: boolean
98
+ enum:
99
+ - true
100
+ data:
101
+ $ref: "#/components/schemas/Access"
102
+ "400":
103
+ $ref: "#/components/responses/ValidationError"
104
+ "401":
105
+ $ref: "#/components/responses/Unauthorized"
106
+ "403":
107
+ $ref: "#/components/responses/Forbidden"
108
+ /api/v1/groups:
109
+ parameters:
110
+ - $ref: "#/components/parameters/ActiveOrganization"
111
+ get:
112
+ tags:
113
+ - Groups
114
+ operationId: listGroups
115
+ summary: List groups
116
+ description: The owner's groups in order (oldest first), each with the number of specs in it.
117
+ responses:
118
+ "200":
119
+ description: Groups
120
+ content:
121
+ application/json:
122
+ schema:
123
+ type: object
124
+ required:
125
+ - success
126
+ - data
127
+ properties:
128
+ success:
129
+ type: boolean
130
+ enum:
131
+ - true
132
+ data:
133
+ type: object
134
+ required:
135
+ - data
136
+ - total
137
+ - limit
138
+ properties:
139
+ data:
140
+ type: array
141
+ items:
142
+ $ref: "#/components/schemas/Group"
143
+ total:
144
+ type: integer
145
+ limit:
146
+ type: integer
147
+ description: Maximum groups for the owner
148
+ "400":
149
+ $ref: "#/components/responses/ValidationError"
150
+ "401":
151
+ $ref: "#/components/responses/Unauthorized"
152
+ "403":
153
+ $ref: "#/components/responses/Forbidden"
154
+ post:
155
+ tags:
156
+ - Groups
157
+ operationId: createGroup
158
+ summary: Create a group
159
+ description: Creates a group from a name. The name is unique among the owner's groups, ignoring case. Beyond the maximum number of groups an owner may hold the answer is `409 LIMIT_REACHED`.
160
+ requestBody:
161
+ required: true
162
+ content:
163
+ application/json:
164
+ schema:
165
+ $ref: "#/components/schemas/GroupCreate"
166
+ responses:
167
+ "201":
168
+ description: Created group
169
+ content:
170
+ application/json:
171
+ schema:
172
+ type: object
173
+ required:
174
+ - success
175
+ - data
176
+ properties:
177
+ success:
178
+ type: boolean
179
+ enum:
180
+ - true
181
+ data:
182
+ $ref: "#/components/schemas/Group"
183
+ "400":
184
+ $ref: "#/components/responses/ValidationError"
185
+ "401":
186
+ $ref: "#/components/responses/Unauthorized"
187
+ "403":
188
+ $ref: "#/components/responses/Forbidden"
189
+ "409":
190
+ $ref: "#/components/responses/Conflict"
191
+ /api/v1/groups/{id}:
192
+ parameters:
193
+ - $ref: "#/components/parameters/GroupId"
194
+ - $ref: "#/components/parameters/ActiveOrganization"
195
+ patch:
196
+ tags:
197
+ - Groups
198
+ operationId: updateGroup
199
+ summary: Update a group
200
+ description: Renames the group.
201
+ requestBody:
202
+ required: true
203
+ content:
204
+ application/json:
205
+ schema:
206
+ $ref: "#/components/schemas/GroupUpdate"
207
+ responses:
208
+ "200":
209
+ description: Updated group
210
+ content:
211
+ application/json:
212
+ schema:
213
+ type: object
214
+ required:
215
+ - success
216
+ - data
217
+ properties:
218
+ success:
219
+ type: boolean
220
+ enum:
221
+ - true
222
+ data:
223
+ $ref: "#/components/schemas/Group"
224
+ "400":
225
+ $ref: "#/components/responses/ValidationError"
226
+ "401":
227
+ $ref: "#/components/responses/Unauthorized"
228
+ "403":
229
+ $ref: "#/components/responses/Forbidden"
230
+ "404":
231
+ $ref: "#/components/responses/NotFound"
232
+ "409":
233
+ $ref: "#/components/responses/Conflict"
234
+ delete:
235
+ tags:
236
+ - Groups
237
+ operationId: deleteGroup
238
+ summary: Delete a group
239
+ description: Deletes an empty group. A group that still holds specs is refused with `409 GROUP_NOT_EMPTY` (delete the specs or move them to another group first).
240
+ responses:
241
+ "204":
242
+ description: Deleted
243
+ "401":
244
+ $ref: "#/components/responses/Unauthorized"
245
+ "403":
246
+ $ref: "#/components/responses/Forbidden"
247
+ "404":
248
+ $ref: "#/components/responses/NotFound"
249
+ "409":
250
+ $ref: "#/components/responses/Conflict"
251
+ /api/v1/repositories:
252
+ parameters:
253
+ - $ref: "#/components/parameters/ActiveOrganization"
254
+ get:
255
+ tags:
256
+ - Repositories
257
+ operationId: listRepositories
258
+ summary: List repositories
259
+ description: The owner's repositories, by provider then name, each with the number of specs tied to it.
260
+ responses:
261
+ "200":
262
+ description: Repositories
263
+ content:
264
+ application/json:
265
+ schema:
266
+ type: object
267
+ required:
268
+ - success
269
+ - data
270
+ properties:
271
+ success:
272
+ type: boolean
273
+ enum:
274
+ - true
275
+ data:
276
+ type: object
277
+ required:
278
+ - data
279
+ - total
280
+ - limit
281
+ properties:
282
+ data:
283
+ type: array
284
+ items:
285
+ $ref: "#/components/schemas/Repository"
286
+ total:
287
+ type: integer
288
+ limit:
289
+ type: integer
290
+ description: Maximum repositories for the owner
291
+ "400":
292
+ $ref: "#/components/responses/ValidationError"
293
+ "401":
294
+ $ref: "#/components/responses/Unauthorized"
295
+ "403":
296
+ $ref: "#/components/responses/Forbidden"
297
+ put:
298
+ tags:
299
+ - Repositories
300
+ operationId: upsertRepository
301
+ summary: Register a repository (idempotent)
302
+ description: "Registers a repository by `provider`, `name` and `component` (the owner's own name for a part of it; empty = the whole repository) and returns it: ONE id says which repository and which component. `201` when it was created, `200` when it was already registered (the same id, nothing changed; the name keeps the casing it was first written with). Safe to repeat on every pipeline run. Beyond the maximum number of repositories an owner may hold the answer is `409 LIMIT_REACHED`."
303
+ requestBody:
304
+ required: true
305
+ content:
306
+ application/json:
307
+ schema:
308
+ $ref: "#/components/schemas/RepositoryUpsert"
309
+ responses:
310
+ "200":
311
+ description: Repository that was already registered
312
+ content:
313
+ application/json:
314
+ schema:
315
+ type: object
316
+ required:
317
+ - success
318
+ - data
319
+ properties:
320
+ success:
321
+ type: boolean
322
+ enum:
323
+ - true
324
+ data:
325
+ $ref: "#/components/schemas/Repository"
326
+ "201":
327
+ description: Repository that was created
328
+ content:
329
+ application/json:
330
+ schema:
331
+ type: object
332
+ required:
333
+ - success
334
+ - data
335
+ properties:
336
+ success:
337
+ type: boolean
338
+ enum:
339
+ - true
340
+ data:
341
+ $ref: "#/components/schemas/Repository"
342
+ "400":
343
+ $ref: "#/components/responses/ValidationError"
344
+ "401":
345
+ $ref: "#/components/responses/Unauthorized"
346
+ "403":
347
+ $ref: "#/components/responses/Forbidden"
348
+ "409":
349
+ $ref: "#/components/responses/Conflict"
350
+ /api/v1/repositories/{id}:
351
+ parameters:
352
+ - $ref: "#/components/parameters/RepositoryId"
353
+ - $ref: "#/components/parameters/ActiveOrganization"
354
+ get:
355
+ tags:
356
+ - Repositories
357
+ operationId: getRepository
358
+ summary: Get a repository
359
+ description: One of the owner's repositories, with the number of specs tied to it. Another owner's repository is a 404.
360
+ responses:
361
+ "200":
362
+ description: Repository
363
+ content:
364
+ application/json:
365
+ schema:
366
+ type: object
367
+ required:
368
+ - success
369
+ - data
370
+ properties:
371
+ success:
372
+ type: boolean
373
+ enum:
374
+ - true
375
+ data:
376
+ $ref: "#/components/schemas/Repository"
377
+ "401":
378
+ $ref: "#/components/responses/Unauthorized"
379
+ "403":
380
+ $ref: "#/components/responses/Forbidden"
381
+ "404":
382
+ $ref: "#/components/responses/NotFound"
383
+ patch:
384
+ tags:
385
+ - Repositories
386
+ operationId: updateRepository
387
+ summary: Update a repository
388
+ description: "Renames a repository, changes its provider or renames its component (`component: null` or an empty string makes it the repository as a whole); a repository renamed on the git host keeps its id here. A key (provider, name, component) that another repository of the owner already has is `409 NAME_TAKEN`."
389
+ requestBody:
390
+ required: true
391
+ content:
392
+ application/json:
393
+ schema:
394
+ $ref: "#/components/schemas/RepositoryUpdate"
395
+ responses:
396
+ "200":
397
+ description: Updated repository
398
+ content:
399
+ application/json:
400
+ schema:
401
+ type: object
402
+ required:
403
+ - success
404
+ - data
405
+ properties:
406
+ success:
407
+ type: boolean
408
+ enum:
409
+ - true
410
+ data:
411
+ $ref: "#/components/schemas/Repository"
412
+ "400":
413
+ $ref: "#/components/responses/ValidationError"
414
+ "401":
415
+ $ref: "#/components/responses/Unauthorized"
416
+ "403":
417
+ $ref: "#/components/responses/Forbidden"
418
+ "404":
419
+ $ref: "#/components/responses/NotFound"
420
+ "409":
421
+ $ref: "#/components/responses/Conflict"
422
+ delete:
423
+ tags:
424
+ - Repositories
425
+ operationId: deleteRepository
426
+ summary: Delete a repository
427
+ description: "Deletes the repository. The specs tied to it are not deleted: they simply have no repository any more."
428
+ responses:
429
+ "204":
430
+ description: Deleted
431
+ "401":
432
+ $ref: "#/components/responses/Unauthorized"
433
+ "403":
434
+ $ref: "#/components/responses/Forbidden"
435
+ "404":
436
+ $ref: "#/components/responses/NotFound"
437
+ /api/v1/specs:
438
+ get:
439
+ tags:
440
+ - Specs
441
+ operationId: listSpecs
442
+ summary: List specs
443
+ description: The owner's specs, most recently updated first, each with its latest version.
444
+ parameters:
445
+ - $ref: "#/components/parameters/ActiveOrganization"
446
+ responses:
447
+ "200":
448
+ description: Specs
449
+ content:
450
+ application/json:
451
+ schema:
452
+ type: object
453
+ required:
454
+ - success
455
+ - data
456
+ properties:
457
+ success:
458
+ type: boolean
459
+ enum:
460
+ - true
461
+ data:
462
+ type: object
463
+ required:
464
+ - data
465
+ - total
466
+ - limit
467
+ properties:
468
+ data:
469
+ type: array
470
+ items:
471
+ $ref: "#/components/schemas/Spec"
472
+ total:
473
+ type: integer
474
+ limit:
475
+ type: integer
476
+ description: Maximum specs for the owner (20 for a person, 100 for an organization)
477
+ "400":
478
+ $ref: "#/components/responses/ValidationError"
479
+ "401":
480
+ $ref: "#/components/responses/Unauthorized"
481
+ "403":
482
+ $ref: "#/components/responses/Forbidden"
483
+ post:
484
+ tags:
485
+ - Specs
486
+ operationId: createSpec
487
+ summary: Create a spec
488
+ description: Creates the spec and its first revision from the document in `content`, optionally filed in the group `group_id` (without one the spec stands on its own, so no group has to be made first). The document is validated as OpenAPI 3.x before anything is stored; one that is not is refused with `422 INVALID_SPEC` and the reasons. The spec's API version (`api_version`, for example `v1`) is the one given, else the MAJOR of the document's `info.version` (`1.8.0` is `v1`, `v2.0` is `v2`); a version with no major to read (a calendar version such as `2023-01`) needs `api_version` said, or the request is refused with `400 API_VERSION_REQUIRED`. A new major API version is a new spec. A later version of an API names its initial version (the first spec registered for the API). Send `initial_spec_id` and the new spec is filed in that spec's group and repository (they must be the same if sent too). The API version is the document's, and no spec of that API may have it already (the initial spec's own included). Versions are registered in order, so the API version must be the next one after the highest the API has (v1, v2, then v3), and to leave room for one that is not ready a placeholder of it is registered first. Refused with `404 INITIAL_NOT_FOUND`, `400 INITIAL_NOT_INITIAL`, `400 INITIAL_GROUP_MISMATCH`, `400 INITIAL_REPOSITORY_MISMATCH`, `409 INITIAL_VERSION_TAKEN` or `409 INITIAL_VERSION_NOT_NEXT`. The spec's description is the one sent, else the first paragraph of the document's `info.description`.
489
+ parameters:
490
+ - $ref: "#/components/parameters/ActiveOrganization"
491
+ requestBody:
492
+ required: true
493
+ content:
494
+ application/json:
495
+ schema:
496
+ $ref: "#/components/schemas/SpecCreate"
497
+ responses:
498
+ "201":
499
+ description: Created spec
500
+ content:
501
+ application/json:
502
+ schema:
503
+ type: object
504
+ required:
505
+ - success
506
+ - data
507
+ properties:
508
+ success:
509
+ type: boolean
510
+ enum:
511
+ - true
512
+ data:
513
+ $ref: "#/components/schemas/Spec"
514
+ "400":
515
+ $ref: "#/components/responses/ValidationError"
516
+ "401":
517
+ $ref: "#/components/responses/Unauthorized"
518
+ "403":
519
+ $ref: "#/components/responses/Forbidden"
520
+ "409":
521
+ $ref: "#/components/responses/Conflict"
522
+ "413":
523
+ $ref: "#/components/responses/TooLarge"
524
+ "422":
525
+ $ref: "#/components/responses/InvalidSpec"
526
+ /api/v1/specs/{id}:
527
+ parameters:
528
+ - $ref: "#/components/parameters/SpecId"
529
+ - $ref: "#/components/parameters/ActiveOrganization"
530
+ get:
531
+ tags:
532
+ - Specs
533
+ operationId: getSpec
534
+ summary: Get a spec
535
+ description: One spec with its latest version.
536
+ responses:
537
+ "200":
538
+ description: Spec
539
+ content:
540
+ application/json:
541
+ schema:
542
+ type: object
543
+ required:
544
+ - success
545
+ - data
546
+ properties:
547
+ success:
548
+ type: boolean
549
+ enum:
550
+ - true
551
+ data:
552
+ $ref: "#/components/schemas/Spec"
553
+ "401":
554
+ $ref: "#/components/responses/Unauthorized"
555
+ "403":
556
+ $ref: "#/components/responses/Forbidden"
557
+ "404":
558
+ $ref: "#/components/responses/NotFound"
559
+ patch:
560
+ tags:
561
+ - Specs
562
+ operationId: updateSpec
563
+ summary: Update a spec
564
+ description: Renames the spec, changes its description or moves it to another group, or out of its group (`group_id`, `null` for none). Send only the fields to change, which include the quality settings of the spec (`public_badge`, `report_access`, `rotate_quality_public_id`). The API version is fixed when the spec is created, so a different `api_version` is refused with `400` (register the other API version as a new spec). The document itself is never edited - upload a new revision instead. `initial_spec_id` makes the spec a later version of an API (the same rules and refusals as when creating) or, with `null`, an API of its own. The specs of one API keep the group and repository of its initial version, so moving one is refused with `409 VERSION_FAMILY_MEMBER` unless it leaves the API in the same request; an initial version that has later versions cannot become a later version (`409 INITIAL_HAS_VERSIONS`).
565
+ requestBody:
566
+ required: true
567
+ content:
568
+ application/json:
569
+ schema:
570
+ $ref: "#/components/schemas/SpecUpdate"
571
+ responses:
572
+ "200":
573
+ description: Updated spec
574
+ content:
575
+ application/json:
576
+ schema:
577
+ type: object
578
+ required:
579
+ - success
580
+ - data
581
+ properties:
582
+ success:
583
+ type: boolean
584
+ enum:
585
+ - true
586
+ data:
587
+ $ref: "#/components/schemas/Spec"
588
+ "400":
589
+ $ref: "#/components/responses/ValidationError"
590
+ "401":
591
+ $ref: "#/components/responses/Unauthorized"
592
+ "403":
593
+ $ref: "#/components/responses/Forbidden"
594
+ "404":
595
+ $ref: "#/components/responses/NotFound"
596
+ "409":
597
+ $ref: "#/components/responses/Conflict"
598
+ delete:
599
+ tags:
600
+ - Specs
601
+ operationId: deleteSpec
602
+ summary: Delete a spec
603
+ description: Deletes the spec and every one of its versions. Cannot be undone. The initial version of an API that has later versions cannot be deleted (`409 INITIAL_HAS_VERSIONS`), so delete or detach the later versions first.
604
+ responses:
605
+ "204":
606
+ description: Deleted
607
+ "401":
608
+ $ref: "#/components/responses/Unauthorized"
609
+ "403":
610
+ $ref: "#/components/responses/Forbidden"
611
+ "404":
612
+ $ref: "#/components/responses/NotFound"
613
+ /api/v1/specs/{id}/versions:
614
+ parameters:
615
+ - $ref: "#/components/parameters/SpecId"
616
+ - $ref: "#/components/parameters/ActiveOrganization"
617
+ get:
618
+ tags:
619
+ - Versions
620
+ operationId: listSpecVersions
621
+ summary: List versions of a spec
622
+ description: Newest first. The documents are not included - read one with `getSpecVersionContent`.
623
+ responses:
624
+ "200":
625
+ description: Versions
626
+ content:
627
+ application/json:
628
+ schema:
629
+ type: object
630
+ required:
631
+ - success
632
+ - data
633
+ properties:
634
+ success:
635
+ type: boolean
636
+ enum:
637
+ - true
638
+ data:
639
+ type: object
640
+ required:
641
+ - data
642
+ - total
643
+ properties:
644
+ data:
645
+ type: array
646
+ items:
647
+ $ref: "#/components/schemas/SpecVersion"
648
+ total:
649
+ type: integer
650
+ "401":
651
+ $ref: "#/components/responses/Unauthorized"
652
+ "403":
653
+ $ref: "#/components/responses/Forbidden"
654
+ "404":
655
+ $ref: "#/components/responses/NotFound"
656
+ post:
657
+ tags:
658
+ - Versions
659
+ operationId: createSpecVersion
660
+ summary: Upload a new version
661
+ description: Adds the document in `content` as the next REVISION of the spec (the number counts up inside the spec's API version). Validated like `createSpec`. A document identical to the latest revision is refused with `409 UNCHANGED` rather than stored twice. A document whose `info.version` has another major than the spec's API version (`v1` spec, `2.0.0` document) is another API version and is refused with `409 API_VERSION_MISMATCH` (register it as a new spec). A document with no major to read is accepted, the spec's API version stands. The spec's title and description follow the new document (its `info.title` and the first paragraph of its `info.description`, none when it has none).
662
+ requestBody:
663
+ required: true
664
+ content:
665
+ application/json:
666
+ schema:
667
+ $ref: "#/components/schemas/SpecVersionCreate"
668
+ responses:
669
+ "201":
670
+ description: Created version
671
+ content:
672
+ application/json:
673
+ schema:
674
+ type: object
675
+ required:
676
+ - success
677
+ - data
678
+ properties:
679
+ success:
680
+ type: boolean
681
+ enum:
682
+ - true
683
+ data:
684
+ $ref: "#/components/schemas/SpecVersion"
685
+ "400":
686
+ $ref: "#/components/responses/ValidationError"
687
+ "401":
688
+ $ref: "#/components/responses/Unauthorized"
689
+ "403":
690
+ $ref: "#/components/responses/Forbidden"
691
+ "404":
692
+ $ref: "#/components/responses/NotFound"
693
+ "409":
694
+ $ref: "#/components/responses/Conflict"
695
+ "413":
696
+ $ref: "#/components/responses/TooLarge"
697
+ "422":
698
+ $ref: "#/components/responses/InvalidSpec"
699
+ /api/v1/specs/{id}/versions/{version}/content:
700
+ parameters:
701
+ - $ref: "#/components/parameters/SpecId"
702
+ - name: version
703
+ in: path
704
+ required: true
705
+ schema:
706
+ type: integer
707
+ minimum: 1
708
+ description: Version number, 1 for the first upload
709
+ - $ref: "#/components/parameters/ActiveOrganization"
710
+ get:
711
+ tags:
712
+ - Versions
713
+ operationId: getSpecVersionContent
714
+ summary: Read a version's document
715
+ description: The document exactly as uploaded, for the reference view and for download.
716
+ responses:
717
+ "200":
718
+ description: The OpenAPI document
719
+ content:
720
+ application/yaml:
721
+ schema:
722
+ type: string
723
+ application/json:
724
+ schema:
725
+ type: string
726
+ "401":
727
+ $ref: "#/components/responses/Unauthorized"
728
+ "403":
729
+ $ref: "#/components/responses/Forbidden"
730
+ "404":
731
+ $ref: "#/components/responses/NotFound"
732
+ /api/v1/specs/{id}/docs:
733
+ parameters:
734
+ - $ref: "#/components/parameters/SpecId"
735
+ - $ref: "#/components/parameters/ActiveOrganization"
736
+ get:
737
+ tags:
738
+ - Docs
739
+ operationId: getSpecDocs
740
+ summary: Read a spec's description document
741
+ description: The markdown exactly as uploaded. `404 NOT_FOUND` when the spec has none (`Spec.has_docs` says).
742
+ responses:
743
+ "200":
744
+ description: The markdown document
745
+ content:
746
+ text/markdown:
747
+ schema:
748
+ type: string
749
+ "401":
750
+ $ref: "#/components/responses/Unauthorized"
751
+ "403":
752
+ $ref: "#/components/responses/Forbidden"
753
+ "404":
754
+ $ref: "#/components/responses/NotFound"
755
+ put:
756
+ tags:
757
+ - Docs
758
+ operationId: putSpecDocs
759
+ summary: Write a spec's description document
760
+ description: Creates or replaces the one description document of the spec (201 when new, 200 when replaced). UTF-8 markdown, at most 200 KiB, never empty and without a NUL byte; send it as `text/markdown`. The catalog renders it next to the API reference (raw HTML in it is not rendered).
761
+ requestBody:
762
+ required: true
763
+ content:
764
+ text/markdown:
765
+ schema:
766
+ type: string
767
+ example: |
768
+ # Billing API
769
+
770
+ What it is for, how to get started.
771
+ responses:
772
+ "200":
773
+ description: Replaced
774
+ content:
775
+ application/json:
776
+ schema:
777
+ $ref: "#/components/schemas/SpecDocsWritten"
778
+ "201":
779
+ description: Created
780
+ content:
781
+ application/json:
782
+ schema:
783
+ $ref: "#/components/schemas/SpecDocsWritten"
784
+ "400":
785
+ $ref: "#/components/responses/ValidationError"
786
+ "401":
787
+ $ref: "#/components/responses/Unauthorized"
788
+ "403":
789
+ $ref: "#/components/responses/Forbidden"
790
+ "404":
791
+ $ref: "#/components/responses/NotFound"
792
+ "413":
793
+ description: The document is larger than 200 KiB
794
+ content:
795
+ application/json:
796
+ schema:
797
+ $ref: "#/components/schemas/Error"
798
+ example:
799
+ success: false
800
+ error:
801
+ code: TOO_LARGE
802
+ message: The document must be 200 KiB or smaller
803
+ "415":
804
+ description: The body is not sent as `text/markdown`
805
+ content:
806
+ application/json:
807
+ schema:
808
+ $ref: "#/components/schemas/Error"
809
+ example:
810
+ success: false
811
+ error:
812
+ code: UNSUPPORTED_MEDIA_TYPE
813
+ message: Send the document as text/markdown
814
+ delete:
815
+ tags:
816
+ - Docs
817
+ operationId: deleteSpecDocs
818
+ summary: Remove a spec's description document
819
+ description: Removes it (204, also when there was none). The spec and its versions are untouched.
820
+ responses:
821
+ "204":
822
+ description: Removed
823
+ "401":
824
+ $ref: "#/components/responses/Unauthorized"
825
+ "403":
826
+ $ref: "#/components/responses/Forbidden"
827
+ "404":
828
+ $ref: "#/components/responses/NotFound"
829
+ /api/v1/public/specs/{publicId}:
830
+ parameters:
831
+ - name: publicId
832
+ in: path
833
+ required: true
834
+ schema:
835
+ type: string
836
+ example: Xk3vQ9mT2pLw8RzYb5NcA7Fd
837
+ description: The public token of the spec (`public_id`)
838
+ get:
839
+ tags:
840
+ - Public
841
+ operationId: getPublicSpec
842
+ summary: Read a public spec
843
+ description: What the reference page shows about a spec whose `reference_access` is `public`, readable without authentication. Only the latest version is served, with no owner and no uploader. A spec that is not public and a token nobody holds both answer 404, so a private spec cannot be told from no spec. Cached for 1 minute.
844
+ security: []
845
+ responses:
846
+ "200":
847
+ description: Spec
848
+ content:
849
+ application/json:
850
+ schema:
851
+ type: object
852
+ required:
853
+ - success
854
+ - data
855
+ properties:
856
+ success:
857
+ type: boolean
858
+ enum:
859
+ - true
860
+ data:
861
+ $ref: "#/components/schemas/PublicSpec"
862
+ "404":
863
+ $ref: "#/components/responses/NotFound"
864
+ /api/v1/public/specs/{publicId}/content:
865
+ parameters:
866
+ - name: publicId
867
+ in: path
868
+ required: true
869
+ schema:
870
+ type: string
871
+ example: Xk3vQ9mT2pLw8RzYb5NcA7Fd
872
+ description: The public token of the spec (`public_id`)
873
+ get:
874
+ tags:
875
+ - Public
876
+ operationId: getPublicSpecContent
877
+ summary: Read a public spec's document
878
+ description: "The latest version of the document exactly as uploaded, for Kong Dev Portal, SDK generators and the like. Same rules as the metadata: 404 unless `reference_access` is `public`. Cached for 1 minute."
879
+ security: []
880
+ responses:
881
+ "200":
882
+ description: The OpenAPI document
883
+ content:
884
+ application/yaml:
885
+ schema:
886
+ type: string
887
+ application/json:
888
+ schema:
889
+ type: string
890
+ "404":
891
+ $ref: "#/components/responses/NotFound"
892
+ /api/v1/shared/specs/{publicId}:
893
+ parameters:
894
+ - name: publicId
895
+ in: path
896
+ required: true
897
+ schema:
898
+ type: string
899
+ example: Xk3vQ9mT2pLw8RzYb5NcA7Fd
900
+ description: The public token of the spec (`public_id`)
901
+ get:
902
+ tags:
903
+ - Public
904
+ operationId: getSharedSpec
905
+ summary: Read a spec shared with signed-in users
906
+ description: "The same for a visitor who is SIGNED IN: any NASEBANAL account with the link may read it when `reference_access` is `login` or `public`. `hidden` and an unknown token answer 404; without credentials it is a 401."
907
+ responses:
908
+ "200":
909
+ description: Spec
910
+ content:
911
+ application/json:
912
+ schema:
913
+ type: object
914
+ required:
915
+ - success
916
+ - data
917
+ properties:
918
+ success:
919
+ type: boolean
920
+ enum:
921
+ - true
922
+ data:
923
+ $ref: "#/components/schemas/PublicSpec"
924
+ "401":
925
+ $ref: "#/components/responses/Unauthorized"
926
+ "404":
927
+ $ref: "#/components/responses/NotFound"
928
+ /api/v1/shared/specs/{publicId}/content:
929
+ parameters:
930
+ - name: publicId
931
+ in: path
932
+ required: true
933
+ schema:
934
+ type: string
935
+ example: Xk3vQ9mT2pLw8RzYb5NcA7Fd
936
+ description: The public token of the spec (`public_id`)
937
+ get:
938
+ tags:
939
+ - Public
940
+ operationId: getSharedSpecContent
941
+ summary: Read a shared spec's document
942
+ description: The latest version of the document for a signed-in visitor (`login` or `public` access).
943
+ responses:
944
+ "200":
945
+ description: The OpenAPI document
946
+ content:
947
+ application/yaml:
948
+ schema:
949
+ type: string
950
+ application/json:
951
+ schema:
952
+ type: string
953
+ "401":
954
+ $ref: "#/components/responses/Unauthorized"
955
+ "404":
956
+ $ref: "#/components/responses/NotFound"
957
+ components:
958
+ securitySchemes:
959
+ BearerAuth:
960
+ type: http
961
+ scheme: bearer
962
+ bearerFormat: JWT or PAT
963
+ description: Use either an Auth0 JWT token or a Personal Access Token (PAT) starting with `nbpat_`.
964
+ parameters:
965
+ ActiveOrganization:
966
+ name: X-Active-Organization-Id
967
+ in: header
968
+ required: true
969
+ schema:
970
+ type: string
971
+ example: "7"
972
+ description: "The owner of the specs: an organization id, or `personal` for the caller's own specs (Free plan, up to 20). Required: a missing or malformed value is refused with 400 `VALIDATION_ERROR`. An organization the caller does not belong to is refused with 403 `FORBIDDEN`."
973
+ GroupId:
974
+ name: id
975
+ in: path
976
+ required: true
977
+ schema:
978
+ type: string
979
+ example: gr_01hx
980
+ description: Group id
981
+ RepositoryId:
982
+ name: id
983
+ in: path
984
+ required: true
985
+ schema:
986
+ type: string
987
+ example: rp_01hx
988
+ description: Repository id
989
+ SpecId:
990
+ name: id
991
+ in: path
992
+ required: true
993
+ schema:
994
+ type: string
995
+ example: sp_01hx
996
+ description: Spec id
997
+ schemas:
998
+ Error:
999
+ type: object
1000
+ properties:
1001
+ success:
1002
+ type: boolean
1003
+ enum:
1004
+ - false
1005
+ error:
1006
+ type: object
1007
+ properties:
1008
+ code:
1009
+ type: string
1010
+ message:
1011
+ type: string
1012
+ Access:
1013
+ type: object
1014
+ required:
1015
+ - allowed
1016
+ - reason
1017
+ - owner
1018
+ - max_specs
1019
+ - max_groups
1020
+ properties:
1021
+ allowed:
1022
+ type: boolean
1023
+ description: The owner may use the feature
1024
+ reason:
1025
+ type: string
1026
+ nullable: true
1027
+ enum:
1028
+ - enterprise_required
1029
+ - null
1030
+ description: Why not, when `allowed` is false
1031
+ owner:
1032
+ type: string
1033
+ enum:
1034
+ - user
1035
+ - organization
1036
+ description: Whose specs these are - the caller (`personal`) or the active organization
1037
+ max_specs:
1038
+ type: integer
1039
+ description: How many specs the owner may hold (0 when `allowed` is false)
1040
+ max_groups:
1041
+ type: integer
1042
+ description: How many groups the owner may hold (0 when `allowed` is false)
1043
+ Group:
1044
+ type: object
1045
+ required:
1046
+ - id
1047
+ - name
1048
+ - spec_count
1049
+ - created_at
1050
+ - updated_at
1051
+ properties:
1052
+ id:
1053
+ type: string
1054
+ example: gr_01hx
1055
+ name:
1056
+ type: string
1057
+ maxLength: 60
1058
+ example: Billing
1059
+ description: Name the owner gives the group, unique among that owner's groups
1060
+ spec_count:
1061
+ type: integer
1062
+ minimum: 0
1063
+ description: How many specs are filed in this group
1064
+ created_at:
1065
+ type: string
1066
+ format: date-time
1067
+ updated_at:
1068
+ type: string
1069
+ format: date-time
1070
+ GroupCreate:
1071
+ type: object
1072
+ required:
1073
+ - name
1074
+ properties:
1075
+ name:
1076
+ type: string
1077
+ minLength: 1
1078
+ maxLength: 60
1079
+ example: Billing
1080
+ GroupUpdate:
1081
+ type: object
1082
+ required:
1083
+ - name
1084
+ properties:
1085
+ name:
1086
+ type: string
1087
+ minLength: 1
1088
+ maxLength: 60
1089
+ Repository:
1090
+ type: object
1091
+ required:
1092
+ - id
1093
+ - provider
1094
+ - name
1095
+ - component
1096
+ - attachments_enabled
1097
+ - spec_count
1098
+ - created_at
1099
+ - updated_at
1100
+ properties:
1101
+ id:
1102
+ type: string
1103
+ example: rp_01hx
1104
+ description: Repository id; the id the pipelines and Assurance use
1105
+ provider:
1106
+ type: string
1107
+ enum:
1108
+ - github
1109
+ - gitlab
1110
+ - bitbucket
1111
+ - other
1112
+ description: Where it is hosted. `other` is for something that is not in git (a vendor's delivery) and takes any name.
1113
+ name:
1114
+ type: string
1115
+ minLength: 1
1116
+ maxLength: 200
1117
+ example: nasebanal/nb-recorder-api
1118
+ description: "`owner/name` for `github`, `gitlab` and `bitbucket` (GitLab allows subgroups: `group/sub/name`); any text for `other`. Together with the owner, the provider and the component it is the key: unique, ignoring case."
1119
+ component:
1120
+ type: string
1121
+ maxLength: 100
1122
+ default: ""
1123
+ example: account-api
1124
+ description: "The owner's own name for a part of the repository that is tested and measured on its own (a monorepo with several APIs: `account-api`, `target-api`; a web app: `web`). Free text, trimmed, at most 100 characters, no control characters. Empty (the default) is the repository as a whole. Part of the key: the same repository with another component is another row with its own id, results and specs."
1125
+ attachments_enabled:
1126
+ type: boolean
1127
+ default: false
1128
+ description: "true lets the original test report be attached to a result of this repository's CI (a report can hold secrets and every member of the namespace can download it, so it is off by default). Turning it off stops new attachments; what is stored stays until it is removed. The one quality setting a repository holds: the raw report comes from its CI; the other settings are the spec's."
1129
+ spec_count:
1130
+ type: integer
1131
+ minimum: 0
1132
+ description: How many specs are tied to this repository
1133
+ created_at:
1134
+ type: string
1135
+ format: date-time
1136
+ updated_at:
1137
+ type: string
1138
+ format: date-time
1139
+ RepositoryUpsert:
1140
+ type: object
1141
+ description: "Registers the repository, or finds it: the key is `provider`, `name` and `component` (an absent, `null` or empty `component` is the repository as a whole). Safe to repeat on every pipeline run; the same four fields (with the owner) always answer the same id. A repository holds identity (provider, name, component) and one setting, `attachments_enabled`: the public links and the rest of how results are handled are settings of the spec. An existing repository is returned as it is, so a pipeline run can never change what someone set on a screen (rename it with `PATCH`)."
1142
+ required:
1143
+ - provider
1144
+ - name
1145
+ properties:
1146
+ provider:
1147
+ type: string
1148
+ enum:
1149
+ - github
1150
+ - gitlab
1151
+ - bitbucket
1152
+ - other
1153
+ example: github
1154
+ name:
1155
+ type: string
1156
+ minLength: 1
1157
+ maxLength: 200
1158
+ example: nasebanal/nb-recorder-api
1159
+ component:
1160
+ type: string
1161
+ maxLength: 100
1162
+ default: ""
1163
+ example: account-api
1164
+ description: "The owner's own name for a part of the repository that is tested and measured on its own (a monorepo with several APIs: `account-api`, `target-api`; a web app: `web`). Free text, trimmed, at most 100 characters, no control characters. Empty (the default) is the repository as a whole. Part of the key: the same repository with another component is another row with its own id, results and specs."
1165
+ attachments_enabled:
1166
+ type: boolean
1167
+ default: false
1168
+ description: Whether the original test report may be attached to a result. Applied only when the repository is created; an existing repository is returned as it is. Default false.
1169
+ RepositoryUpdate:
1170
+ type: object
1171
+ properties:
1172
+ provider:
1173
+ type: string
1174
+ enum:
1175
+ - github
1176
+ - gitlab
1177
+ - bitbucket
1178
+ - other
1179
+ name:
1180
+ type: string
1181
+ minLength: 1
1182
+ maxLength: 200
1183
+ component:
1184
+ type: string
1185
+ maxLength: 100
1186
+ default: ""
1187
+ nullable: true
1188
+ description: "The owner's own name for a part of the repository that is tested and measured on its own (a monorepo with several APIs: `account-api`, `target-api`; a web app: `web`). Free text, trimmed, at most 100 characters, no control characters. Empty (the default) is the repository as a whole. Part of the key: the same repository with another component is another row with its own id, results and specs."
1189
+ attachments_enabled:
1190
+ type: boolean
1191
+ description: Whether the original test report may be attached to a result.
1192
+ Spec:
1193
+ type: object
1194
+ required:
1195
+ - id
1196
+ - name
1197
+ - group_id
1198
+ - repository_id
1199
+ - title
1200
+ - openapi_version
1201
+ - latest_version
1202
+ - api_version
1203
+ - initial_spec_id
1204
+ - reference_access
1205
+ - public_badge
1206
+ - report_access
1207
+ - quality_public_id
1208
+ - latest_contract_hash
1209
+ - has_docs
1210
+ - docs_updated_at
1211
+ - created_at
1212
+ - updated_at
1213
+ properties:
1214
+ id:
1215
+ type: string
1216
+ example: sp_01hx
1217
+ group_id:
1218
+ type: string
1219
+ nullable: true
1220
+ example: gr_01hx
1221
+ description: The group this spec is filed in; `null` = none (it stands on its own in the list)
1222
+ repository_id:
1223
+ type: string
1224
+ nullable: true
1225
+ example: rp_01hx
1226
+ description: The repository this spec is implemented in; `null` = none (for example an OAS uploaded by hand)
1227
+ name:
1228
+ type: string
1229
+ maxLength: 100
1230
+ example: Billing API
1231
+ description: "Name the owner gives the spec. Unique within the owner, the group, the repository AND the API version the spec is, ignoring case: the environments of one API are separate specs filed in different groups, and a new API version is a separate spec, so they may share a name (the same name under another repository is fine too; the specs with no group, or with no repository, count as one value each)"
1232
+ description:
1233
+ type: string
1234
+ nullable: true
1235
+ maxLength: 1000
1236
+ title:
1237
+ type: string
1238
+ description: "`info.title` of the latest version"
1239
+ openapi_version:
1240
+ type: string
1241
+ example: 3.0.3
1242
+ description: "`openapi` of the latest version"
1243
+ latest_version:
1244
+ type: integer
1245
+ minimum: 1
1246
+ description: "The number of the newest REVISION of the spec's document (1, 2, 3 ...): the history inside one API version. Every change of the document is a new revision, whether or not it breaks compatibility; the API version is `api_version`."
1247
+ api_version:
1248
+ type: string
1249
+ example: v1
1250
+ description: "The API version this spec is (`v1`, `v2`: the generation of the API, which changes only with a breaking change). Fixed when the spec is created, from the given `api_version` or the major of the document's `info.version`; a new major API version is a new spec. Results and monitors are about the spec, so they need no version of their own."
1251
+ initial_spec_id:
1252
+ type: string
1253
+ nullable: true
1254
+ description: The first spec registered for the API this spec is a later version of (its initial version), or `null` when this spec is an API of its own or is the initial version itself. The specs of one API share the group and repository of the initial version and have one spec per API version; a CI names the initial version by id and finds the spec of any API version of it.
1255
+ created_by_user_id:
1256
+ type: integer
1257
+ nullable: true
1258
+ description: Who uploaded the first version; null once that account is deleted
1259
+ created_at:
1260
+ type: string
1261
+ format: date-time
1262
+ reference_access:
1263
+ type: string
1264
+ enum:
1265
+ - hidden
1266
+ - login
1267
+ - public
1268
+ description: "Who may read the latest version through the public links: `hidden` = nobody (404 whoever asks), `login` = anyone signed in to NASEBANAL who has the link, `public` = anyone with the link, no login. Only the latest version is ever served."
1269
+ public_id:
1270
+ type: string
1271
+ nullable: true
1272
+ description: The unguessable token (24 characters) of the public links; null until `reference_access` was first turned on. Kept when the access is turned off again, replaced by `rotate_public_id`.
1273
+ public_badge:
1274
+ type: boolean
1275
+ description: true makes the quality badge ("5/6" and a colour) readable without authentication by `quality_public_id`; false makes it show nothing at all. The public token (`quality_public_id`) exists from the spec's creation and does not change when the badge goes on or off. Independent of `report_access`. Read by NASEBANAL Assurance, which computes the quality from the results it holds.
1276
+ report_access:
1277
+ type: string
1278
+ enum:
1279
+ - hidden
1280
+ - login
1281
+ - public
1282
+ description: "Who may read the quality report (the summary, the report page and its embed): `hidden` = nobody (404 whoever asks), `login` = anyone signed in to NASEBANAL who has the link, `public` = anyone with the link, no login. Independent of `public_badge`."
1283
+ quality_public_id:
1284
+ type: string
1285
+ description: The unguessable token (24 characters) of the public quality links. Issued when the spec is created, so the links can be shown and copied before the badge or the report is switched on (while both are off the token opens nothing); never changed by the settings, replaced only by `rotate_quality_public_id`.
1286
+ latest_contract_hash:
1287
+ type: string
1288
+ nullable: true
1289
+ example: 3b1c0a5e4f6d7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b
1290
+ description: "SHA-256 (hex) of the CONTRACT of the latest version: its document without the top-level `servers`, in a canonical form (parsed, every object's keys sorted by code point, arrays in their own order, serialized as JSON). The environments of one API are separate specs whose documents differ in `servers` only, so equal hashes mean \"the same contract\". `null` only when the document cannot be read."
1291
+ has_docs:
1292
+ type: boolean
1293
+ description: Whether the spec has a description document (markdown), read with `GET /specs/{id}/docs`.
1294
+ docs_updated_at:
1295
+ type: string
1296
+ format: date-time
1297
+ nullable: true
1298
+ description: When the description document was last written; `null` = none.
1299
+ updated_at:
1300
+ type: string
1301
+ format: date-time
1302
+ PublicSpec:
1303
+ type: object
1304
+ description: "What the public reference page shows about a spec: its name and the latest version, nothing about who owns or uploaded it."
1305
+ required:
1306
+ - name
1307
+ - title
1308
+ - openapi_version
1309
+ - info_version
1310
+ - version
1311
+ - updated_at
1312
+ properties:
1313
+ name:
1314
+ type: string
1315
+ title:
1316
+ type: string
1317
+ description:
1318
+ type: string
1319
+ nullable: true
1320
+ openapi_version:
1321
+ type: string
1322
+ info_version:
1323
+ type: string
1324
+ version:
1325
+ type: integer
1326
+ updated_at:
1327
+ type: string
1328
+ format: date-time
1329
+ SpecDocsWritten:
1330
+ type: object
1331
+ required:
1332
+ - success
1333
+ - data
1334
+ properties:
1335
+ success:
1336
+ type: boolean
1337
+ enum:
1338
+ - true
1339
+ data:
1340
+ type: object
1341
+ required:
1342
+ - size_bytes
1343
+ - updated_at
1344
+ properties:
1345
+ size_bytes:
1346
+ type: integer
1347
+ description: Size of the stored document in bytes (UTF-8)
1348
+ updated_at:
1349
+ type: string
1350
+ format: date-time
1351
+ SpecCreate:
1352
+ type: object
1353
+ required:
1354
+ - name
1355
+ - content
1356
+ properties:
1357
+ group_id:
1358
+ type: string
1359
+ nullable: true
1360
+ example: gr_01hx
1361
+ description: "The group to file the spec in. Optional: left out (or `null`) the spec is filed in no group. A group is made with `POST /groups`; a group of another owner is a 404"
1362
+ repository_id:
1363
+ type: string
1364
+ nullable: true
1365
+ example: rp_01hx
1366
+ description: "The repository to tie the spec to. Optional: left out (or `null`) the spec has no repository. A repository is made with `PUT /repositories`; a repository of another owner is a 404"
1367
+ name:
1368
+ type: string
1369
+ minLength: 1
1370
+ maxLength: 100
1371
+ example: Billing API
1372
+ description:
1373
+ type: string
1374
+ maxLength: 1000
1375
+ content:
1376
+ type: string
1377
+ description: The OpenAPI 3.x document, YAML or JSON, as text. At most 2 MiB.
1378
+ example: |
1379
+ openapi: 3.0.3
1380
+ info:
1381
+ title: Billing API
1382
+ version: 1.0.0
1383
+ paths: {}
1384
+ api_version:
1385
+ type: string
1386
+ minLength: 1
1387
+ maxLength: 32
1388
+ pattern: ^[A-Za-z0-9._-]{1,32}$
1389
+ example: v1
1390
+ description: "The API version of the spec (letters, digits, `.`, `_`, `-`; trimmed). Optional: left out, it is the major of the document's `info.version` (`1.8.0` is `v1`). Required when `info.version` has no major to read (`2023-01`), refused with `400 API_VERSION_REQUIRED` otherwise. Fixed for the life of the spec."
1391
+ initial_spec_id:
1392
+ type: string
1393
+ nullable: true
1394
+ description: The initial version of the API this new spec is a later version of. The new spec is filed in that spec's group and repository (taken from it when `group_id` and `repository_id` are left out), and its API version must not be one that API already has. Optional.
1395
+ SpecUpdate:
1396
+ type: object
1397
+ properties:
1398
+ api_version:
1399
+ type: string
1400
+ pattern: ^[A-Za-z0-9._-]{1,32}$
1401
+ description: "Not changeable: the API version is fixed when the spec is created. Sending the spec's own value again is accepted; a different one is refused with `400` (a new API version is registered as a new spec)."
1402
+ initial_spec_id:
1403
+ type: string
1404
+ nullable: true
1405
+ description: The initial version of the API this spec is a later version of, with the same rules as when creating; `null` makes the spec an API of its own. A spec in an API cannot change its group or repository (`409 VERSION_FAMILY_MEMBER`) unless it leaves the API in the same request.
1406
+ group_id:
1407
+ type: string
1408
+ nullable: true
1409
+ example: gr_01hx
1410
+ description: Moves the spec to another group; `null` takes it out of its group. A group of another owner is a 404
1411
+ repository_id:
1412
+ type: string
1413
+ nullable: true
1414
+ example: rp_01hx
1415
+ description: Ties the spec to another repository; `null` takes it out. A repository of another owner is a 404
1416
+ name:
1417
+ type: string
1418
+ minLength: 1
1419
+ maxLength: 100
1420
+ description:
1421
+ type: string
1422
+ nullable: true
1423
+ maxLength: 1000
1424
+ reference_access:
1425
+ type: string
1426
+ enum:
1427
+ - hidden
1428
+ - login
1429
+ - public
1430
+ description: "Who may read the latest version through the public links: `hidden` = nobody (404 whoever asks), `login` = anyone signed in to NASEBANAL who has the link, `public` = anyone with the link, no login. Only the latest version is ever served."
1431
+ rotate_public_id:
1432
+ type: boolean
1433
+ description: true replaces the public token, which breaks every link already shared.
1434
+ public_badge:
1435
+ type: boolean
1436
+ description: true makes the quality badge ("5/6" and a colour) readable without authentication by `quality_public_id`; false makes it show nothing at all. The public token (`quality_public_id`) exists from the spec's creation and does not change when the badge goes on or off. Independent of `report_access`. Read by NASEBANAL Assurance, which computes the quality from the results it holds.
1437
+ report_access:
1438
+ type: string
1439
+ enum:
1440
+ - hidden
1441
+ - login
1442
+ - public
1443
+ description: "Who may read the quality report (the summary, the report page and its embed): `hidden` = nobody (404 whoever asks), `login` = anyone signed in to NASEBANAL who has the link, `public` = anyone with the link, no login. Independent of `public_badge`."
1444
+ rotate_quality_public_id:
1445
+ type: boolean
1446
+ description: true replaces the public token, which breaks every link already shared.
1447
+ SpecVersionCreate:
1448
+ type: object
1449
+ required:
1450
+ - content
1451
+ properties:
1452
+ content:
1453
+ type: string
1454
+ description: The OpenAPI 3.x document, YAML or JSON, as text. At most 2 MiB.
1455
+ example: |
1456
+ openapi: 3.0.3
1457
+ info:
1458
+ title: Billing API
1459
+ version: 1.1.0
1460
+ paths: {}
1461
+ note:
1462
+ type: string
1463
+ maxLength: 500
1464
+ description: What changed, shown in the version list
1465
+ SpecVersion:
1466
+ type: object
1467
+ required:
1468
+ - version
1469
+ - title
1470
+ - openapi_version
1471
+ - info_version
1472
+ - size_bytes
1473
+ - content_hash
1474
+ - contract_hash
1475
+ - created_at
1476
+ properties:
1477
+ version:
1478
+ type: integer
1479
+ minimum: 1
1480
+ description: The REVISION number of this document inside its spec. Counts up from 1 per spec; never reused
1481
+ title:
1482
+ type: string
1483
+ description: "`info.title` of this version"
1484
+ openapi_version:
1485
+ type: string
1486
+ example: 3.0.3
1487
+ info_version:
1488
+ type: string
1489
+ example: 1.1.0
1490
+ description: "`info.version` of this version, as the author wrote it"
1491
+ note:
1492
+ type: string
1493
+ nullable: true
1494
+ size_bytes:
1495
+ type: integer
1496
+ content_hash:
1497
+ type: string
1498
+ example: 9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
1499
+ description: SHA-256 (hex) of the document exactly as it was uploaded. The same hash of a local file means the file is already the latest version, so there is nothing to upload
1500
+ contract_hash:
1501
+ type: string
1502
+ nullable: true
1503
+ description: "SHA-256 (hex) of the contract of this version: the document without its top-level `servers`, canonical (see `Spec.latest_contract_hash`). `null` only when the document cannot be read."
1504
+ created_by_user_id:
1505
+ type: integer
1506
+ nullable: true
1507
+ created_at:
1508
+ type: string
1509
+ format: date-time
1510
+ responses:
1511
+ Unauthorized:
1512
+ description: Authentication required or invalid token
1513
+ content:
1514
+ application/json:
1515
+ schema:
1516
+ $ref: "#/components/schemas/Error"
1517
+ example:
1518
+ success: false
1519
+ error:
1520
+ code: AUTH_ERROR
1521
+ message: No authentication token provided
1522
+ ValidationError:
1523
+ description: The request body, a parameter or the active owner is invalid, or the new spec's `info.version` has no major version to take the API version from and no `api_version` was given (`API_VERSION_REQUIRED`)
1524
+ content:
1525
+ application/json:
1526
+ schema:
1527
+ $ref: "#/components/schemas/Error"
1528
+ example:
1529
+ success: false
1530
+ error:
1531
+ code: VALIDATION_ERROR
1532
+ message: X-Active-Organization-Id must be an organization id or personal
1533
+ Forbidden:
1534
+ description: The caller does not belong to the active organization (`FORBIDDEN`), or the organization is not on the Enterprise plan (`ENTERPRISE_REQUIRED`). Never returned for `personal`.
1535
+ content:
1536
+ application/json:
1537
+ schema:
1538
+ $ref: "#/components/schemas/Error"
1539
+ example:
1540
+ success: false
1541
+ error:
1542
+ code: ENTERPRISE_REQUIRED
1543
+ message: An organization's specs require the Enterprise plan
1544
+ NotFound:
1545
+ description: No such spec or version, or it belongs to another owner
1546
+ content:
1547
+ application/json:
1548
+ schema:
1549
+ $ref: "#/components/schemas/Error"
1550
+ example:
1551
+ success: false
1552
+ error:
1553
+ code: NOT_FOUND
1554
+ message: Spec not found
1555
+ Conflict:
1556
+ description: "The name is already used by another spec of the same group, repository and API version (or, with none, another spec with none) or by another group of the owner (`NAME_TAKEN`; changing `group_id` or `repository_id` into a group and repository that already hold a spec of this name and API version is the same, and so is deleting a repository whose specs would then collide), a group still holds specs (`GROUP_NOT_EMPTY`), the document is identical to the latest revision (`UNCHANGED`), the document is another API version than the spec (`API_VERSION_MISMATCH`: register it as a new spec), the owner already holds the maximum number of specs or groups (`LIMIT_REACHED`), or another upload of the same spec was in progress (`CONFLICT`, try again)"
1557
+ content:
1558
+ application/json:
1559
+ schema:
1560
+ $ref: "#/components/schemas/Error"
1561
+ example:
1562
+ success: false
1563
+ error:
1564
+ code: NAME_TAKEN
1565
+ message: A spec with this name already exists in this group, repository and API version
1566
+ TooLarge:
1567
+ description: The document is larger than 2 MiB
1568
+ content:
1569
+ application/json:
1570
+ schema:
1571
+ $ref: "#/components/schemas/Error"
1572
+ example:
1573
+ success: false
1574
+ error:
1575
+ code: TOO_LARGE
1576
+ message: The document must be 2 MiB or smaller
1577
+ InvalidSpec:
1578
+ description: The document is not a valid OpenAPI 3.x document
1579
+ content:
1580
+ application/json:
1581
+ schema:
1582
+ $ref: "#/components/schemas/Error"
1583
+ example:
1584
+ success: false
1585
+ error:
1586
+ code: INVALID_SPEC
1587
+ message: "paths: must be an object"