@schmock/openapi 1.1.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.
Files changed (46) hide show
  1. package/dist/crud-detector.d.ts +35 -0
  2. package/dist/crud-detector.d.ts.map +1 -0
  3. package/dist/crud-detector.js +153 -0
  4. package/dist/generators.d.ts +14 -0
  5. package/dist/generators.d.ts.map +1 -0
  6. package/dist/generators.js +158 -0
  7. package/dist/index.d.ts +3 -0
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +221 -0
  10. package/dist/normalizer.d.ts +14 -0
  11. package/dist/normalizer.d.ts.map +1 -0
  12. package/dist/normalizer.js +194 -0
  13. package/dist/parser.d.ts +32 -0
  14. package/dist/parser.d.ts.map +1 -0
  15. package/dist/parser.js +282 -0
  16. package/dist/plugin.d.ts +32 -0
  17. package/dist/plugin.d.ts.map +1 -0
  18. package/dist/plugin.js +129 -0
  19. package/dist/seed.d.ts +15 -0
  20. package/dist/seed.d.ts.map +1 -0
  21. package/dist/seed.js +41 -0
  22. package/package.json +45 -0
  23. package/src/__fixtures__/faker-stress-test.openapi.yaml +1030 -0
  24. package/src/__fixtures__/openapi31.json +34 -0
  25. package/src/__fixtures__/petstore-openapi3.json +168 -0
  26. package/src/__fixtures__/petstore-swagger2.json +141 -0
  27. package/src/__fixtures__/scalar-galaxy.yaml +1314 -0
  28. package/src/__fixtures__/stripe-fixtures3.json +6542 -0
  29. package/src/__fixtures__/stripe-spec3.yaml +161621 -0
  30. package/src/__fixtures__/train-travel.yaml +1264 -0
  31. package/src/crud-detector.test.ts +150 -0
  32. package/src/crud-detector.ts +194 -0
  33. package/src/generators.test.ts +214 -0
  34. package/src/generators.ts +212 -0
  35. package/src/index.ts +4 -0
  36. package/src/normalizer.test.ts +253 -0
  37. package/src/normalizer.ts +233 -0
  38. package/src/parser.test.ts +181 -0
  39. package/src/parser.ts +389 -0
  40. package/src/plugin.test.ts +205 -0
  41. package/src/plugin.ts +185 -0
  42. package/src/seed.ts +62 -0
  43. package/src/steps/openapi-crud.steps.ts +132 -0
  44. package/src/steps/openapi-parsing.steps.ts +111 -0
  45. package/src/steps/openapi-seed.steps.ts +94 -0
  46. package/src/stress.test.ts +2814 -0
@@ -0,0 +1,1314 @@
1
+ openapi: 3.1.1
2
+ info:
3
+ title: Scalar Galaxy
4
+ description: |
5
+ The Scalar Galaxy is an example OpenAPI document to test OpenAPI tools and libraries. It's a fictional universe with fictional planets and fictional data. Get all the data for [all planets](#tag/planets/get/planets).
6
+
7
+ ## Resources
8
+
9
+ * https://github.com/scalar/scalar
10
+ * https://github.com/OAI/OpenAPI-Specification
11
+ * https://scalar.com
12
+
13
+ ## Markdown Support
14
+
15
+ All descriptions *can* contain ~~tons of text~~ **Markdown**. [If GitHub supports the syntax](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax), chances are we're supporting it, too. You can even create [internal links to reference endpoints](#tag/authentication/post/user/signup).
16
+
17
+ <details>
18
+ <summary>Examples</summary>
19
+
20
+ **Blockquotes**
21
+
22
+ > I love OpenAPI. <3
23
+
24
+ **Tables**
25
+
26
+ | Feature | Availability |
27
+ | ---------------- | ------------ |
28
+ | Markdown Support | ✓ |
29
+
30
+ **Accordion**
31
+
32
+ ```html
33
+ <details>
34
+ <summary>Using Details Tags</summary>
35
+ <p>HTML Example</p>
36
+ </details>
37
+ ```
38
+
39
+ **Images**
40
+
41
+ Yes, there's support for images, too!
42
+
43
+ ![Empty placeholder image showing the width/height](https://images.placeholders.dev/?width=1280&height=720)
44
+
45
+ **Alerts**
46
+
47
+ > [!tip]
48
+ > You can now use markdown alerts in your descriptions.
49
+
50
+ </details>
51
+ version: 0.5.12
52
+ contact:
53
+ name: Scalar Support
54
+ url: https://scalar.com
55
+ email: support@scalar.com
56
+ license:
57
+ name: MIT
58
+ url: https://opensource.org/license/MIT
59
+ externalDocs:
60
+ description: Documentation
61
+ url: https://github.com/scalar/scalar
62
+ servers:
63
+ - url: https://galaxy.scalar.com
64
+ - url: '{protocol}://void.scalar.com/{path}'
65
+ description: Responds with your request data
66
+ variables:
67
+ protocol:
68
+ enum:
69
+ - https
70
+ - http
71
+ default: https
72
+ path:
73
+ default: ''
74
+ security:
75
+ - bearerAuth: []
76
+ - basicAuth: []
77
+ - apiKeyQuery: []
78
+ - apiKeyHeader: []
79
+ - apiKeyCookie: []
80
+ - oAuth2: []
81
+ - openIdConnect: []
82
+ x-speakeasy-webhooks:
83
+ security:
84
+ type: signature
85
+ headerName: x-signature
86
+ signatureTextEncoding: base64
87
+ algorithm: hmac-sha256
88
+ tags:
89
+ - name: Authentication
90
+ description: Some endpoints are public, but some require authentication. We
91
+ provide all the required endpoints to create an account and authorize
92
+ yourself.
93
+ - name: Planets
94
+ description: Everything about planets
95
+ - name: Celestial Bodies
96
+ description: Celestial bodies are the planets and satellites in the Scalar Galaxy.
97
+ paths:
98
+ /planets:
99
+ get:
100
+ tags:
101
+ - Planets
102
+ summary: Get all planets
103
+ description:
104
+ It's easy to say you know them all, but do you really? Retrieve all
105
+ the planets and check whether you missed one.
106
+ operationId: getAllData
107
+ security:
108
+ - {}
109
+ parameters:
110
+ - $ref: '#/components/parameters/limit'
111
+ - $ref: '#/components/parameters/offset'
112
+ responses:
113
+ '200':
114
+ description: OK
115
+ headers:
116
+ X-Request-ID:
117
+ $ref: '#/components/headers/X-Request-ID'
118
+ X-Pagination-Total:
119
+ $ref: '#/components/headers/X-Pagination-Total'
120
+ X-Pagination-Page:
121
+ $ref: '#/components/headers/X-Pagination-Page'
122
+ X-Pagination-Per-Page:
123
+ $ref: '#/components/headers/X-Pagination-Per-Page'
124
+ X-Cache-Control:
125
+ $ref: '#/components/headers/X-Cache-Control'
126
+ content:
127
+ application/json:
128
+ schema:
129
+ allOf:
130
+ - type: object
131
+ properties:
132
+ data:
133
+ type: array
134
+ items:
135
+ $ref: '#/components/schemas/Planet'
136
+ - $ref: '#/components/schemas/PaginatedResource'
137
+ application/xml:
138
+ schema:
139
+ allOf:
140
+ - type: object
141
+ xml:
142
+ name: planets
143
+ properties:
144
+ data:
145
+ type: array
146
+ items:
147
+ $ref: '#/components/schemas/Planet'
148
+ - $ref: '#/components/schemas/PaginatedResource'
149
+ post:
150
+ tags:
151
+ - Planets
152
+ summary: Create a planet
153
+ description:
154
+ Time to play god and create a new planet. What do you think? Ah,
155
+ don't think too much. What could go wrong anyway?
156
+ operationId: createPlanet
157
+ callbacks:
158
+ planetCreated:
159
+ '{$request.body#/successCallbackUrl}':
160
+ post:
161
+ requestBody:
162
+ description: Information about the newly created planet
163
+ content:
164
+ application/json:
165
+ schema:
166
+ $ref: '#/components/schemas/Planet'
167
+ responses:
168
+ '200':
169
+ description: Your server returns this code if it accepts the callback
170
+ '204':
171
+ description:
172
+ Your server should return this HTTP status code if no longer
173
+ interested in further updates
174
+ planetCreationFailed:
175
+ '{$request.body#/failureCallbackUrl}':
176
+ post:
177
+ requestBody:
178
+ description: Information about which fields failed to validate
179
+ content:
180
+ application/json:
181
+ schema:
182
+ $ref: '#/components/schemas/Planet'
183
+ responses:
184
+ '200':
185
+ description: Your server returns this code if it accepts the failure callback notification
186
+ planetExploded:
187
+ '{$request.body#/successCallbackUrl}':
188
+ post:
189
+ requestBody:
190
+ description: Information about the newly exploded planet
191
+ content:
192
+ application/json:
193
+ schema:
194
+ $ref: '#/components/schemas/Planet'
195
+ responses:
196
+ '200':
197
+ description: Your server returns this code if it accepts the planet explosion callback notification
198
+ requestBody:
199
+ description: Planet
200
+ content:
201
+ application/json:
202
+ schema:
203
+ $ref: '#/components/schemas/Planet'
204
+ application/xml:
205
+ schema:
206
+ $ref: '#/components/schemas/Planet'
207
+ responses:
208
+ '201':
209
+ description: Created
210
+ headers:
211
+ X-Request-ID:
212
+ $ref: '#/components/headers/X-Request-ID'
213
+ Location:
214
+ $ref: '#/components/headers/Location'
215
+ X-Processing-Time:
216
+ $ref: '#/components/headers/X-Processing-Time'
217
+ content:
218
+ application/json:
219
+ schema:
220
+ $ref: '#/components/schemas/Planet'
221
+ application/xml:
222
+ schema:
223
+ $ref: '#/components/schemas/Planet'
224
+ '400':
225
+ $ref: '#/components/responses/BadRequest'
226
+ '403':
227
+ $ref: '#/components/responses/Forbidden'
228
+ /planets/{planetId}:
229
+ get:
230
+ tags:
231
+ - Planets
232
+ summary: Get a planet
233
+ description:
234
+ You'll better learn a little bit more about the planets. It might
235
+ come in handy once space travel is available for everyone.
236
+ operationId: getPlanet
237
+ security:
238
+ - {}
239
+ parameters:
240
+ - $ref: '#/components/parameters/planetId'
241
+ responses:
242
+ '200':
243
+ description: Planet Found
244
+ headers:
245
+ X-Request-ID:
246
+ $ref: '#/components/headers/X-Request-ID'
247
+ ETag:
248
+ $ref: '#/components/headers/ETag'
249
+ Last-Modified:
250
+ $ref: '#/components/headers/Last-Modified'
251
+ X-Cache-Control:
252
+ $ref: '#/components/headers/X-Cache-Control'
253
+ content:
254
+ application/json:
255
+ schema:
256
+ $ref: '#/components/schemas/Planet'
257
+ application/xml:
258
+ schema:
259
+ $ref: '#/components/schemas/Planet'
260
+ '404':
261
+ $ref: '#/components/responses/NotFound'
262
+ put:
263
+ tags:
264
+ - Planets
265
+ summary: Update a planet
266
+ description: Sometimes you make mistakes, that's fine. No worries, you can
267
+ update all planets.
268
+ operationId: updatePlanet
269
+ requestBody:
270
+ description: New information about the planet
271
+ content:
272
+ application/json:
273
+ schema:
274
+ $ref: '#/components/schemas/Planet'
275
+ application/xml:
276
+ schema:
277
+ $ref: '#/components/schemas/Planet'
278
+ parameters:
279
+ - $ref: '#/components/parameters/planetId'
280
+ responses:
281
+ '200':
282
+ description: Planet updated successfully
283
+ content:
284
+ application/json:
285
+ schema:
286
+ $ref: '#/components/schemas/Planet'
287
+ application/xml:
288
+ schema:
289
+ $ref: '#/components/schemas/Planet'
290
+ '400':
291
+ $ref: '#/components/responses/BadRequest'
292
+ '403':
293
+ $ref: '#/components/responses/Forbidden'
294
+ '404':
295
+ $ref: '#/components/responses/NotFound'
296
+ delete:
297
+ tags:
298
+ - Planets
299
+ summary: Delete a planet
300
+ operationId: deletePlanet
301
+ description: This endpoint was used to delete planets. Unfortunately, that
302
+ caused a lot of trouble for planets with life. So, this endpoint is now
303
+ deprecated and should not be used anymore.
304
+ x-scalar-stability: experimental
305
+ parameters:
306
+ - $ref: '#/components/parameters/planetId'
307
+ responses:
308
+ '204':
309
+ description: No Content
310
+ '404':
311
+ $ref: '#/components/responses/NotFound'
312
+ /planets/{planetId}/image:
313
+ post:
314
+ tags:
315
+ - Planets
316
+ summary: Upload an image to a planet
317
+ description: Got a crazy good photo of a planet? Share it with the world!
318
+ operationId: uploadImage
319
+ parameters:
320
+ - $ref: '#/components/parameters/planetId'
321
+ requestBody:
322
+ description: Image to upload
323
+ content:
324
+ multipart/form-data:
325
+ schema:
326
+ type: object
327
+ properties:
328
+ image:
329
+ type: string
330
+ format: binary
331
+ description: The image file to upload
332
+ examples:
333
+ - '@mars.jpg'
334
+ - '@jupiter.png'
335
+ responses:
336
+ '200':
337
+ $ref: '#/components/responses/ImageUploaded'
338
+ '400':
339
+ $ref: '#/components/responses/BadRequest'
340
+ '403':
341
+ $ref: '#/components/responses/Forbidden'
342
+ '404':
343
+ $ref: '#/components/responses/NotFound'
344
+ /celestial-bodies:
345
+ post:
346
+ tags:
347
+ - Celestial Bodies
348
+ summary: Create a celestial body
349
+ operationId: createCelestialBody
350
+ requestBody:
351
+ description: Celestial body to create
352
+ required: true
353
+ content:
354
+ application/json:
355
+ schema:
356
+ $ref: '#/components/schemas/CelestialBody'
357
+ responses:
358
+ '201':
359
+ description: Celestial body created
360
+ content:
361
+ application/json:
362
+ schema:
363
+ $ref: '#/components/schemas/CelestialBody'
364
+ /user/signup:
365
+ post:
366
+ tags:
367
+ - Authentication
368
+ summary: Create a user
369
+ description: Time to create a user account, eh?
370
+ operationId: createUser
371
+ security:
372
+ - {}
373
+ requestBody:
374
+ description: User to create
375
+ content:
376
+ application/json:
377
+ schema:
378
+ allOf:
379
+ - $ref: '#/components/schemas/User'
380
+ - $ref: '#/components/schemas/Credentials'
381
+ examples:
382
+ Marc:
383
+ value:
384
+ name: Marc
385
+ email: marc@scalar.com
386
+ password: i-love-scalar
387
+ Cam:
388
+ value:
389
+ name: Cam
390
+ email: cam@scalar.com
391
+ password: scalar-is-cool
392
+ Hans:
393
+ value:
394
+ name: Hans
395
+ email: hans@scalar.com
396
+ password: 5c4l4r
397
+ application/xml:
398
+ schema:
399
+ allOf:
400
+ - $ref: '#/components/schemas/User'
401
+ - $ref: '#/components/schemas/Credentials'
402
+ examples:
403
+ Marc:
404
+ value:
405
+ name: Marc
406
+ email: marc@scalar.com
407
+ password: i-love-scalar
408
+ Cam:
409
+ value:
410
+ name: Cam
411
+ email: cam@scalar.com
412
+ password: scalar-is-cool
413
+ Hans:
414
+ value:
415
+ name: Hans
416
+ email: hans@scalar.com
417
+ password: 5c4l4r
418
+ responses:
419
+ '201':
420
+ description: User account created successfully
421
+ headers:
422
+ X-Request-ID:
423
+ $ref: '#/components/headers/X-Request-ID'
424
+ Location:
425
+ $ref: '#/components/headers/Location'
426
+ X-Processing-Time:
427
+ $ref: '#/components/headers/X-Processing-Time'
428
+ content:
429
+ application/json:
430
+ schema:
431
+ $ref: '#/components/schemas/User'
432
+ application/xml:
433
+ schema:
434
+ $ref: '#/components/schemas/User'
435
+ '400':
436
+ $ref: '#/components/responses/BadRequest'
437
+ '401':
438
+ $ref: '#/components/responses/Unauthorized'
439
+ '403':
440
+ $ref: '#/components/responses/Forbidden'
441
+ '409':
442
+ $ref: '#/components/responses/Conflict'
443
+ '422':
444
+ $ref: '#/components/responses/UnprocessableEntity'
445
+ /auth/token:
446
+ post:
447
+ tags:
448
+ - Authentication
449
+ summary: Get a token
450
+ description:
451
+ Yeah, this is the boring security stuff. Just get your super secret
452
+ token and move on.
453
+ operationId: getToken
454
+ security:
455
+ - {}
456
+ requestBody:
457
+ description: Body for credentials to authenticate a user
458
+ content:
459
+ application/json:
460
+ schema:
461
+ $ref: '#/components/schemas/Credentials'
462
+ application/xml:
463
+ schema:
464
+ $ref: '#/components/schemas/Credentials'
465
+ responses:
466
+ '201':
467
+ description: Token Created
468
+ headers:
469
+ X-Request-ID:
470
+ $ref: '#/components/headers/X-Request-ID'
471
+ X-RateLimit-Limit:
472
+ $ref: '#/components/headers/X-RateLimit-Limit'
473
+ X-RateLimit-Remaining:
474
+ $ref: '#/components/headers/X-RateLimit-Remaining'
475
+ X-RateLimit-Reset:
476
+ $ref: '#/components/headers/X-RateLimit-Reset'
477
+ content:
478
+ application/json:
479
+ schema:
480
+ $ref: '#/components/schemas/Token'
481
+ application/xml:
482
+ schema:
483
+ $ref: '#/components/schemas/Token'
484
+ '400':
485
+ $ref: '#/components/responses/BadRequest'
486
+ '401':
487
+ $ref: '#/components/responses/Unauthorized'
488
+ '403':
489
+ $ref: '#/components/responses/Forbidden'
490
+ '429':
491
+ $ref: '#/components/responses/TooManyRequests'
492
+ /me:
493
+ get:
494
+ tags:
495
+ - Authentication
496
+ summary: Get authenticated user
497
+ description: Find yourself they say. That's what you can do here.
498
+ operationId: getMe
499
+ security:
500
+ - basicAuth: []
501
+ - oAuth2:
502
+ - read:account
503
+ - bearerAuth: []
504
+ - apiKeyHeader: []
505
+ - apiKeyQuery: []
506
+ responses:
507
+ '200':
508
+ description: Authenticated user information retrieved successfully
509
+ headers:
510
+ X-Request-ID:
511
+ $ref: '#/components/headers/X-Request-ID'
512
+ ETag:
513
+ $ref: '#/components/headers/ETag'
514
+ Last-Modified:
515
+ $ref: '#/components/headers/Last-Modified'
516
+ X-Cache-Control:
517
+ $ref: '#/components/headers/X-Cache-Control'
518
+ content:
519
+ application/json:
520
+ schema:
521
+ $ref: '#/components/schemas/User'
522
+ application/xml:
523
+ schema:
524
+ $ref: '#/components/schemas/User'
525
+ '401':
526
+ $ref: '#/components/responses/Unauthorized'
527
+ '403':
528
+ $ref: '#/components/responses/Forbidden'
529
+ webhooks:
530
+ newPlanet:
531
+ post:
532
+ tags:
533
+ - Planets
534
+ requestBody:
535
+ description: Information about a new planet
536
+ content:
537
+ application/json:
538
+ schema:
539
+ $ref: '#/components/schemas/Planet'
540
+ responses:
541
+ '200':
542
+ description:
543
+ Return a 200 status to indicate that the data was received
544
+ successfully
545
+ components:
546
+ securitySchemes:
547
+ bearerAuth:
548
+ type: http
549
+ scheme: bearer
550
+ description: JWT Bearer token authentication
551
+ basicAuth:
552
+ type: http
553
+ scheme: basic
554
+ description: Basic HTTP authentication
555
+ apiKeyHeader:
556
+ type: apiKey
557
+ in: header
558
+ name: X-API-Key
559
+ description: API key request header
560
+ apiKeyQuery:
561
+ type: apiKey
562
+ in: query
563
+ name: api_key
564
+ description: API key query parameter
565
+ apiKeyCookie:
566
+ type: apiKey
567
+ in: cookie
568
+ name: api_key
569
+ description: API key browser cookie
570
+ oAuth2:
571
+ type: oauth2
572
+ description: OAuth 2.0 authentication
573
+ flows:
574
+ authorizationCode:
575
+ authorizationUrl: https://galaxy.scalar.com/oauth/authorize
576
+ tokenUrl: https://galaxy.scalar.com/oauth/token
577
+ scopes:
578
+ read:account: read your account information
579
+ write:planets: modify planets in your account
580
+ read:planets: read your planets
581
+ clientCredentials:
582
+ tokenUrl: https://galaxy.scalar.com/oauth/token
583
+ scopes:
584
+ read:account: read your account information
585
+ write:planets: modify planets in your account
586
+ read:planets: read your planets
587
+ # Legacy
588
+ implicit:
589
+ authorizationUrl: https://galaxy.scalar.com/oauth/authorize
590
+ scopes:
591
+ read:account: read your account information
592
+ write:planets: modify planets in your account
593
+ read:planets: read your planets
594
+ # Legacy
595
+ password:
596
+ tokenUrl: https://galaxy.scalar.com/oauth/token
597
+ scopes:
598
+ read:account: read your account information
599
+ write:planets: modify planets in your account
600
+ read:planets: read your planets
601
+ openIdConnect:
602
+ type: openIdConnect
603
+ openIdConnectUrl: https://galaxy.scalar.com/.well-known/openid-configuration
604
+ description: OpenID Connect Authentication
605
+ parameters:
606
+ planetId:
607
+ name: planetId
608
+ description: The ID of the planet to get
609
+ in: path
610
+ required: true
611
+ schema:
612
+ type: integer
613
+ format: int64
614
+ examples:
615
+ - 1
616
+ limit:
617
+ name: limit
618
+ description: The number of items to return
619
+ in: query
620
+ required: false
621
+ schema:
622
+ type: integer
623
+ format: int64
624
+ default: 10
625
+ offset:
626
+ name: offset
627
+ description: The number of items to skip before starting to collect the result set
628
+ in: query
629
+ required: false
630
+ schema:
631
+ type: integer
632
+ format: int64
633
+ default: 0
634
+ headers:
635
+ X-RateLimit-Limit:
636
+ description: The number of allowed requests in the current period
637
+ schema:
638
+ type: integer
639
+ example: 100
640
+ X-RateLimit-Remaining:
641
+ description: The number of remaining requests in the current period
642
+ schema:
643
+ type: integer
644
+ example: 95
645
+ X-RateLimit-Reset:
646
+ description: The number of seconds left in the current period
647
+ schema:
648
+ type: integer
649
+ example: 3600
650
+ X-Request-ID:
651
+ description: Unique identifier for the request
652
+ schema:
653
+ type: string
654
+ format: uuid
655
+ example: 123e4567-e89b-12d3-a456-426614174000
656
+ X-Pagination-Total:
657
+ description: Total number of items available
658
+ schema:
659
+ type: integer
660
+ example: 1000
661
+ X-Pagination-Page:
662
+ description: Current page number
663
+ schema:
664
+ type: integer
665
+ example: 1
666
+ X-Pagination-Per-Page:
667
+ description: Number of items per page
668
+ schema:
669
+ type: integer
670
+ example: 10
671
+ X-Cache-Control:
672
+ description: Cache control directives
673
+ schema:
674
+ type: string
675
+ example: max-age=3600, public
676
+ ETag:
677
+ description: Entity tag for caching
678
+ schema:
679
+ type: string
680
+ example: '"33a64df551"'
681
+ Last-Modified:
682
+ description: The last modification date of the resource
683
+ schema:
684
+ type: string
685
+ format: date-time
686
+ example: 2023-12-01T12:00:00Z
687
+ Location:
688
+ description: The URL of the newly created resource
689
+ schema:
690
+ type: string
691
+ format: uri
692
+ example: https://galaxy.scalar.com/planets/123
693
+ X-Processing-Time:
694
+ description: The time taken to process the request in milliseconds
695
+ schema:
696
+ type: integer
697
+ example: 150
698
+ responses:
699
+ ImageUploaded:
700
+ description: Image uploaded
701
+ headers:
702
+ X-Request-ID:
703
+ $ref: '#/components/headers/X-Request-ID'
704
+ X-Cache-Control:
705
+ $ref: '#/components/headers/X-Cache-Control'
706
+ content:
707
+ application/json:
708
+ schema:
709
+ $ref: '#/components/schemas/ImageUploadedMessage'
710
+ application/xml:
711
+ schema:
712
+ $ref: '#/components/schemas/ImageUploadedMessage'
713
+ BadRequest:
714
+ description: Bad Request
715
+ headers:
716
+ X-Request-ID:
717
+ $ref: '#/components/headers/X-Request-ID'
718
+ content:
719
+ application/json:
720
+ schema:
721
+ $ref: '#/components/schemas/BadRequestError'
722
+ application/xml:
723
+ schema:
724
+ $ref: '#/components/schemas/BadRequestError'
725
+ Forbidden:
726
+ description: Forbidden
727
+ content:
728
+ application/json:
729
+ schema:
730
+ $ref: '#/components/schemas/ForbiddenError'
731
+ application/xml:
732
+ schema:
733
+ $ref: '#/components/schemas/ForbiddenError'
734
+ NotFound:
735
+ description: Not Found
736
+ content:
737
+ application/json:
738
+ schema:
739
+ $ref: '#/components/schemas/NotFoundError'
740
+ application/xml:
741
+ schema:
742
+ $ref: '#/components/schemas/NotFoundError'
743
+ Unauthorized:
744
+ description: Unauthorized
745
+ content:
746
+ application/json:
747
+ schema:
748
+ $ref: '#/components/schemas/UnauthorizedError'
749
+ application/xml:
750
+ schema:
751
+ $ref: '#/components/schemas/UnauthorizedError'
752
+ Conflict:
753
+ description: Conflict
754
+ content:
755
+ application/json:
756
+ schema:
757
+ $ref: '#/components/schemas/Conflict'
758
+ application/xml:
759
+ schema:
760
+ $ref: '#/components/schemas/Conflict'
761
+ UnprocessableEntity:
762
+ description: Unprocessable Entity
763
+ content:
764
+ application/json:
765
+ schema:
766
+ $ref: '#/components/schemas/UnprocessableEntity'
767
+ application/xml:
768
+ schema:
769
+ $ref: '#/components/schemas/UnprocessableEntity'
770
+ TooManyRequests:
771
+ description: Too Many Requests
772
+ headers:
773
+ X-Request-ID:
774
+ $ref: '#/components/headers/X-Request-ID'
775
+ X-RateLimit-Limit:
776
+ $ref: '#/components/headers/X-RateLimit-Limit'
777
+ X-RateLimit-Remaining:
778
+ $ref: '#/components/headers/X-RateLimit-Remaining'
779
+ X-RateLimit-Reset:
780
+ $ref: '#/components/headers/X-RateLimit-Reset'
781
+ Retry-After:
782
+ description: The number of seconds to wait before retrying
783
+ schema:
784
+ type: integer
785
+ example: 60
786
+ content:
787
+ application/json:
788
+ schema:
789
+ $ref: '#/components/schemas/TooManyRequestsError'
790
+ application/xml:
791
+ schema:
792
+ $ref: '#/components/schemas/TooManyRequestsError'
793
+ schemas:
794
+ User:
795
+ description: A user
796
+ type: object
797
+ xml:
798
+ name: user
799
+ properties:
800
+ id:
801
+ type: integer
802
+ format: int64
803
+ readOnly: true
804
+ examples:
805
+ - 1
806
+ name:
807
+ type: string
808
+ examples:
809
+ - Marc
810
+ - Cam
811
+ - Hans
812
+ Credentials:
813
+ description: Credentials to authenticate a user
814
+ type: object
815
+ required:
816
+ - email
817
+ - password
818
+ properties:
819
+ email:
820
+ type: string
821
+ format: email
822
+ examples:
823
+ - marc@scalar.com
824
+ - cam@scalar.com
825
+ - hans@scalar.com
826
+ password:
827
+ type: string
828
+ writeOnly: true
829
+ examples:
830
+ - i-love-scalar
831
+ - i-love-oss
832
+ - qwerty123
833
+ Token:
834
+ description: A token to authenticate a user
835
+ type: object
836
+ properties:
837
+ token:
838
+ type: string
839
+ examples:
840
+ - eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
841
+ CelestialBody:
842
+ oneOf:
843
+ - $ref: '#/components/schemas/Planet'
844
+ - $ref: '#/components/schemas/Satellite'
845
+ discriminator:
846
+ propertyName: type
847
+ mapping:
848
+ terrestrial: '#/components/schemas/Planet'
849
+ gas_giant: '#/components/schemas/Planet'
850
+ ice_giant: '#/components/schemas/Planet'
851
+ dwarf: '#/components/schemas/Planet'
852
+ super_earth: '#/components/schemas/Planet'
853
+ moon: '#/components/schemas/Satellite'
854
+ asteroid: '#/components/schemas/Satellite'
855
+ comet: '#/components/schemas/Satellite'
856
+ description: A celestial body which can be either a planet or a satellite
857
+ Planet:
858
+ description: A planet in the Scalar Galaxy
859
+ type: object
860
+ required:
861
+ - id
862
+ - name
863
+ additionalProperties: false
864
+ xml:
865
+ name: planet
866
+ properties:
867
+ id:
868
+ type: integer
869
+ format: int64
870
+ readOnly: true
871
+ examples:
872
+ - 1
873
+ x-variable: planetId
874
+ name:
875
+ type: string
876
+ examples:
877
+ - Mars
878
+ - Jupiter
879
+ - HD 40307g
880
+ description:
881
+ type:
882
+ - string
883
+ - 'null'
884
+ examples:
885
+ - The red planet
886
+ - A gas giant with a great red spot
887
+ type:
888
+ type: string
889
+ enum:
890
+ - terrestrial
891
+ - gas_giant
892
+ - ice_giant
893
+ - dwarf
894
+ - super_earth
895
+ x-enum-varnames:
896
+ - Terrestrial
897
+ - GasGiant
898
+ - IceGiant
899
+ - Dwarf
900
+ - SuperEarth
901
+ x-enum-descriptions:
902
+ terrestrial: Rocky planets with solid surfaces, like Earth and Mars
903
+ gas_giant:
904
+ Large planets composed mainly of hydrogen and helium, like Jupiter
905
+ and Saturn
906
+ ice_giant:
907
+ Planets composed of water, ammonia, and methane ices, like Uranus and
908
+ Neptune
909
+ dwarf: Small planetary bodies that don't meet full planet criteria, like Pluto
910
+ super_earth: Rocky planets larger than Earth but smaller than gas giants
911
+ examples:
912
+ - terrestrial
913
+ habitabilityIndex:
914
+ type: number
915
+ format: float
916
+ minimum: 0
917
+ maximum: 1
918
+ description: A score from 0 to 1 indicating potential habitability
919
+ examples:
920
+ - 0.68
921
+ physicalProperties:
922
+ type: object
923
+ additionalProperties:
924
+ x-additionalPropertiesName: measurement
925
+ type: number
926
+ format: float
927
+ description: Additional physical measurements for the planet
928
+ properties:
929
+ mass:
930
+ type: number
931
+ format: float
932
+ exclusiveMinimum: 0
933
+ description: Mass in Earth masses (must be greater than 0)
934
+ examples:
935
+ - 0.107
936
+ radius:
937
+ type: number
938
+ format: float
939
+ exclusiveMinimum: 0
940
+ description: Radius in Earth radii (must be greater than 0)
941
+ examples:
942
+ - 0.532
943
+ gravity:
944
+ type: number
945
+ format: float
946
+ description: Surface gravity in Earth g
947
+ examples:
948
+ - 0.378
949
+ temperature:
950
+ type: object
951
+ additionalProperties:
952
+ x-additionalPropertiesName: temperatureMetric
953
+ type: number
954
+ format: float
955
+ description: Additional temperature-related measurements in Kelvin
956
+ properties:
957
+ min:
958
+ type: number
959
+ format: float
960
+ description: Minimum temperature in Kelvin
961
+ examples:
962
+ - 130
963
+ max:
964
+ type: number
965
+ format: float
966
+ description: Maximum temperature in Kelvin
967
+ examples:
968
+ - 308
969
+ average:
970
+ type: number
971
+ format: float
972
+ description: Average temperature in Kelvin
973
+ examples:
974
+ - 210
975
+ atmosphere:
976
+ type: array
977
+ description: Atmospheric composition
978
+ items:
979
+ type: object
980
+ additionalProperties:
981
+ x-additionalPropertiesName: atmosphericData
982
+ type: string
983
+ description: Additional atmospheric composition data
984
+ properties:
985
+ compound:
986
+ type: string
987
+ examples:
988
+ - CO2
989
+ - N2
990
+ percentage:
991
+ type: number
992
+ format: float
993
+ exclusiveMaximum: 100
994
+ examples:
995
+ - 95.3
996
+ discoveredAt:
997
+ type: string
998
+ format: date-time
999
+ examples:
1000
+ - 1610-01-07T00:00:00Z
1001
+ image:
1002
+ type:
1003
+ - string
1004
+ - 'null'
1005
+ examples:
1006
+ - https://cdn.scalar.com/photos/mars.jpg
1007
+ satellites:
1008
+ type: array
1009
+ items:
1010
+ $ref: '#/components/schemas/Satellite'
1011
+ creator:
1012
+ $ref: '#/components/schemas/User'
1013
+ tags:
1014
+ type: array
1015
+ items:
1016
+ type: string
1017
+ examples:
1018
+ - - solar-system
1019
+ - rocky
1020
+ - explored
1021
+ lastUpdated:
1022
+ type: string
1023
+ format: date-time
1024
+ readOnly: true
1025
+ examples:
1026
+ - 2024-01-15T14:30:00Z
1027
+ successCallbackUrl:
1028
+ type: string
1029
+ format: uri
1030
+ description: URL which gets invoked upon a successful operation
1031
+ examples:
1032
+ - https://example.com/webhook
1033
+ failureCallbackUrl:
1034
+ type: string
1035
+ format: uri
1036
+ description: URL which gets invoked upon a failed operation
1037
+ examples:
1038
+ - https://example.com/webhook
1039
+ Satellite:
1040
+ description: Every satellite in the Scalar Galaxy
1041
+ type: object
1042
+ required:
1043
+ - name
1044
+ properties:
1045
+ id:
1046
+ type: integer
1047
+ format: int64
1048
+ readOnly: true
1049
+ examples:
1050
+ - 1
1051
+ name:
1052
+ type: string
1053
+ examples:
1054
+ - Phobos
1055
+ description:
1056
+ type:
1057
+ - string
1058
+ - 'null'
1059
+ examples:
1060
+ - Phobos is the larger and innermost of the two moons of Mars.
1061
+ diameter:
1062
+ type: number
1063
+ format: float
1064
+ description: Diameter in kilometers
1065
+ examples:
1066
+ - 22.2
1067
+ type:
1068
+ type: string
1069
+ enum:
1070
+ - moon
1071
+ - asteroid
1072
+ - comet
1073
+ x-enum-varnames:
1074
+ - Moon
1075
+ - Asteroid
1076
+ - Comet
1077
+ x-enum-descriptions:
1078
+ moon: Natural satellites that orbit planets
1079
+ asteroid: Rocky objects that orbit the sun, typically found in the asteroid belt
1080
+ comet:
1081
+ Icy bodies that release gas when approaching the sun, creating visible
1082
+ tails
1083
+ examples:
1084
+ - moon
1085
+ orbit:
1086
+ type: object
1087
+ properties:
1088
+ planet:
1089
+ $ref: '#/components/schemas/Planet'
1090
+ orbitalPeriod:
1091
+ type: number
1092
+ format: float
1093
+ description: Orbital period in Earth days
1094
+ examples:
1095
+ - 0.319
1096
+ distance:
1097
+ type: number
1098
+ format: float
1099
+ description: Average distance from the planet in kilometers
1100
+ examples:
1101
+ - 9376
1102
+ PaginatedResource:
1103
+ description: A paginated resource
1104
+ type: object
1105
+ properties:
1106
+ meta:
1107
+ type: object
1108
+ properties:
1109
+ limit:
1110
+ type: integer
1111
+ format: int64
1112
+ examples:
1113
+ - 10
1114
+ offset:
1115
+ type: integer
1116
+ format: int64
1117
+ examples:
1118
+ - 0
1119
+ total:
1120
+ type: integer
1121
+ format: int64
1122
+ examples:
1123
+ - 100
1124
+ next:
1125
+ type:
1126
+ - string
1127
+ - 'null'
1128
+ examples:
1129
+ - /planets?limit=10&offset=10
1130
+ ImageUploadedMessage:
1131
+ x-scalar-ignore: true
1132
+ description: Message about an image upload
1133
+ type: object
1134
+ properties:
1135
+ message:
1136
+ type: string
1137
+ examples:
1138
+ - Image uploaded successfully
1139
+ imageUrl:
1140
+ type: string
1141
+ description: The URL where the uploaded image can be accessed
1142
+ examples:
1143
+ - https://cdn.scalar.com/images/8f47c132-9d1f-4f83-b5a4-91db5ee757ab.jpg
1144
+ uploadedAt:
1145
+ type: string
1146
+ format: date-time
1147
+ description: Timestamp when the image was uploaded
1148
+ examples:
1149
+ - 2024-01-15T14:30:00Z
1150
+ fileSize:
1151
+ type: integer
1152
+ description: Size of the uploaded image in bytes
1153
+ examples:
1154
+ - 1048576
1155
+ mimeType:
1156
+ type: string
1157
+ description: The content type of the uploaded image
1158
+ examples:
1159
+ - image/jpeg
1160
+ - image/png
1161
+ BadRequestError:
1162
+ x-scalar-ignore: true
1163
+ description: RFC 7807 (https://datatracker.ietf.org/doc/html/rfc7807)
1164
+ type: object
1165
+ properties:
1166
+ type:
1167
+ type: string
1168
+ examples:
1169
+ - https://example.com/errors/bad-request
1170
+ title:
1171
+ type: string
1172
+ examples:
1173
+ - Bad Request
1174
+ status:
1175
+ type: integer
1176
+ format: int64
1177
+ examples:
1178
+ - 400
1179
+ detail:
1180
+ type: string
1181
+ examples:
1182
+ - The request was invalid.
1183
+ ForbiddenError:
1184
+ x-scalar-ignore: true
1185
+ description: Error response for forbidden access (RFC 7807). Returned when the user does not have permission to access the requested resource.
1186
+ type: object
1187
+ properties:
1188
+ type:
1189
+ type: string
1190
+ examples:
1191
+ - https://example.com/errors/forbidden
1192
+ title:
1193
+ type: string
1194
+ examples:
1195
+ - Forbidden
1196
+ status:
1197
+ type: integer
1198
+ format: int64
1199
+ examples:
1200
+ - 403
1201
+ detail:
1202
+ type: string
1203
+ examples:
1204
+ - You are not authorized to access this resource.
1205
+ NotFoundError:
1206
+ x-scalar-ignore: true
1207
+ description: Error response for resource not found (RFC 7807). Returned when the requested resource does not exist.
1208
+ type: object
1209
+ properties:
1210
+ type:
1211
+ type: string
1212
+ examples:
1213
+ - https://example.com/errors/not-found
1214
+ title:
1215
+ type: string
1216
+ examples:
1217
+ - Not Found
1218
+ status:
1219
+ type: integer
1220
+ format: int64
1221
+ examples:
1222
+ - 404
1223
+ detail:
1224
+ type: string
1225
+ examples:
1226
+ - The resource you are trying to access does not exist.
1227
+ UnauthorizedError:
1228
+ x-scalar-ignore: true
1229
+ description: Error response for unauthorized access (RFC 7807). Returned when authentication is required or has failed.
1230
+ type: object
1231
+ properties:
1232
+ type:
1233
+ type: string
1234
+ examples:
1235
+ - https://example.com/errors/not-found
1236
+ title:
1237
+ type: string
1238
+ examples:
1239
+ - Unauthorized
1240
+ status:
1241
+ type: integer
1242
+ format: int64
1243
+ examples:
1244
+ - 401
1245
+ detail:
1246
+ type: string
1247
+ examples:
1248
+ - You are not authorized to access this resource.
1249
+ Conflict:
1250
+ x-scalar-ignore: true
1251
+ description: Error response for resource conflicts (RFC 7807). Returned when the request conflicts with the current state of the resource.
1252
+ type: object
1253
+ properties:
1254
+ type:
1255
+ type: string
1256
+ examples:
1257
+ - https://example.com/errors/conflict
1258
+ title:
1259
+ type: string
1260
+ examples:
1261
+ - Conflict
1262
+ status:
1263
+ type: integer
1264
+ format: int64
1265
+ examples:
1266
+ - 409
1267
+ detail:
1268
+ type: string
1269
+ examples:
1270
+ - The resource you are trying to access is in conflict.
1271
+ UnprocessableEntity:
1272
+ x-scalar-ignore: true
1273
+ description: Error response for unprocessable entity (RFC 7807). Returned when the request is well-formed but contains semantic errors.
1274
+ type: object
1275
+ properties:
1276
+ type:
1277
+ type: string
1278
+ examples:
1279
+ - https://example.com/errors/unprocessable-entity
1280
+ title:
1281
+ type: string
1282
+ examples:
1283
+ - Unprocessable Entity
1284
+ status:
1285
+ type: integer
1286
+ format: int64
1287
+ examples:
1288
+ - 422
1289
+ detail:
1290
+ type: string
1291
+ examples:
1292
+ - The request was invalid.
1293
+ TooManyRequestsError:
1294
+ x-scalar-ignore: true
1295
+ description: Error response for rate limiting (RFC 7807). Returned when the client has exceeded the rate limit for requests.
1296
+ type: object
1297
+ properties:
1298
+ type:
1299
+ type: string
1300
+ examples:
1301
+ - https://example.com/errors/too-many-requests
1302
+ title:
1303
+ type: string
1304
+ examples:
1305
+ - Too Many Requests
1306
+ status:
1307
+ type: integer
1308
+ format: int64
1309
+ examples:
1310
+ - 429
1311
+ detail:
1312
+ type: string
1313
+ examples:
1314
+ - Rate limit exceeded. Please try again later.