@scalar/cli 2.0.1 → 2.5.1
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.
- package/README.md +68 -24
- package/chunks/action-37EV4UHW.js +125 -0
- package/chunks/action-4XI7XJR4.js +204 -0
- package/chunks/action-5IU77OII.js +60 -0
- package/chunks/action-B3KKREWQ.js +64 -0
- package/chunks/action-CH24QGTE.js +86 -0
- package/chunks/action-F3UX5E3M.js +522 -0
- package/chunks/action-FDB7NEOK.js +81 -0
- package/chunks/action-FIXBOJEW.js +244 -0
- package/chunks/action-G26LSVZ7.js +40 -0
- package/chunks/action-H3RTILLM.js +46 -0
- package/chunks/action-HGBBV353.js +86 -0
- package/chunks/action-IUE4IOWO.js +2142 -0
- package/chunks/action-JZLZ7ZAD.js +110 -0
- package/chunks/action-LA6KVAXQ.js +374 -0
- package/chunks/action-M7RQKBSB.js +169 -0
- package/chunks/action-MSLBC2SO.js +92 -0
- package/chunks/action-NVSZT2ZD.js +37 -0
- package/chunks/action-OGQSTRMX.js +37 -0
- package/chunks/action-PAGJ5PWC.js +60 -0
- package/chunks/action-QE2ZQQX7.js +250 -0
- package/chunks/action-QPUSPD5M.js +54 -0
- package/chunks/action-R7IMFHQ5.js +147 -0
- package/chunks/action-SH4UUXPL.js +60 -0
- package/chunks/action-SNLCIBQC.js +84 -0
- package/chunks/action-SQG3JAII.js +150 -0
- package/chunks/action-UZQJNYK4.js +18 -0
- package/chunks/action-VC4DCVST.js +68 -0
- package/chunks/action-VTVFY2MP.js +181 -0
- package/chunks/action-WFWYGY7O.js +67 -0
- package/chunks/action-XMNX5ZYT.js +197 -0
- package/chunks/agent-HCQRMHQ5.js +132 -0
- package/chunks/asyncapi-QM76O55R.js +105 -0
- package/chunks/build.action-P7FCIMYU.js +108 -0
- package/chunks/chunk-24WAOKGG.js +105 -0
- package/chunks/chunk-3L6DLIXJ.js +25530 -0
- package/chunks/chunk-3MZYUBJ6.js +49 -0
- package/chunks/chunk-3ZJYGGAA.js +30 -0
- package/chunks/chunk-4NHMAG6F.js +21 -0
- package/chunks/chunk-4ORL4MST.js +16 -0
- package/chunks/chunk-4ZDQXWBT.js +26 -0
- package/chunks/chunk-6ZMT63IV.js +19 -0
- package/chunks/chunk-7AGLC7WV.js +107 -0
- package/chunks/chunk-AEFPCC4U.js +16 -0
- package/chunks/chunk-AO3F5XWR.js +3147 -0
- package/chunks/chunk-B2MHTD3R.js +90 -0
- package/chunks/chunk-CISTON3A.js +153 -0
- package/chunks/chunk-COBPBRQF.js +25 -0
- package/chunks/chunk-F467BYYR.js +568 -0
- package/chunks/chunk-GSGZHE26.js +352 -0
- package/chunks/chunk-HCPN3KNF.js +637 -0
- package/chunks/chunk-HPL3ZZ2P.js +1726 -0
- package/chunks/chunk-IKT5F47M.js +17344 -0
- package/chunks/chunk-JFIXNSPP.js +26 -0
- package/chunks/chunk-K4DTP5TV.js +32 -0
- package/chunks/chunk-K74E42RV.js +7311 -0
- package/chunks/chunk-KHDYYVYF.js +16 -0
- package/chunks/chunk-LFU5ZUAP.js +350 -0
- package/chunks/chunk-M37TP6U2.js +445 -0
- package/chunks/chunk-OQKDBLOZ.js +741 -0
- package/chunks/chunk-P7H7GY5A.js +14 -0
- package/chunks/chunk-PBXZN65A.js +63911 -0
- package/chunks/chunk-PT5TI77I.js +34 -0
- package/chunks/chunk-Q7DOQHZN.js +404 -0
- package/chunks/chunk-T5HJUAWB.js +242 -0
- package/chunks/chunk-T7B6WNZC.js +18 -0
- package/chunks/chunk-UGGNHILG.js +38 -0
- package/chunks/chunk-VNYE4R7N.js +499 -0
- package/chunks/chunk-X5T526CE.js +23 -0
- package/chunks/chunk-XCSR4RIT.js +210 -0
- package/chunks/chunk-Z2KMGFE6.js +295 -0
- package/chunks/create.action-HDD2WUON.js +108 -0
- package/chunks/delete.action-7GOZY7ID.js +88 -0
- package/chunks/delete.action-VE66JFDS.js +96 -0
- package/chunks/get.action-2745EB4N.js +86 -0
- package/chunks/list.action-3VTXQJRA.js +116 -0
- package/chunks/list.action-4QDCZLSZ.js +95 -0
- package/chunks/publish.action-ULQLZKWU.js +190 -0
- package/chunks/update.action-6QEFP7NA.js +95 -0
- package/chunks/update.action-OROQSP2S.js +101 -0
- package/docs.html +352 -250
- package/index.js +664 -99064
- package/package.json +17 -11
|
@@ -0,0 +1,2142 @@
|
|
|
1
|
+
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
CONFIG_FILE_DEFAULT,
|
|
4
|
+
DEFAULT_MARKDOWN_FILE_NAME,
|
|
5
|
+
DEFAULT_OPENAPI_FILE_NAME,
|
|
6
|
+
findConfig,
|
|
7
|
+
getCurrentFolderName,
|
|
8
|
+
scalarConfigSchema
|
|
9
|
+
} from "./chunk-PBXZN65A.js";
|
|
10
|
+
import {
|
|
11
|
+
apiService
|
|
12
|
+
} from "./chunk-AO3F5XWR.js";
|
|
13
|
+
import "./chunk-HCPN3KNF.js";
|
|
14
|
+
import "./chunk-B2MHTD3R.js";
|
|
15
|
+
import "./chunk-3L6DLIXJ.js";
|
|
16
|
+
import "./chunk-P7H7GY5A.js";
|
|
17
|
+
import "./chunk-HPL3ZZ2P.js";
|
|
18
|
+
import {
|
|
19
|
+
getMetadata
|
|
20
|
+
} from "./chunk-M37TP6U2.js";
|
|
21
|
+
import {
|
|
22
|
+
config
|
|
23
|
+
} from "./chunk-4ZDQXWBT.js";
|
|
24
|
+
import "./chunk-VNYE4R7N.js";
|
|
25
|
+
import "./chunk-OQKDBLOZ.js";
|
|
26
|
+
import "./chunk-K74E42RV.js";
|
|
27
|
+
import "./chunk-CISTON3A.js";
|
|
28
|
+
import "./chunk-Q7DOQHZN.js";
|
|
29
|
+
import "./chunk-4ORL4MST.js";
|
|
30
|
+
import {
|
|
31
|
+
output
|
|
32
|
+
} from "./chunk-T5HJUAWB.js";
|
|
33
|
+
import "./chunk-GSGZHE26.js";
|
|
34
|
+
import {
|
|
35
|
+
slugify
|
|
36
|
+
} from "./chunk-IKT5F47M.js";
|
|
37
|
+
import "./chunk-3MZYUBJ6.js";
|
|
38
|
+
|
|
39
|
+
// src/domains/project/init/action.ts
|
|
40
|
+
import fs from "node:fs/promises";
|
|
41
|
+
import path from "node:path";
|
|
42
|
+
import { cancel, confirm, isCancel, text } from "@clack/prompts";
|
|
43
|
+
import as from "ansis";
|
|
44
|
+
|
|
45
|
+
// ../../node_modules/.pnpm/@scalar+galaxy@0.7.0/node_modules/@scalar/galaxy/dist/3.1.json
|
|
46
|
+
var __default = {
|
|
47
|
+
openapi: "3.1.1",
|
|
48
|
+
info: {
|
|
49
|
+
title: "Scalar Galaxy",
|
|
50
|
+
description: "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.\n\n## Resources\n\n* https://github.com/scalar/scalar\n* https://github.com/OAI/OpenAPI-Specification\n* https://scalar.com\n\n## Markdown Support\n\nAll 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.\n\n<details>\n <summary>Examples</summary>\n\n **Blockquotes**\n\n > I love OpenAPI. <3\n\n **Tables**\n\n | Feature | Availability |\n | ---------------- | ------------ |\n | Markdown Support | \u2713 |\n\n **Accordion**\n\n ```html\n <details>\n <summary>Using Details Tags</summary>\n <p>HTML Example</p>\n </details>\n ```\n\n **Images**\n\n Yes, there's support for images, too!\n\n \n\n **Alerts**\n\n > [!tip]\n > You can use Markdown alerts in your descriptions.\n\n</details>\n",
|
|
51
|
+
version: "0.7.0",
|
|
52
|
+
contact: {
|
|
53
|
+
name: "Scalar Support",
|
|
54
|
+
url: "https://scalar.com",
|
|
55
|
+
email: "support@scalar.com"
|
|
56
|
+
},
|
|
57
|
+
license: {
|
|
58
|
+
name: "MIT",
|
|
59
|
+
url: "https://opensource.org/license/MIT"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
externalDocs: {
|
|
63
|
+
description: "Documentation",
|
|
64
|
+
url: "https://github.com/scalar/scalar"
|
|
65
|
+
},
|
|
66
|
+
servers: [
|
|
67
|
+
{
|
|
68
|
+
url: "https://galaxy.scalar.com"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
url: "{protocol}://void.scalar.com/{path}",
|
|
72
|
+
description: "Responds with your request data",
|
|
73
|
+
variables: {
|
|
74
|
+
protocol: {
|
|
75
|
+
enum: [
|
|
76
|
+
"https",
|
|
77
|
+
"http"
|
|
78
|
+
],
|
|
79
|
+
default: "https"
|
|
80
|
+
},
|
|
81
|
+
path: {
|
|
82
|
+
default: ""
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
],
|
|
87
|
+
security: [
|
|
88
|
+
{
|
|
89
|
+
bearerAuth: []
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
basicAuth: []
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
apiKeyQuery: []
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
apiKeyHeader: []
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
apiKeyHeader: [],
|
|
102
|
+
apiKeyQuery: []
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
apiKeyCookie: []
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
oAuth2: []
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
openIdConnect: []
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
"x-speakeasy-webhooks": {
|
|
115
|
+
security: {
|
|
116
|
+
type: "signature",
|
|
117
|
+
headerName: "x-signature",
|
|
118
|
+
signatureTextEncoding: "base64",
|
|
119
|
+
algorithm: "hmac-sha256"
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
tags: [
|
|
123
|
+
{
|
|
124
|
+
name: "Authentication",
|
|
125
|
+
description: "Some endpoints are public, but some require authentication. We provide all the required endpoints to create an account and authorize yourself."
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
name: "Planets",
|
|
129
|
+
description: "Everything about planets"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
name: "Celestial Bodies",
|
|
133
|
+
description: "Celestial bodies are the planets and satellites in the Scalar Galaxy."
|
|
134
|
+
}
|
|
135
|
+
],
|
|
136
|
+
paths: {
|
|
137
|
+
"/planets": {
|
|
138
|
+
get: {
|
|
139
|
+
tags: [
|
|
140
|
+
"Planets"
|
|
141
|
+
],
|
|
142
|
+
summary: "Get all planets",
|
|
143
|
+
description: "It's easy to say you know them all, but do you really? Retrieve all the planets and check whether you missed one.",
|
|
144
|
+
operationId: "getAllData",
|
|
145
|
+
security: [],
|
|
146
|
+
parameters: [
|
|
147
|
+
{
|
|
148
|
+
$ref: "#/components/parameters/limit"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
$ref: "#/components/parameters/offset"
|
|
152
|
+
}
|
|
153
|
+
],
|
|
154
|
+
responses: {
|
|
155
|
+
"200": {
|
|
156
|
+
description: "OK",
|
|
157
|
+
headers: {
|
|
158
|
+
"X-Request-ID": {
|
|
159
|
+
$ref: "#/components/headers/X-Request-ID"
|
|
160
|
+
},
|
|
161
|
+
"X-Pagination-Total": {
|
|
162
|
+
$ref: "#/components/headers/X-Pagination-Total"
|
|
163
|
+
},
|
|
164
|
+
"X-Pagination-Page": {
|
|
165
|
+
$ref: "#/components/headers/X-Pagination-Page"
|
|
166
|
+
},
|
|
167
|
+
"X-Pagination-Per-Page": {
|
|
168
|
+
$ref: "#/components/headers/X-Pagination-Per-Page"
|
|
169
|
+
},
|
|
170
|
+
"X-Cache-Control": {
|
|
171
|
+
$ref: "#/components/headers/X-Cache-Control"
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
content: {
|
|
175
|
+
"application/json": {
|
|
176
|
+
schema: {
|
|
177
|
+
$id: "https://galaxy.scalar.com/schemas/PaginatedPlanets",
|
|
178
|
+
$defs: {
|
|
179
|
+
itemType: {
|
|
180
|
+
$dynamicAnchor: "itemType",
|
|
181
|
+
$ref: "#/components/schemas/Planet"
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
$ref: "#/components/schemas/PaginatedResource"
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
"application/xml": {
|
|
188
|
+
schema: {
|
|
189
|
+
$id: "https://galaxy.scalar.com/schemas/PaginatedPlanetsXml",
|
|
190
|
+
xml: {
|
|
191
|
+
name: "planets"
|
|
192
|
+
},
|
|
193
|
+
$defs: {
|
|
194
|
+
itemType: {
|
|
195
|
+
$dynamicAnchor: "itemType",
|
|
196
|
+
$ref: "#/components/schemas/Planet"
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
$ref: "#/components/schemas/PaginatedResource"
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
"x-post-response": 'pm.test("Status code is 200", () => {\n pm.response.to.have.status(200);\n});\n\npm.test("Content-Type header is present", () => {\n pm.response.to.have.header("Content-Type");\n});\n\npm.test("Response has data array and meta", () => {\n const jsonData = pm.response.json();\n pm.expect(jsonData).to.have.property("data");\n pm.expect(jsonData.data).to.be.an("array");\n pm.expect(jsonData).to.have.property("meta");\n});\n'
|
|
206
|
+
},
|
|
207
|
+
post: {
|
|
208
|
+
tags: [
|
|
209
|
+
"Planets"
|
|
210
|
+
],
|
|
211
|
+
summary: "Create a planet",
|
|
212
|
+
description: "Time to play god and create a new planet. What do you think? Ah, don't think too much. What could go wrong anyway?",
|
|
213
|
+
operationId: "createPlanet",
|
|
214
|
+
callbacks: {
|
|
215
|
+
planetCreated: {
|
|
216
|
+
"{$request.body#/successCallbackUrl}": {
|
|
217
|
+
post: {
|
|
218
|
+
security: [],
|
|
219
|
+
requestBody: {
|
|
220
|
+
description: "Information about the newly created planet",
|
|
221
|
+
content: {
|
|
222
|
+
"application/json": {
|
|
223
|
+
schema: {
|
|
224
|
+
$ref: "#/components/schemas/Planet"
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
responses: {
|
|
230
|
+
"200": {
|
|
231
|
+
description: "Your server returns this code if it accepts the callback"
|
|
232
|
+
},
|
|
233
|
+
"204": {
|
|
234
|
+
description: "Your server should return this HTTP status code if no longer interested in further updates"
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
planetCreationFailed: {
|
|
241
|
+
"{$request.body#/failureCallbackUrl}": {
|
|
242
|
+
post: {
|
|
243
|
+
security: [],
|
|
244
|
+
requestBody: {
|
|
245
|
+
description: "Information about which fields failed to validate",
|
|
246
|
+
content: {
|
|
247
|
+
"application/json": {
|
|
248
|
+
schema: {
|
|
249
|
+
$ref: "#/components/schemas/Planet"
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
responses: {
|
|
255
|
+
"200": {
|
|
256
|
+
description: "Your server returns this code if it accepts the failure callback notification"
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
planetExploded: {
|
|
263
|
+
"{$request.body#/successCallbackUrl}": {
|
|
264
|
+
post: {
|
|
265
|
+
security: [],
|
|
266
|
+
requestBody: {
|
|
267
|
+
description: "Information about the newly exploded planet",
|
|
268
|
+
content: {
|
|
269
|
+
"application/json": {
|
|
270
|
+
schema: {
|
|
271
|
+
$ref: "#/components/schemas/Planet"
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
responses: {
|
|
277
|
+
"200": {
|
|
278
|
+
description: "Your server returns this code if it accepts the planet explosion callback notification"
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
requestBody: {
|
|
286
|
+
description: "Planet",
|
|
287
|
+
content: {
|
|
288
|
+
"application/json": {
|
|
289
|
+
schema: {
|
|
290
|
+
$ref: "#/components/schemas/Planet"
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
"application/xml": {
|
|
294
|
+
schema: {
|
|
295
|
+
$ref: "#/components/schemas/Planet"
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
responses: {
|
|
301
|
+
"201": {
|
|
302
|
+
description: "Created",
|
|
303
|
+
headers: {
|
|
304
|
+
"X-Request-ID": {
|
|
305
|
+
$ref: "#/components/headers/X-Request-ID"
|
|
306
|
+
},
|
|
307
|
+
Location: {
|
|
308
|
+
$ref: "#/components/headers/Location"
|
|
309
|
+
},
|
|
310
|
+
"X-Processing-Time": {
|
|
311
|
+
$ref: "#/components/headers/X-Processing-Time"
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
content: {
|
|
315
|
+
"application/json": {
|
|
316
|
+
schema: {
|
|
317
|
+
$ref: "#/components/schemas/Planet"
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
"application/xml": {
|
|
321
|
+
schema: {
|
|
322
|
+
$ref: "#/components/schemas/Planet"
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
},
|
|
327
|
+
"400": {
|
|
328
|
+
$ref: "#/components/responses/BadRequest"
|
|
329
|
+
},
|
|
330
|
+
"403": {
|
|
331
|
+
$ref: "#/components/responses/Forbidden"
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
"x-post-response": 'pm.test("Status code is 201", () => {\n pm.response.to.have.status(201);\n});\n\npm.test("Content-Type header is present", () => {\n pm.response.to.have.header("Content-Type");\n});\n\npm.test("Response is a planet with id and name", () => {\n const jsonData = pm.response.json();\n pm.expect(jsonData).to.have.property("id");\n pm.expect(jsonData).to.have.property("name");\n});\n'
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
"/planets/{planetId}": {
|
|
338
|
+
get: {
|
|
339
|
+
tags: [
|
|
340
|
+
"Planets"
|
|
341
|
+
],
|
|
342
|
+
summary: "Get a planet",
|
|
343
|
+
description: "You'll better learn a little bit more about the planets. It might come in handy once space travel is available for everyone.",
|
|
344
|
+
operationId: "getPlanet",
|
|
345
|
+
security: [],
|
|
346
|
+
parameters: [
|
|
347
|
+
{
|
|
348
|
+
$ref: "#/components/parameters/planetId"
|
|
349
|
+
}
|
|
350
|
+
],
|
|
351
|
+
responses: {
|
|
352
|
+
"200": {
|
|
353
|
+
description: "Planet Found",
|
|
354
|
+
headers: {
|
|
355
|
+
"X-Request-ID": {
|
|
356
|
+
$ref: "#/components/headers/X-Request-ID"
|
|
357
|
+
},
|
|
358
|
+
ETag: {
|
|
359
|
+
$ref: "#/components/headers/ETag"
|
|
360
|
+
},
|
|
361
|
+
"Last-Modified": {
|
|
362
|
+
$ref: "#/components/headers/Last-Modified"
|
|
363
|
+
},
|
|
364
|
+
"X-Cache-Control": {
|
|
365
|
+
$ref: "#/components/headers/X-Cache-Control"
|
|
366
|
+
}
|
|
367
|
+
},
|
|
368
|
+
content: {
|
|
369
|
+
"application/json": {
|
|
370
|
+
schema: {
|
|
371
|
+
$ref: "#/components/schemas/Planet"
|
|
372
|
+
}
|
|
373
|
+
},
|
|
374
|
+
"application/xml": {
|
|
375
|
+
schema: {
|
|
376
|
+
$ref: "#/components/schemas/Planet"
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
},
|
|
381
|
+
"404": {
|
|
382
|
+
$ref: "#/components/responses/NotFound"
|
|
383
|
+
}
|
|
384
|
+
},
|
|
385
|
+
"x-post-response": 'pm.test("Status code is 200", () => {\n pm.response.to.have.status(200);\n});\n\npm.test("Content-Type header is present", () => {\n pm.response.to.have.header("Content-Type");\n});\n\npm.test("Response is a planet with id and name", () => {\n const jsonData = pm.response.json();\n pm.expect(jsonData).to.have.property("id");\n pm.expect(jsonData).to.have.property("name");\n});\n'
|
|
386
|
+
},
|
|
387
|
+
put: {
|
|
388
|
+
tags: [
|
|
389
|
+
"Planets"
|
|
390
|
+
],
|
|
391
|
+
summary: "Update a planet",
|
|
392
|
+
description: "Sometimes you make mistakes, that's fine. No worries, you can update all planets.",
|
|
393
|
+
operationId: "updatePlanet",
|
|
394
|
+
requestBody: {
|
|
395
|
+
description: "New information about the planet",
|
|
396
|
+
content: {
|
|
397
|
+
"application/json": {
|
|
398
|
+
schema: {
|
|
399
|
+
$ref: "#/components/schemas/Planet"
|
|
400
|
+
}
|
|
401
|
+
},
|
|
402
|
+
"application/xml": {
|
|
403
|
+
schema: {
|
|
404
|
+
$ref: "#/components/schemas/Planet"
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
},
|
|
409
|
+
parameters: [
|
|
410
|
+
{
|
|
411
|
+
$ref: "#/components/parameters/planetId"
|
|
412
|
+
}
|
|
413
|
+
],
|
|
414
|
+
responses: {
|
|
415
|
+
"200": {
|
|
416
|
+
description: "Planet updated successfully",
|
|
417
|
+
content: {
|
|
418
|
+
"application/json": {
|
|
419
|
+
schema: {
|
|
420
|
+
$ref: "#/components/schemas/Planet"
|
|
421
|
+
}
|
|
422
|
+
},
|
|
423
|
+
"application/xml": {
|
|
424
|
+
schema: {
|
|
425
|
+
$ref: "#/components/schemas/Planet"
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
},
|
|
430
|
+
"400": {
|
|
431
|
+
$ref: "#/components/responses/BadRequest"
|
|
432
|
+
},
|
|
433
|
+
"403": {
|
|
434
|
+
$ref: "#/components/responses/Forbidden"
|
|
435
|
+
},
|
|
436
|
+
"404": {
|
|
437
|
+
$ref: "#/components/responses/NotFound"
|
|
438
|
+
}
|
|
439
|
+
},
|
|
440
|
+
"x-post-response": 'pm.test("Status code is 200", () => {\n pm.response.to.have.status(200);\n});\n\npm.test("Content-Type header is present", () => {\n pm.response.to.have.header("Content-Type");\n});\n\npm.test("Response is a planet with id and name", () => {\n const jsonData = pm.response.json();\n pm.expect(jsonData).to.have.property("id");\n pm.expect(jsonData).to.have.property("name");\n});\n'
|
|
441
|
+
},
|
|
442
|
+
delete: {
|
|
443
|
+
tags: [
|
|
444
|
+
"Planets"
|
|
445
|
+
],
|
|
446
|
+
summary: "Delete a planet",
|
|
447
|
+
operationId: "deletePlanet",
|
|
448
|
+
description: "This endpoint was used to delete planets. Unfortunately, that caused a lot of trouble for planets with life. So, this endpoint is now deprecated and should not be used anymore.",
|
|
449
|
+
"x-scalar-stability": "experimental",
|
|
450
|
+
parameters: [
|
|
451
|
+
{
|
|
452
|
+
$ref: "#/components/parameters/planetId"
|
|
453
|
+
}
|
|
454
|
+
],
|
|
455
|
+
responses: {
|
|
456
|
+
"204": {
|
|
457
|
+
description: "No Content"
|
|
458
|
+
},
|
|
459
|
+
"404": {
|
|
460
|
+
$ref: "#/components/responses/NotFound"
|
|
461
|
+
}
|
|
462
|
+
},
|
|
463
|
+
"x-post-response": 'pm.test("Status code is 204", () => {\n pm.response.to.have.status(204);\n});\n'
|
|
464
|
+
}
|
|
465
|
+
},
|
|
466
|
+
"/planets/{planetId}/image": {
|
|
467
|
+
post: {
|
|
468
|
+
tags: [
|
|
469
|
+
"Planets"
|
|
470
|
+
],
|
|
471
|
+
summary: "Upload an image to a planet",
|
|
472
|
+
description: "Got a crazy good photo of a planet? Share it with the world!",
|
|
473
|
+
operationId: "uploadImage",
|
|
474
|
+
parameters: [
|
|
475
|
+
{
|
|
476
|
+
$ref: "#/components/parameters/planetId"
|
|
477
|
+
}
|
|
478
|
+
],
|
|
479
|
+
requestBody: {
|
|
480
|
+
description: "Image to upload",
|
|
481
|
+
content: {
|
|
482
|
+
"multipart/form-data": {
|
|
483
|
+
schema: {
|
|
484
|
+
type: "object",
|
|
485
|
+
properties: {
|
|
486
|
+
image: {
|
|
487
|
+
type: "string",
|
|
488
|
+
format: "binary",
|
|
489
|
+
description: "The image file to upload",
|
|
490
|
+
examples: [
|
|
491
|
+
"@mars.jpg",
|
|
492
|
+
"@jupiter.png"
|
|
493
|
+
]
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
},
|
|
500
|
+
responses: {
|
|
501
|
+
"200": {
|
|
502
|
+
$ref: "#/components/responses/ImageUploaded"
|
|
503
|
+
},
|
|
504
|
+
"400": {
|
|
505
|
+
$ref: "#/components/responses/BadRequest"
|
|
506
|
+
},
|
|
507
|
+
"403": {
|
|
508
|
+
$ref: "#/components/responses/Forbidden"
|
|
509
|
+
},
|
|
510
|
+
"404": {
|
|
511
|
+
$ref: "#/components/responses/NotFound"
|
|
512
|
+
}
|
|
513
|
+
},
|
|
514
|
+
"x-post-response": 'pm.test("Status code is 200", () => {\n pm.response.to.have.status(200);\n});\n\npm.test("Content-Type header is present", () => {\n pm.response.to.have.header("Content-Type");\n});\n\npm.test("Response has message and imageUrl", () => {\n const jsonData = pm.response.json();\n pm.expect(jsonData).to.have.property("message");\n pm.expect(jsonData).to.have.property("imageUrl");\n});\n'
|
|
515
|
+
}
|
|
516
|
+
},
|
|
517
|
+
"/celestial-bodies": {
|
|
518
|
+
post: {
|
|
519
|
+
tags: [
|
|
520
|
+
"Celestial Bodies"
|
|
521
|
+
],
|
|
522
|
+
summary: "Create a celestial body",
|
|
523
|
+
description: "Stars, moons, comets, the occasional rogue asteroid \u2014 if it glows or drifts through the void, you can add it here.",
|
|
524
|
+
operationId: "createCelestialBody",
|
|
525
|
+
requestBody: {
|
|
526
|
+
description: "Celestial body to create",
|
|
527
|
+
required: true,
|
|
528
|
+
content: {
|
|
529
|
+
"application/json": {
|
|
530
|
+
schema: {
|
|
531
|
+
$ref: "#/components/schemas/CelestialBody"
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
},
|
|
536
|
+
responses: {
|
|
537
|
+
"201": {
|
|
538
|
+
description: "Celestial body created",
|
|
539
|
+
content: {
|
|
540
|
+
"application/json": {
|
|
541
|
+
schema: {
|
|
542
|
+
$ref: "#/components/schemas/CelestialBody"
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
},
|
|
548
|
+
"x-post-response": 'pm.test("Status code is 201", () => {\n pm.response.to.have.status(201);\n});\n\npm.test("Content-Type header is present", () => {\n pm.response.to.have.header("Content-Type");\n});\n\npm.test("Response is a celestial body with id and name", () => {\n const jsonData = pm.response.json();\n pm.expect(jsonData).to.have.property("id");\n pm.expect(jsonData).to.have.property("name");\n});\n'
|
|
549
|
+
}
|
|
550
|
+
},
|
|
551
|
+
"/user/signup": {
|
|
552
|
+
post: {
|
|
553
|
+
tags: [
|
|
554
|
+
"Authentication"
|
|
555
|
+
],
|
|
556
|
+
summary: "Create a user",
|
|
557
|
+
description: "Time to create a user account, eh?",
|
|
558
|
+
operationId: "createUser",
|
|
559
|
+
security: [],
|
|
560
|
+
requestBody: {
|
|
561
|
+
description: "User to create",
|
|
562
|
+
content: {
|
|
563
|
+
"application/json": {
|
|
564
|
+
schema: {
|
|
565
|
+
allOf: [
|
|
566
|
+
{
|
|
567
|
+
$ref: "#/components/schemas/User"
|
|
568
|
+
},
|
|
569
|
+
{
|
|
570
|
+
$ref: "#/components/schemas/Credentials"
|
|
571
|
+
}
|
|
572
|
+
]
|
|
573
|
+
},
|
|
574
|
+
examples: {
|
|
575
|
+
Marc: {
|
|
576
|
+
value: {
|
|
577
|
+
name: "Marc",
|
|
578
|
+
email: "marc@scalar.com",
|
|
579
|
+
password: "i-love-scalar"
|
|
580
|
+
}
|
|
581
|
+
},
|
|
582
|
+
Cam: {
|
|
583
|
+
value: {
|
|
584
|
+
name: "Cam",
|
|
585
|
+
email: "cam@scalar.com",
|
|
586
|
+
password: "scalar-is-cool"
|
|
587
|
+
}
|
|
588
|
+
},
|
|
589
|
+
Hans: {
|
|
590
|
+
value: {
|
|
591
|
+
name: "Hans",
|
|
592
|
+
email: "hans@scalar.com",
|
|
593
|
+
password: "5c4l4r"
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
},
|
|
598
|
+
"application/xml": {
|
|
599
|
+
schema: {
|
|
600
|
+
allOf: [
|
|
601
|
+
{
|
|
602
|
+
$ref: "#/components/schemas/User"
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
$ref: "#/components/schemas/Credentials"
|
|
606
|
+
}
|
|
607
|
+
]
|
|
608
|
+
},
|
|
609
|
+
examples: {
|
|
610
|
+
Marc: {
|
|
611
|
+
value: {
|
|
612
|
+
name: "Marc",
|
|
613
|
+
email: "marc@scalar.com",
|
|
614
|
+
password: "i-love-scalar"
|
|
615
|
+
}
|
|
616
|
+
},
|
|
617
|
+
Cam: {
|
|
618
|
+
value: {
|
|
619
|
+
name: "Cam",
|
|
620
|
+
email: "cam@scalar.com",
|
|
621
|
+
password: "scalar-is-cool"
|
|
622
|
+
}
|
|
623
|
+
},
|
|
624
|
+
Hans: {
|
|
625
|
+
value: {
|
|
626
|
+
name: "Hans",
|
|
627
|
+
email: "hans@scalar.com",
|
|
628
|
+
password: "5c4l4r"
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
},
|
|
635
|
+
responses: {
|
|
636
|
+
"201": {
|
|
637
|
+
description: "User account created successfully",
|
|
638
|
+
headers: {
|
|
639
|
+
"X-Request-ID": {
|
|
640
|
+
$ref: "#/components/headers/X-Request-ID"
|
|
641
|
+
},
|
|
642
|
+
Location: {
|
|
643
|
+
$ref: "#/components/headers/Location"
|
|
644
|
+
},
|
|
645
|
+
"X-Processing-Time": {
|
|
646
|
+
$ref: "#/components/headers/X-Processing-Time"
|
|
647
|
+
}
|
|
648
|
+
},
|
|
649
|
+
content: {
|
|
650
|
+
"application/json": {
|
|
651
|
+
schema: {
|
|
652
|
+
$ref: "#/components/schemas/User"
|
|
653
|
+
}
|
|
654
|
+
},
|
|
655
|
+
"application/xml": {
|
|
656
|
+
schema: {
|
|
657
|
+
$ref: "#/components/schemas/User"
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
},
|
|
662
|
+
"400": {
|
|
663
|
+
$ref: "#/components/responses/BadRequest"
|
|
664
|
+
},
|
|
665
|
+
"401": {
|
|
666
|
+
$ref: "#/components/responses/Unauthorized"
|
|
667
|
+
},
|
|
668
|
+
"403": {
|
|
669
|
+
$ref: "#/components/responses/Forbidden"
|
|
670
|
+
},
|
|
671
|
+
"409": {
|
|
672
|
+
$ref: "#/components/responses/Conflict"
|
|
673
|
+
},
|
|
674
|
+
"422": {
|
|
675
|
+
$ref: "#/components/responses/UnprocessableEntity"
|
|
676
|
+
}
|
|
677
|
+
},
|
|
678
|
+
"x-post-response": 'pm.test("Status code is 201", () => {\n pm.response.to.have.status(201);\n});\n\npm.test("Content-Type header is present", () => {\n pm.response.to.have.header("Content-Type");\n});\n\npm.test("Response is a user with id and name", () => {\n const jsonData = pm.response.json();\n pm.expect(jsonData).to.have.property("id");\n pm.expect(jsonData).to.have.property("name");\n});\n'
|
|
679
|
+
}
|
|
680
|
+
},
|
|
681
|
+
"/auth/token": {
|
|
682
|
+
post: {
|
|
683
|
+
tags: [
|
|
684
|
+
"Authentication"
|
|
685
|
+
],
|
|
686
|
+
summary: "Get a token",
|
|
687
|
+
description: "Yeah, this is the boring security stuff. Just get your super secret token and move on.",
|
|
688
|
+
operationId: "getToken",
|
|
689
|
+
security: [],
|
|
690
|
+
requestBody: {
|
|
691
|
+
description: "Body for credentials to authenticate a user",
|
|
692
|
+
content: {
|
|
693
|
+
"application/json": {
|
|
694
|
+
schema: {
|
|
695
|
+
$ref: "#/components/schemas/Credentials"
|
|
696
|
+
}
|
|
697
|
+
},
|
|
698
|
+
"application/xml": {
|
|
699
|
+
schema: {
|
|
700
|
+
$ref: "#/components/schemas/Credentials"
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
},
|
|
705
|
+
responses: {
|
|
706
|
+
"201": {
|
|
707
|
+
description: "Token Created",
|
|
708
|
+
headers: {
|
|
709
|
+
"X-Request-ID": {
|
|
710
|
+
$ref: "#/components/headers/X-Request-ID"
|
|
711
|
+
},
|
|
712
|
+
"X-RateLimit-Limit": {
|
|
713
|
+
$ref: "#/components/headers/X-RateLimit-Limit"
|
|
714
|
+
},
|
|
715
|
+
"X-RateLimit-Remaining": {
|
|
716
|
+
$ref: "#/components/headers/X-RateLimit-Remaining"
|
|
717
|
+
},
|
|
718
|
+
"X-RateLimit-Reset": {
|
|
719
|
+
$ref: "#/components/headers/X-RateLimit-Reset"
|
|
720
|
+
}
|
|
721
|
+
},
|
|
722
|
+
content: {
|
|
723
|
+
"application/json": {
|
|
724
|
+
schema: {
|
|
725
|
+
$ref: "#/components/schemas/Token"
|
|
726
|
+
}
|
|
727
|
+
},
|
|
728
|
+
"application/xml": {
|
|
729
|
+
schema: {
|
|
730
|
+
$ref: "#/components/schemas/Token"
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
},
|
|
735
|
+
"400": {
|
|
736
|
+
$ref: "#/components/responses/BadRequest"
|
|
737
|
+
},
|
|
738
|
+
"401": {
|
|
739
|
+
$ref: "#/components/responses/Unauthorized"
|
|
740
|
+
},
|
|
741
|
+
"403": {
|
|
742
|
+
$ref: "#/components/responses/Forbidden"
|
|
743
|
+
},
|
|
744
|
+
"429": {
|
|
745
|
+
$ref: "#/components/responses/TooManyRequests"
|
|
746
|
+
}
|
|
747
|
+
},
|
|
748
|
+
"x-post-response": 'pm.test("Status code is 201", () => {\n pm.response.to.have.status(201);\n});\n\npm.test("Content-Type header is present", () => {\n pm.response.to.have.header("Content-Type");\n});\n\npm.test("Response contains token", () => {\n const jsonData = pm.response.json();\n pm.expect(jsonData).to.have.property("token");\n pm.expect(jsonData.token).to.be.an("string");\n});\n'
|
|
749
|
+
}
|
|
750
|
+
},
|
|
751
|
+
"/me": {
|
|
752
|
+
get: {
|
|
753
|
+
tags: [
|
|
754
|
+
"Authentication"
|
|
755
|
+
],
|
|
756
|
+
summary: "Get authenticated user",
|
|
757
|
+
description: "Find yourself they say. That's what you can do here.",
|
|
758
|
+
operationId: "getMe",
|
|
759
|
+
security: [
|
|
760
|
+
{
|
|
761
|
+
basicAuth: []
|
|
762
|
+
},
|
|
763
|
+
{
|
|
764
|
+
oAuth2: [
|
|
765
|
+
"read:account"
|
|
766
|
+
]
|
|
767
|
+
},
|
|
768
|
+
{
|
|
769
|
+
bearerAuth: []
|
|
770
|
+
},
|
|
771
|
+
{
|
|
772
|
+
apiKeyHeader: []
|
|
773
|
+
},
|
|
774
|
+
{
|
|
775
|
+
apiKeyQuery: []
|
|
776
|
+
},
|
|
777
|
+
{
|
|
778
|
+
apiKeyHeader: [],
|
|
779
|
+
apiKeyQuery: []
|
|
780
|
+
}
|
|
781
|
+
],
|
|
782
|
+
responses: {
|
|
783
|
+
"200": {
|
|
784
|
+
description: "Authenticated user information retrieved successfully",
|
|
785
|
+
headers: {
|
|
786
|
+
"X-Request-ID": {
|
|
787
|
+
$ref: "#/components/headers/X-Request-ID"
|
|
788
|
+
},
|
|
789
|
+
ETag: {
|
|
790
|
+
$ref: "#/components/headers/ETag"
|
|
791
|
+
},
|
|
792
|
+
"Last-Modified": {
|
|
793
|
+
$ref: "#/components/headers/Last-Modified"
|
|
794
|
+
},
|
|
795
|
+
"X-Cache-Control": {
|
|
796
|
+
$ref: "#/components/headers/X-Cache-Control"
|
|
797
|
+
}
|
|
798
|
+
},
|
|
799
|
+
content: {
|
|
800
|
+
"application/json": {
|
|
801
|
+
schema: {
|
|
802
|
+
$ref: "#/components/schemas/User"
|
|
803
|
+
}
|
|
804
|
+
},
|
|
805
|
+
"application/xml": {
|
|
806
|
+
schema: {
|
|
807
|
+
$ref: "#/components/schemas/User"
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
},
|
|
812
|
+
"401": {
|
|
813
|
+
$ref: "#/components/responses/Unauthorized"
|
|
814
|
+
},
|
|
815
|
+
"403": {
|
|
816
|
+
$ref: "#/components/responses/Forbidden"
|
|
817
|
+
}
|
|
818
|
+
},
|
|
819
|
+
"x-post-response": 'pm.test("Status code is 200", () => {\n pm.response.to.have.status(200);\n});\n\npm.test("Content-Type header is present", () => {\n pm.response.to.have.header("Content-Type");\n});\n\npm.test("Response is a user with id and name", () => {\n const jsonData = pm.response.json();\n pm.expect(jsonData).to.have.property("id");\n pm.expect(jsonData).to.have.property("name");\n});\n'
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
},
|
|
823
|
+
webhooks: {
|
|
824
|
+
newPlanet: {
|
|
825
|
+
post: {
|
|
826
|
+
tags: [
|
|
827
|
+
"Planets"
|
|
828
|
+
],
|
|
829
|
+
security: [],
|
|
830
|
+
requestBody: {
|
|
831
|
+
description: "Information about a new planet",
|
|
832
|
+
content: {
|
|
833
|
+
"application/json": {
|
|
834
|
+
schema: {
|
|
835
|
+
$ref: "#/components/schemas/Planet"
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
},
|
|
840
|
+
responses: {
|
|
841
|
+
"200": {
|
|
842
|
+
description: "Return a 200 status to indicate that the data was received successfully"
|
|
843
|
+
}
|
|
844
|
+
},
|
|
845
|
+
"x-post-response": 'pm.test("Status code is 200", () => {\n pm.response.to.have.status(200);\n});\n'
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
},
|
|
849
|
+
components: {
|
|
850
|
+
securitySchemes: {
|
|
851
|
+
bearerAuth: {
|
|
852
|
+
type: "http",
|
|
853
|
+
scheme: "bearer",
|
|
854
|
+
description: "JWT Bearer token authentication"
|
|
855
|
+
},
|
|
856
|
+
basicAuth: {
|
|
857
|
+
type: "http",
|
|
858
|
+
scheme: "basic",
|
|
859
|
+
description: "Basic HTTP authentication"
|
|
860
|
+
},
|
|
861
|
+
apiKeyHeader: {
|
|
862
|
+
type: "apiKey",
|
|
863
|
+
in: "header",
|
|
864
|
+
name: "X-API-Key",
|
|
865
|
+
description: "API key request header"
|
|
866
|
+
},
|
|
867
|
+
apiKeyQuery: {
|
|
868
|
+
type: "apiKey",
|
|
869
|
+
in: "query",
|
|
870
|
+
name: "api_key",
|
|
871
|
+
description: "API key query parameter"
|
|
872
|
+
},
|
|
873
|
+
apiKeyCookie: {
|
|
874
|
+
type: "apiKey",
|
|
875
|
+
in: "cookie",
|
|
876
|
+
name: "api_key",
|
|
877
|
+
description: "API key browser cookie"
|
|
878
|
+
},
|
|
879
|
+
oAuth2: {
|
|
880
|
+
type: "oauth2",
|
|
881
|
+
description: "OAuth 2.0 authentication",
|
|
882
|
+
flows: {
|
|
883
|
+
authorizationCode: {
|
|
884
|
+
authorizationUrl: "https://galaxy.scalar.com/oauth/authorize",
|
|
885
|
+
tokenUrl: "https://galaxy.scalar.com/oauth/token",
|
|
886
|
+
scopes: {
|
|
887
|
+
"read:account": "read your account information",
|
|
888
|
+
"write:planets": "modify planets in your account",
|
|
889
|
+
"read:planets": "read your planets"
|
|
890
|
+
}
|
|
891
|
+
},
|
|
892
|
+
clientCredentials: {
|
|
893
|
+
tokenUrl: "https://galaxy.scalar.com/oauth/token",
|
|
894
|
+
scopes: {
|
|
895
|
+
"read:account": "read your account information",
|
|
896
|
+
"write:planets": "modify planets in your account",
|
|
897
|
+
"read:planets": "read your planets"
|
|
898
|
+
}
|
|
899
|
+
},
|
|
900
|
+
implicit: {
|
|
901
|
+
authorizationUrl: "https://galaxy.scalar.com/oauth/authorize",
|
|
902
|
+
scopes: {
|
|
903
|
+
"read:account": "read your account information",
|
|
904
|
+
"write:planets": "modify planets in your account",
|
|
905
|
+
"read:planets": "read your planets"
|
|
906
|
+
}
|
|
907
|
+
},
|
|
908
|
+
password: {
|
|
909
|
+
tokenUrl: "https://galaxy.scalar.com/oauth/token",
|
|
910
|
+
scopes: {
|
|
911
|
+
"read:account": "read your account information",
|
|
912
|
+
"write:planets": "modify planets in your account",
|
|
913
|
+
"read:planets": "read your planets"
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
},
|
|
918
|
+
openIdConnect: {
|
|
919
|
+
type: "openIdConnect",
|
|
920
|
+
openIdConnectUrl: "https://galaxy.scalar.com/.well-known/openid-configuration",
|
|
921
|
+
description: "OpenID Connect Authentication"
|
|
922
|
+
}
|
|
923
|
+
},
|
|
924
|
+
parameters: {
|
|
925
|
+
planetId: {
|
|
926
|
+
name: "planetId",
|
|
927
|
+
description: "The ID of the planet to get",
|
|
928
|
+
in: "path",
|
|
929
|
+
required: true,
|
|
930
|
+
schema: {
|
|
931
|
+
type: "integer",
|
|
932
|
+
format: "int64",
|
|
933
|
+
examples: [
|
|
934
|
+
1
|
|
935
|
+
]
|
|
936
|
+
}
|
|
937
|
+
},
|
|
938
|
+
limit: {
|
|
939
|
+
name: "limit",
|
|
940
|
+
description: "The number of items to return",
|
|
941
|
+
in: "query",
|
|
942
|
+
required: false,
|
|
943
|
+
schema: {
|
|
944
|
+
type: "integer",
|
|
945
|
+
format: "int64",
|
|
946
|
+
default: 10
|
|
947
|
+
}
|
|
948
|
+
},
|
|
949
|
+
offset: {
|
|
950
|
+
name: "offset",
|
|
951
|
+
description: "The number of items to skip before starting to collect the result set",
|
|
952
|
+
in: "query",
|
|
953
|
+
required: false,
|
|
954
|
+
schema: {
|
|
955
|
+
type: "integer",
|
|
956
|
+
format: "int64",
|
|
957
|
+
default: 0
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
},
|
|
961
|
+
headers: {
|
|
962
|
+
"X-RateLimit-Limit": {
|
|
963
|
+
description: "The number of allowed requests in the current period",
|
|
964
|
+
schema: {
|
|
965
|
+
type: "integer",
|
|
966
|
+
example: 100
|
|
967
|
+
}
|
|
968
|
+
},
|
|
969
|
+
"X-RateLimit-Remaining": {
|
|
970
|
+
description: "The number of remaining requests in the current period",
|
|
971
|
+
schema: {
|
|
972
|
+
type: "integer",
|
|
973
|
+
example: 95
|
|
974
|
+
}
|
|
975
|
+
},
|
|
976
|
+
"X-RateLimit-Reset": {
|
|
977
|
+
description: "The number of seconds left in the current period",
|
|
978
|
+
schema: {
|
|
979
|
+
type: "integer",
|
|
980
|
+
example: 3600
|
|
981
|
+
}
|
|
982
|
+
},
|
|
983
|
+
"X-Request-ID": {
|
|
984
|
+
description: "Unique identifier for the request",
|
|
985
|
+
schema: {
|
|
986
|
+
type: "string",
|
|
987
|
+
format: "uuid",
|
|
988
|
+
example: "123e4567-e89b-12d3-a456-426614174000"
|
|
989
|
+
}
|
|
990
|
+
},
|
|
991
|
+
"X-Pagination-Total": {
|
|
992
|
+
description: "Total number of items available",
|
|
993
|
+
schema: {
|
|
994
|
+
type: "integer",
|
|
995
|
+
example: 1e3
|
|
996
|
+
}
|
|
997
|
+
},
|
|
998
|
+
"X-Pagination-Page": {
|
|
999
|
+
description: "Current page number",
|
|
1000
|
+
schema: {
|
|
1001
|
+
type: "integer",
|
|
1002
|
+
example: 1
|
|
1003
|
+
}
|
|
1004
|
+
},
|
|
1005
|
+
"X-Pagination-Per-Page": {
|
|
1006
|
+
description: "Number of items per page",
|
|
1007
|
+
schema: {
|
|
1008
|
+
type: "integer",
|
|
1009
|
+
example: 10
|
|
1010
|
+
}
|
|
1011
|
+
},
|
|
1012
|
+
"X-Cache-Control": {
|
|
1013
|
+
description: "Cache control directives",
|
|
1014
|
+
schema: {
|
|
1015
|
+
type: "string",
|
|
1016
|
+
example: "max-age=3600, public"
|
|
1017
|
+
}
|
|
1018
|
+
},
|
|
1019
|
+
ETag: {
|
|
1020
|
+
description: "Entity tag for caching",
|
|
1021
|
+
schema: {
|
|
1022
|
+
type: "string",
|
|
1023
|
+
example: '"33a64df551"'
|
|
1024
|
+
}
|
|
1025
|
+
},
|
|
1026
|
+
"Last-Modified": {
|
|
1027
|
+
description: "The last modification date of the resource",
|
|
1028
|
+
schema: {
|
|
1029
|
+
type: "string",
|
|
1030
|
+
format: "date-time",
|
|
1031
|
+
example: "2023-12-01T12:00:00Z"
|
|
1032
|
+
}
|
|
1033
|
+
},
|
|
1034
|
+
Location: {
|
|
1035
|
+
description: "The URL of the newly created resource",
|
|
1036
|
+
schema: {
|
|
1037
|
+
type: "string",
|
|
1038
|
+
format: "uri",
|
|
1039
|
+
example: "https://galaxy.scalar.com/planets/123"
|
|
1040
|
+
}
|
|
1041
|
+
},
|
|
1042
|
+
"X-Processing-Time": {
|
|
1043
|
+
description: "The time taken to process the request in milliseconds",
|
|
1044
|
+
schema: {
|
|
1045
|
+
type: "integer",
|
|
1046
|
+
example: 150
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
},
|
|
1050
|
+
responses: {
|
|
1051
|
+
ImageUploaded: {
|
|
1052
|
+
description: "Image uploaded",
|
|
1053
|
+
headers: {
|
|
1054
|
+
"X-Request-ID": {
|
|
1055
|
+
$ref: "#/components/headers/X-Request-ID"
|
|
1056
|
+
},
|
|
1057
|
+
"X-Cache-Control": {
|
|
1058
|
+
$ref: "#/components/headers/X-Cache-Control"
|
|
1059
|
+
}
|
|
1060
|
+
},
|
|
1061
|
+
content: {
|
|
1062
|
+
"application/json": {
|
|
1063
|
+
schema: {
|
|
1064
|
+
$ref: "#/components/schemas/ImageUploadedMessage"
|
|
1065
|
+
}
|
|
1066
|
+
},
|
|
1067
|
+
"application/xml": {
|
|
1068
|
+
schema: {
|
|
1069
|
+
$ref: "#/components/schemas/ImageUploadedMessage"
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
},
|
|
1074
|
+
BadRequest: {
|
|
1075
|
+
description: "Bad Request",
|
|
1076
|
+
headers: {
|
|
1077
|
+
"X-Request-ID": {
|
|
1078
|
+
$ref: "#/components/headers/X-Request-ID"
|
|
1079
|
+
}
|
|
1080
|
+
},
|
|
1081
|
+
content: {
|
|
1082
|
+
"application/json": {
|
|
1083
|
+
schema: {
|
|
1084
|
+
$ref: "#/components/schemas/BadRequestError"
|
|
1085
|
+
}
|
|
1086
|
+
},
|
|
1087
|
+
"application/xml": {
|
|
1088
|
+
schema: {
|
|
1089
|
+
$ref: "#/components/schemas/BadRequestError"
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
},
|
|
1094
|
+
Forbidden: {
|
|
1095
|
+
description: "Forbidden",
|
|
1096
|
+
content: {
|
|
1097
|
+
"application/json": {
|
|
1098
|
+
schema: {
|
|
1099
|
+
$ref: "#/components/schemas/ForbiddenError"
|
|
1100
|
+
}
|
|
1101
|
+
},
|
|
1102
|
+
"application/xml": {
|
|
1103
|
+
schema: {
|
|
1104
|
+
$ref: "#/components/schemas/ForbiddenError"
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
},
|
|
1109
|
+
NotFound: {
|
|
1110
|
+
description: "Not Found",
|
|
1111
|
+
content: {
|
|
1112
|
+
"application/json": {
|
|
1113
|
+
schema: {
|
|
1114
|
+
$ref: "#/components/schemas/NotFoundError"
|
|
1115
|
+
}
|
|
1116
|
+
},
|
|
1117
|
+
"application/xml": {
|
|
1118
|
+
schema: {
|
|
1119
|
+
$ref: "#/components/schemas/NotFoundError"
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
},
|
|
1124
|
+
Unauthorized: {
|
|
1125
|
+
description: "Unauthorized",
|
|
1126
|
+
content: {
|
|
1127
|
+
"application/json": {
|
|
1128
|
+
schema: {
|
|
1129
|
+
$ref: "#/components/schemas/UnauthorizedError"
|
|
1130
|
+
}
|
|
1131
|
+
},
|
|
1132
|
+
"application/xml": {
|
|
1133
|
+
schema: {
|
|
1134
|
+
$ref: "#/components/schemas/UnauthorizedError"
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
},
|
|
1139
|
+
Conflict: {
|
|
1140
|
+
description: "Conflict",
|
|
1141
|
+
content: {
|
|
1142
|
+
"application/json": {
|
|
1143
|
+
schema: {
|
|
1144
|
+
$ref: "#/components/schemas/Conflict"
|
|
1145
|
+
}
|
|
1146
|
+
},
|
|
1147
|
+
"application/xml": {
|
|
1148
|
+
schema: {
|
|
1149
|
+
$ref: "#/components/schemas/Conflict"
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
},
|
|
1154
|
+
UnprocessableEntity: {
|
|
1155
|
+
description: "Unprocessable Entity",
|
|
1156
|
+
content: {
|
|
1157
|
+
"application/json": {
|
|
1158
|
+
schema: {
|
|
1159
|
+
$ref: "#/components/schemas/UnprocessableEntity"
|
|
1160
|
+
}
|
|
1161
|
+
},
|
|
1162
|
+
"application/xml": {
|
|
1163
|
+
schema: {
|
|
1164
|
+
$ref: "#/components/schemas/UnprocessableEntity"
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
},
|
|
1169
|
+
TooManyRequests: {
|
|
1170
|
+
description: "Too Many Requests",
|
|
1171
|
+
headers: {
|
|
1172
|
+
"X-Request-ID": {
|
|
1173
|
+
$ref: "#/components/headers/X-Request-ID"
|
|
1174
|
+
},
|
|
1175
|
+
"X-RateLimit-Limit": {
|
|
1176
|
+
$ref: "#/components/headers/X-RateLimit-Limit"
|
|
1177
|
+
},
|
|
1178
|
+
"X-RateLimit-Remaining": {
|
|
1179
|
+
$ref: "#/components/headers/X-RateLimit-Remaining"
|
|
1180
|
+
},
|
|
1181
|
+
"X-RateLimit-Reset": {
|
|
1182
|
+
$ref: "#/components/headers/X-RateLimit-Reset"
|
|
1183
|
+
},
|
|
1184
|
+
"Retry-After": {
|
|
1185
|
+
description: "The number of seconds to wait before retrying",
|
|
1186
|
+
schema: {
|
|
1187
|
+
type: "integer",
|
|
1188
|
+
example: 60
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
},
|
|
1192
|
+
content: {
|
|
1193
|
+
"application/json": {
|
|
1194
|
+
schema: {
|
|
1195
|
+
$ref: "#/components/schemas/TooManyRequestsError"
|
|
1196
|
+
}
|
|
1197
|
+
},
|
|
1198
|
+
"application/xml": {
|
|
1199
|
+
schema: {
|
|
1200
|
+
$ref: "#/components/schemas/TooManyRequestsError"
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
},
|
|
1206
|
+
schemas: {
|
|
1207
|
+
User: {
|
|
1208
|
+
description: "A user",
|
|
1209
|
+
type: "object",
|
|
1210
|
+
xml: {
|
|
1211
|
+
name: "user"
|
|
1212
|
+
},
|
|
1213
|
+
properties: {
|
|
1214
|
+
id: {
|
|
1215
|
+
type: "integer",
|
|
1216
|
+
format: "int64",
|
|
1217
|
+
readOnly: true,
|
|
1218
|
+
examples: [
|
|
1219
|
+
1
|
|
1220
|
+
]
|
|
1221
|
+
},
|
|
1222
|
+
name: {
|
|
1223
|
+
type: "string",
|
|
1224
|
+
examples: [
|
|
1225
|
+
"Marc",
|
|
1226
|
+
"Cam",
|
|
1227
|
+
"Hans"
|
|
1228
|
+
]
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
},
|
|
1232
|
+
Credentials: {
|
|
1233
|
+
description: "Credentials to authenticate a user",
|
|
1234
|
+
type: "object",
|
|
1235
|
+
required: [
|
|
1236
|
+
"email",
|
|
1237
|
+
"password"
|
|
1238
|
+
],
|
|
1239
|
+
properties: {
|
|
1240
|
+
email: {
|
|
1241
|
+
type: "string",
|
|
1242
|
+
format: "email",
|
|
1243
|
+
examples: [
|
|
1244
|
+
"marc@scalar.com",
|
|
1245
|
+
"cam@scalar.com",
|
|
1246
|
+
"hans@scalar.com"
|
|
1247
|
+
]
|
|
1248
|
+
},
|
|
1249
|
+
password: {
|
|
1250
|
+
type: "string",
|
|
1251
|
+
writeOnly: true,
|
|
1252
|
+
examples: [
|
|
1253
|
+
"i-love-scalar",
|
|
1254
|
+
"i-love-oss",
|
|
1255
|
+
"qwerty123"
|
|
1256
|
+
]
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
},
|
|
1260
|
+
Token: {
|
|
1261
|
+
description: "A token to authenticate a user",
|
|
1262
|
+
type: "object",
|
|
1263
|
+
properties: {
|
|
1264
|
+
token: {
|
|
1265
|
+
type: "string",
|
|
1266
|
+
examples: [
|
|
1267
|
+
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
|
|
1268
|
+
]
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
},
|
|
1272
|
+
CelestialBody: {
|
|
1273
|
+
oneOf: [
|
|
1274
|
+
{
|
|
1275
|
+
$ref: "#/components/schemas/Planet"
|
|
1276
|
+
},
|
|
1277
|
+
{
|
|
1278
|
+
$ref: "#/components/schemas/Satellite"
|
|
1279
|
+
}
|
|
1280
|
+
],
|
|
1281
|
+
discriminator: {
|
|
1282
|
+
propertyName: "type",
|
|
1283
|
+
mapping: {
|
|
1284
|
+
terrestrial: "#/components/schemas/Planet",
|
|
1285
|
+
gas_giant: "#/components/schemas/Planet",
|
|
1286
|
+
ice_giant: "#/components/schemas/Planet",
|
|
1287
|
+
dwarf: "#/components/schemas/Planet",
|
|
1288
|
+
super_earth: "#/components/schemas/Planet",
|
|
1289
|
+
moon: "#/components/schemas/Satellite",
|
|
1290
|
+
asteroid: "#/components/schemas/Satellite",
|
|
1291
|
+
comet: "#/components/schemas/Satellite"
|
|
1292
|
+
}
|
|
1293
|
+
},
|
|
1294
|
+
description: "A celestial body which can be either a planet or a satellite"
|
|
1295
|
+
},
|
|
1296
|
+
Planet: {
|
|
1297
|
+
description: "A planet in the Scalar Galaxy",
|
|
1298
|
+
type: "object",
|
|
1299
|
+
required: [
|
|
1300
|
+
"id",
|
|
1301
|
+
"name"
|
|
1302
|
+
],
|
|
1303
|
+
additionalProperties: false,
|
|
1304
|
+
xml: {
|
|
1305
|
+
name: "planet"
|
|
1306
|
+
},
|
|
1307
|
+
properties: {
|
|
1308
|
+
id: {
|
|
1309
|
+
type: "integer",
|
|
1310
|
+
format: "int64",
|
|
1311
|
+
readOnly: true,
|
|
1312
|
+
examples: [
|
|
1313
|
+
1
|
|
1314
|
+
],
|
|
1315
|
+
"x-variable": "planetId"
|
|
1316
|
+
},
|
|
1317
|
+
name: {
|
|
1318
|
+
type: "string",
|
|
1319
|
+
examples: [
|
|
1320
|
+
"Mars",
|
|
1321
|
+
"Jupiter",
|
|
1322
|
+
"HD 40307g"
|
|
1323
|
+
]
|
|
1324
|
+
},
|
|
1325
|
+
description: {
|
|
1326
|
+
type: [
|
|
1327
|
+
"string",
|
|
1328
|
+
"null"
|
|
1329
|
+
],
|
|
1330
|
+
examples: [
|
|
1331
|
+
"The red planet",
|
|
1332
|
+
"A gas giant with a great red spot"
|
|
1333
|
+
]
|
|
1334
|
+
},
|
|
1335
|
+
type: {
|
|
1336
|
+
type: "string",
|
|
1337
|
+
enum: [
|
|
1338
|
+
"terrestrial",
|
|
1339
|
+
"gas_giant",
|
|
1340
|
+
"ice_giant",
|
|
1341
|
+
"dwarf",
|
|
1342
|
+
"super_earth"
|
|
1343
|
+
],
|
|
1344
|
+
"x-enum-varnames": [
|
|
1345
|
+
"Terrestrial",
|
|
1346
|
+
"GasGiant",
|
|
1347
|
+
"IceGiant",
|
|
1348
|
+
"Dwarf",
|
|
1349
|
+
"SuperEarth"
|
|
1350
|
+
],
|
|
1351
|
+
"x-enum-descriptions": {
|
|
1352
|
+
terrestrial: "Rocky planets with solid surfaces, like Earth and Mars",
|
|
1353
|
+
gas_giant: "Large planets composed mainly of hydrogen and helium, like Jupiter and Saturn",
|
|
1354
|
+
ice_giant: "Planets composed of water, ammonia, and methane ices, like Uranus and Neptune",
|
|
1355
|
+
dwarf: "Small planetary bodies that don't meet full planet criteria, like Pluto",
|
|
1356
|
+
super_earth: "Rocky planets larger than Earth but smaller than gas giants"
|
|
1357
|
+
},
|
|
1358
|
+
examples: [
|
|
1359
|
+
"terrestrial"
|
|
1360
|
+
]
|
|
1361
|
+
},
|
|
1362
|
+
habitabilityIndex: {
|
|
1363
|
+
type: "number",
|
|
1364
|
+
format: "float",
|
|
1365
|
+
minimum: 0,
|
|
1366
|
+
maximum: 1,
|
|
1367
|
+
description: "A score from 0 to 1 indicating potential habitability",
|
|
1368
|
+
examples: [
|
|
1369
|
+
0.68
|
|
1370
|
+
]
|
|
1371
|
+
},
|
|
1372
|
+
physicalProperties: {
|
|
1373
|
+
type: "object",
|
|
1374
|
+
additionalProperties: {
|
|
1375
|
+
"x-additionalPropertiesName": "measurement",
|
|
1376
|
+
type: "number",
|
|
1377
|
+
format: "float",
|
|
1378
|
+
description: "Additional physical measurements for the planet"
|
|
1379
|
+
},
|
|
1380
|
+
properties: {
|
|
1381
|
+
mass: {
|
|
1382
|
+
type: "number",
|
|
1383
|
+
format: "float",
|
|
1384
|
+
exclusiveMinimum: 0,
|
|
1385
|
+
description: "Mass in Earth masses (must be greater than 0)",
|
|
1386
|
+
examples: [
|
|
1387
|
+
0.107
|
|
1388
|
+
]
|
|
1389
|
+
},
|
|
1390
|
+
radius: {
|
|
1391
|
+
type: "number",
|
|
1392
|
+
format: "float",
|
|
1393
|
+
exclusiveMinimum: 0,
|
|
1394
|
+
description: "Radius in Earth radii (must be greater than 0)",
|
|
1395
|
+
examples: [
|
|
1396
|
+
0.532
|
|
1397
|
+
]
|
|
1398
|
+
},
|
|
1399
|
+
gravity: {
|
|
1400
|
+
type: "number",
|
|
1401
|
+
format: "float",
|
|
1402
|
+
description: "Surface gravity in Earth g",
|
|
1403
|
+
examples: [
|
|
1404
|
+
0.378
|
|
1405
|
+
]
|
|
1406
|
+
},
|
|
1407
|
+
temperature: {
|
|
1408
|
+
type: "object",
|
|
1409
|
+
additionalProperties: {
|
|
1410
|
+
"x-additionalPropertiesName": "temperatureMetric",
|
|
1411
|
+
type: "number",
|
|
1412
|
+
format: "float",
|
|
1413
|
+
description: "Additional temperature-related measurements in Kelvin"
|
|
1414
|
+
},
|
|
1415
|
+
properties: {
|
|
1416
|
+
min: {
|
|
1417
|
+
type: "number",
|
|
1418
|
+
format: "float",
|
|
1419
|
+
description: "Minimum temperature in Kelvin",
|
|
1420
|
+
examples: [
|
|
1421
|
+
130
|
|
1422
|
+
]
|
|
1423
|
+
},
|
|
1424
|
+
max: {
|
|
1425
|
+
type: "number",
|
|
1426
|
+
format: "float",
|
|
1427
|
+
description: "Maximum temperature in Kelvin",
|
|
1428
|
+
examples: [
|
|
1429
|
+
308
|
|
1430
|
+
]
|
|
1431
|
+
},
|
|
1432
|
+
average: {
|
|
1433
|
+
type: "number",
|
|
1434
|
+
format: "float",
|
|
1435
|
+
description: "Average temperature in Kelvin",
|
|
1436
|
+
examples: [
|
|
1437
|
+
210
|
|
1438
|
+
]
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
},
|
|
1444
|
+
atmosphere: {
|
|
1445
|
+
type: "array",
|
|
1446
|
+
description: "Atmospheric composition",
|
|
1447
|
+
items: {
|
|
1448
|
+
type: "object",
|
|
1449
|
+
additionalProperties: {
|
|
1450
|
+
"x-additionalPropertiesName": "atmosphericData",
|
|
1451
|
+
type: "string",
|
|
1452
|
+
description: "Additional atmospheric composition data"
|
|
1453
|
+
},
|
|
1454
|
+
properties: {
|
|
1455
|
+
compound: {
|
|
1456
|
+
type: "string",
|
|
1457
|
+
examples: [
|
|
1458
|
+
"CO2",
|
|
1459
|
+
"N2"
|
|
1460
|
+
]
|
|
1461
|
+
},
|
|
1462
|
+
percentage: {
|
|
1463
|
+
type: "number",
|
|
1464
|
+
format: "float",
|
|
1465
|
+
exclusiveMaximum: 100,
|
|
1466
|
+
examples: [
|
|
1467
|
+
95.3
|
|
1468
|
+
]
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
},
|
|
1473
|
+
discoveredAt: {
|
|
1474
|
+
type: "string",
|
|
1475
|
+
format: "date-time",
|
|
1476
|
+
examples: [
|
|
1477
|
+
"1610-01-07T00:00:00Z"
|
|
1478
|
+
]
|
|
1479
|
+
},
|
|
1480
|
+
image: {
|
|
1481
|
+
type: [
|
|
1482
|
+
"string",
|
|
1483
|
+
"null"
|
|
1484
|
+
],
|
|
1485
|
+
examples: [
|
|
1486
|
+
"https://cdn.scalar.com/photos/mars.jpg"
|
|
1487
|
+
]
|
|
1488
|
+
},
|
|
1489
|
+
satellites: {
|
|
1490
|
+
type: "array",
|
|
1491
|
+
items: {
|
|
1492
|
+
$ref: "#/components/schemas/Satellite"
|
|
1493
|
+
}
|
|
1494
|
+
},
|
|
1495
|
+
creator: {
|
|
1496
|
+
$ref: "#/components/schemas/User"
|
|
1497
|
+
},
|
|
1498
|
+
tags: {
|
|
1499
|
+
type: "array",
|
|
1500
|
+
items: {
|
|
1501
|
+
type: "string"
|
|
1502
|
+
},
|
|
1503
|
+
examples: [
|
|
1504
|
+
[
|
|
1505
|
+
"solar-system",
|
|
1506
|
+
"rocky",
|
|
1507
|
+
"explored"
|
|
1508
|
+
]
|
|
1509
|
+
]
|
|
1510
|
+
},
|
|
1511
|
+
lastUpdated: {
|
|
1512
|
+
type: "string",
|
|
1513
|
+
format: "date-time",
|
|
1514
|
+
readOnly: true,
|
|
1515
|
+
examples: [
|
|
1516
|
+
"2024-01-15T14:30:00Z"
|
|
1517
|
+
]
|
|
1518
|
+
},
|
|
1519
|
+
successCallbackUrl: {
|
|
1520
|
+
type: "string",
|
|
1521
|
+
format: "uri",
|
|
1522
|
+
description: "URL which gets invoked upon a successful operation",
|
|
1523
|
+
examples: [
|
|
1524
|
+
"https://example.com/webhook"
|
|
1525
|
+
]
|
|
1526
|
+
},
|
|
1527
|
+
failureCallbackUrl: {
|
|
1528
|
+
type: "string",
|
|
1529
|
+
format: "uri",
|
|
1530
|
+
description: "URL which gets invoked upon a failed operation",
|
|
1531
|
+
examples: [
|
|
1532
|
+
"https://example.com/webhook"
|
|
1533
|
+
]
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
},
|
|
1537
|
+
Satellite: {
|
|
1538
|
+
description: "Every satellite in the Scalar Galaxy",
|
|
1539
|
+
type: "object",
|
|
1540
|
+
required: [
|
|
1541
|
+
"name"
|
|
1542
|
+
],
|
|
1543
|
+
properties: {
|
|
1544
|
+
id: {
|
|
1545
|
+
type: "integer",
|
|
1546
|
+
format: "int64",
|
|
1547
|
+
readOnly: true,
|
|
1548
|
+
examples: [
|
|
1549
|
+
1
|
|
1550
|
+
]
|
|
1551
|
+
},
|
|
1552
|
+
name: {
|
|
1553
|
+
type: "string",
|
|
1554
|
+
examples: [
|
|
1555
|
+
"Phobos"
|
|
1556
|
+
]
|
|
1557
|
+
},
|
|
1558
|
+
description: {
|
|
1559
|
+
type: [
|
|
1560
|
+
"string",
|
|
1561
|
+
"null"
|
|
1562
|
+
],
|
|
1563
|
+
examples: [
|
|
1564
|
+
"Phobos is the larger and innermost of the two moons of Mars."
|
|
1565
|
+
]
|
|
1566
|
+
},
|
|
1567
|
+
diameter: {
|
|
1568
|
+
type: "number",
|
|
1569
|
+
format: "float",
|
|
1570
|
+
description: "Diameter in kilometers",
|
|
1571
|
+
examples: [
|
|
1572
|
+
22.2
|
|
1573
|
+
]
|
|
1574
|
+
},
|
|
1575
|
+
type: {
|
|
1576
|
+
type: "string",
|
|
1577
|
+
enum: [
|
|
1578
|
+
"moon",
|
|
1579
|
+
"asteroid",
|
|
1580
|
+
"comet"
|
|
1581
|
+
],
|
|
1582
|
+
"x-enum-varnames": [
|
|
1583
|
+
"Moon",
|
|
1584
|
+
"Asteroid",
|
|
1585
|
+
"Comet"
|
|
1586
|
+
],
|
|
1587
|
+
"x-enum-descriptions": {
|
|
1588
|
+
moon: "Natural satellites that orbit planets",
|
|
1589
|
+
asteroid: "Rocky objects that orbit the sun, typically found in the asteroid belt",
|
|
1590
|
+
comet: "Icy bodies that release gas when approaching the sun, creating visible tails"
|
|
1591
|
+
},
|
|
1592
|
+
examples: [
|
|
1593
|
+
"moon"
|
|
1594
|
+
]
|
|
1595
|
+
},
|
|
1596
|
+
orbit: {
|
|
1597
|
+
type: "object",
|
|
1598
|
+
properties: {
|
|
1599
|
+
planet: {
|
|
1600
|
+
$ref: "#/components/schemas/Planet"
|
|
1601
|
+
},
|
|
1602
|
+
orbitalPeriod: {
|
|
1603
|
+
type: "number",
|
|
1604
|
+
format: "float",
|
|
1605
|
+
description: "Orbital period in Earth days",
|
|
1606
|
+
examples: [
|
|
1607
|
+
0.319
|
|
1608
|
+
]
|
|
1609
|
+
},
|
|
1610
|
+
distance: {
|
|
1611
|
+
type: "number",
|
|
1612
|
+
format: "float",
|
|
1613
|
+
description: "Average distance from the planet in kilometers",
|
|
1614
|
+
examples: [
|
|
1615
|
+
9376
|
|
1616
|
+
]
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
}
|
|
1621
|
+
},
|
|
1622
|
+
PaginatedResource: {
|
|
1623
|
+
description: "A generic paginated resource. Specializing schemas bind the item type by declaring a `$dynamicAnchor` named `itemType`, the JSON Schema 2020-12 way to express `PaginatedResource<T>`.",
|
|
1624
|
+
$id: "https://galaxy.scalar.com/schemas/PaginatedResource",
|
|
1625
|
+
$defs: {
|
|
1626
|
+
itemType: {
|
|
1627
|
+
$dynamicAnchor: "itemType",
|
|
1628
|
+
not: {}
|
|
1629
|
+
}
|
|
1630
|
+
},
|
|
1631
|
+
type: "object",
|
|
1632
|
+
properties: {
|
|
1633
|
+
data: {
|
|
1634
|
+
type: "array",
|
|
1635
|
+
items: {
|
|
1636
|
+
$dynamicRef: "#itemType"
|
|
1637
|
+
}
|
|
1638
|
+
},
|
|
1639
|
+
meta: {
|
|
1640
|
+
type: "object",
|
|
1641
|
+
properties: {
|
|
1642
|
+
limit: {
|
|
1643
|
+
type: "integer",
|
|
1644
|
+
format: "int64",
|
|
1645
|
+
examples: [
|
|
1646
|
+
10
|
|
1647
|
+
]
|
|
1648
|
+
},
|
|
1649
|
+
offset: {
|
|
1650
|
+
type: "integer",
|
|
1651
|
+
format: "int64",
|
|
1652
|
+
examples: [
|
|
1653
|
+
0
|
|
1654
|
+
]
|
|
1655
|
+
},
|
|
1656
|
+
total: {
|
|
1657
|
+
type: "integer",
|
|
1658
|
+
format: "int64",
|
|
1659
|
+
examples: [
|
|
1660
|
+
100
|
|
1661
|
+
]
|
|
1662
|
+
},
|
|
1663
|
+
next: {
|
|
1664
|
+
type: [
|
|
1665
|
+
"string",
|
|
1666
|
+
"null"
|
|
1667
|
+
],
|
|
1668
|
+
examples: [
|
|
1669
|
+
"/planets?limit=10&offset=10"
|
|
1670
|
+
]
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
}
|
|
1675
|
+
},
|
|
1676
|
+
ImageUploadedMessage: {
|
|
1677
|
+
"x-scalar-ignore": true,
|
|
1678
|
+
description: "Message about an image upload",
|
|
1679
|
+
type: "object",
|
|
1680
|
+
properties: {
|
|
1681
|
+
message: {
|
|
1682
|
+
type: "string",
|
|
1683
|
+
examples: [
|
|
1684
|
+
"Image uploaded successfully"
|
|
1685
|
+
]
|
|
1686
|
+
},
|
|
1687
|
+
imageUrl: {
|
|
1688
|
+
type: "string",
|
|
1689
|
+
description: "The URL where the uploaded image can be accessed",
|
|
1690
|
+
examples: [
|
|
1691
|
+
"https://cdn.scalar.com/images/8f47c132-9d1f-4f83-b5a4-91db5ee757ab.jpg"
|
|
1692
|
+
]
|
|
1693
|
+
},
|
|
1694
|
+
uploadedAt: {
|
|
1695
|
+
type: "string",
|
|
1696
|
+
format: "date-time",
|
|
1697
|
+
description: "Timestamp when the image was uploaded",
|
|
1698
|
+
examples: [
|
|
1699
|
+
"2024-01-15T14:30:00Z"
|
|
1700
|
+
]
|
|
1701
|
+
},
|
|
1702
|
+
fileSize: {
|
|
1703
|
+
type: "integer",
|
|
1704
|
+
description: "Size of the uploaded image in bytes",
|
|
1705
|
+
examples: [
|
|
1706
|
+
1048576
|
|
1707
|
+
]
|
|
1708
|
+
},
|
|
1709
|
+
mimeType: {
|
|
1710
|
+
type: "string",
|
|
1711
|
+
description: "The content type of the uploaded image",
|
|
1712
|
+
examples: [
|
|
1713
|
+
"image/jpeg",
|
|
1714
|
+
"image/png"
|
|
1715
|
+
]
|
|
1716
|
+
}
|
|
1717
|
+
}
|
|
1718
|
+
},
|
|
1719
|
+
BadRequestError: {
|
|
1720
|
+
"x-scalar-ignore": true,
|
|
1721
|
+
description: "RFC 7807 (https://datatracker.ietf.org/doc/html/rfc7807)",
|
|
1722
|
+
type: "object",
|
|
1723
|
+
properties: {
|
|
1724
|
+
type: {
|
|
1725
|
+
type: "string",
|
|
1726
|
+
examples: [
|
|
1727
|
+
"https://example.com/errors/bad-request"
|
|
1728
|
+
]
|
|
1729
|
+
},
|
|
1730
|
+
title: {
|
|
1731
|
+
type: "string",
|
|
1732
|
+
examples: [
|
|
1733
|
+
"Bad Request"
|
|
1734
|
+
]
|
|
1735
|
+
},
|
|
1736
|
+
status: {
|
|
1737
|
+
type: "integer",
|
|
1738
|
+
format: "int64",
|
|
1739
|
+
examples: [
|
|
1740
|
+
400
|
|
1741
|
+
]
|
|
1742
|
+
},
|
|
1743
|
+
detail: {
|
|
1744
|
+
type: "string",
|
|
1745
|
+
examples: [
|
|
1746
|
+
"The request was invalid."
|
|
1747
|
+
]
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1750
|
+
},
|
|
1751
|
+
ForbiddenError: {
|
|
1752
|
+
"x-scalar-ignore": true,
|
|
1753
|
+
description: "Error response for forbidden access (RFC 7807). Returned when the user does not have permission to access the requested resource.",
|
|
1754
|
+
type: "object",
|
|
1755
|
+
properties: {
|
|
1756
|
+
type: {
|
|
1757
|
+
type: "string",
|
|
1758
|
+
examples: [
|
|
1759
|
+
"https://example.com/errors/forbidden"
|
|
1760
|
+
]
|
|
1761
|
+
},
|
|
1762
|
+
title: {
|
|
1763
|
+
type: "string",
|
|
1764
|
+
examples: [
|
|
1765
|
+
"Forbidden"
|
|
1766
|
+
]
|
|
1767
|
+
},
|
|
1768
|
+
status: {
|
|
1769
|
+
type: "integer",
|
|
1770
|
+
format: "int64",
|
|
1771
|
+
examples: [
|
|
1772
|
+
403
|
|
1773
|
+
]
|
|
1774
|
+
},
|
|
1775
|
+
detail: {
|
|
1776
|
+
type: "string",
|
|
1777
|
+
examples: [
|
|
1778
|
+
"You are not authorized to access this resource."
|
|
1779
|
+
]
|
|
1780
|
+
}
|
|
1781
|
+
}
|
|
1782
|
+
},
|
|
1783
|
+
NotFoundError: {
|
|
1784
|
+
"x-scalar-ignore": true,
|
|
1785
|
+
description: "Error response for resource not found (RFC 7807). Returned when the requested resource does not exist.",
|
|
1786
|
+
type: "object",
|
|
1787
|
+
properties: {
|
|
1788
|
+
type: {
|
|
1789
|
+
type: "string",
|
|
1790
|
+
examples: [
|
|
1791
|
+
"https://example.com/errors/not-found"
|
|
1792
|
+
]
|
|
1793
|
+
},
|
|
1794
|
+
title: {
|
|
1795
|
+
type: "string",
|
|
1796
|
+
examples: [
|
|
1797
|
+
"Not Found"
|
|
1798
|
+
]
|
|
1799
|
+
},
|
|
1800
|
+
status: {
|
|
1801
|
+
type: "integer",
|
|
1802
|
+
format: "int64",
|
|
1803
|
+
examples: [
|
|
1804
|
+
404
|
|
1805
|
+
]
|
|
1806
|
+
},
|
|
1807
|
+
detail: {
|
|
1808
|
+
type: "string",
|
|
1809
|
+
examples: [
|
|
1810
|
+
"The resource you are trying to access does not exist."
|
|
1811
|
+
]
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
},
|
|
1815
|
+
UnauthorizedError: {
|
|
1816
|
+
"x-scalar-ignore": true,
|
|
1817
|
+
description: "Error response for unauthorized access (RFC 7807). Returned when authentication is required or has failed.",
|
|
1818
|
+
type: "object",
|
|
1819
|
+
properties: {
|
|
1820
|
+
type: {
|
|
1821
|
+
type: "string",
|
|
1822
|
+
examples: [
|
|
1823
|
+
"https://example.com/errors/not-found"
|
|
1824
|
+
]
|
|
1825
|
+
},
|
|
1826
|
+
title: {
|
|
1827
|
+
type: "string",
|
|
1828
|
+
examples: [
|
|
1829
|
+
"Unauthorized"
|
|
1830
|
+
]
|
|
1831
|
+
},
|
|
1832
|
+
status: {
|
|
1833
|
+
type: "integer",
|
|
1834
|
+
format: "int64",
|
|
1835
|
+
examples: [
|
|
1836
|
+
401
|
|
1837
|
+
]
|
|
1838
|
+
},
|
|
1839
|
+
detail: {
|
|
1840
|
+
type: "string",
|
|
1841
|
+
examples: [
|
|
1842
|
+
"You are not authorized to access this resource."
|
|
1843
|
+
]
|
|
1844
|
+
}
|
|
1845
|
+
}
|
|
1846
|
+
},
|
|
1847
|
+
Conflict: {
|
|
1848
|
+
"x-scalar-ignore": true,
|
|
1849
|
+
description: "Error response for resource conflicts (RFC 7807). Returned when the request conflicts with the current state of the resource.",
|
|
1850
|
+
type: "object",
|
|
1851
|
+
properties: {
|
|
1852
|
+
type: {
|
|
1853
|
+
type: "string",
|
|
1854
|
+
examples: [
|
|
1855
|
+
"https://example.com/errors/conflict"
|
|
1856
|
+
]
|
|
1857
|
+
},
|
|
1858
|
+
title: {
|
|
1859
|
+
type: "string",
|
|
1860
|
+
examples: [
|
|
1861
|
+
"Conflict"
|
|
1862
|
+
]
|
|
1863
|
+
},
|
|
1864
|
+
status: {
|
|
1865
|
+
type: "integer",
|
|
1866
|
+
format: "int64",
|
|
1867
|
+
examples: [
|
|
1868
|
+
409
|
|
1869
|
+
]
|
|
1870
|
+
},
|
|
1871
|
+
detail: {
|
|
1872
|
+
type: "string",
|
|
1873
|
+
examples: [
|
|
1874
|
+
"The resource you are trying to access is in conflict."
|
|
1875
|
+
]
|
|
1876
|
+
}
|
|
1877
|
+
}
|
|
1878
|
+
},
|
|
1879
|
+
UnprocessableEntity: {
|
|
1880
|
+
"x-scalar-ignore": true,
|
|
1881
|
+
description: "Error response for unprocessable entity (RFC 7807). Returned when the request is well-formed but contains semantic errors.",
|
|
1882
|
+
type: "object",
|
|
1883
|
+
properties: {
|
|
1884
|
+
type: {
|
|
1885
|
+
type: "string",
|
|
1886
|
+
examples: [
|
|
1887
|
+
"https://example.com/errors/unprocessable-entity"
|
|
1888
|
+
]
|
|
1889
|
+
},
|
|
1890
|
+
title: {
|
|
1891
|
+
type: "string",
|
|
1892
|
+
examples: [
|
|
1893
|
+
"Unprocessable Entity"
|
|
1894
|
+
]
|
|
1895
|
+
},
|
|
1896
|
+
status: {
|
|
1897
|
+
type: "integer",
|
|
1898
|
+
format: "int64",
|
|
1899
|
+
examples: [
|
|
1900
|
+
422
|
|
1901
|
+
]
|
|
1902
|
+
},
|
|
1903
|
+
detail: {
|
|
1904
|
+
type: "string",
|
|
1905
|
+
examples: [
|
|
1906
|
+
"The request was invalid."
|
|
1907
|
+
]
|
|
1908
|
+
}
|
|
1909
|
+
}
|
|
1910
|
+
},
|
|
1911
|
+
TooManyRequestsError: {
|
|
1912
|
+
"x-scalar-ignore": true,
|
|
1913
|
+
description: "Error response for rate limiting (RFC 7807). Returned when the client has exceeded the rate limit for requests.",
|
|
1914
|
+
type: "object",
|
|
1915
|
+
properties: {
|
|
1916
|
+
type: {
|
|
1917
|
+
type: "string",
|
|
1918
|
+
examples: [
|
|
1919
|
+
"https://example.com/errors/too-many-requests"
|
|
1920
|
+
]
|
|
1921
|
+
},
|
|
1922
|
+
title: {
|
|
1923
|
+
type: "string",
|
|
1924
|
+
examples: [
|
|
1925
|
+
"Too Many Requests"
|
|
1926
|
+
]
|
|
1927
|
+
},
|
|
1928
|
+
status: {
|
|
1929
|
+
type: "integer",
|
|
1930
|
+
format: "int64",
|
|
1931
|
+
examples: [
|
|
1932
|
+
429
|
|
1933
|
+
]
|
|
1934
|
+
},
|
|
1935
|
+
detail: {
|
|
1936
|
+
type: "string",
|
|
1937
|
+
examples: [
|
|
1938
|
+
"Rate limit exceeded. Please try again later."
|
|
1939
|
+
]
|
|
1940
|
+
}
|
|
1941
|
+
}
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1944
|
+
}
|
|
1945
|
+
};
|
|
1946
|
+
|
|
1947
|
+
// src/domains/project/init/quickstart.ts
|
|
1948
|
+
var quickstartMarkdown = `# Quickstart
|
|
1949
|
+
|
|
1950
|
+
## 1. Preview Your Docs
|
|
1951
|
+
|
|
1952
|
+
Run a local development server to see your changes in real-time:
|
|
1953
|
+
|
|
1954
|
+
\`\`\`bash
|
|
1955
|
+
npx @scalar/cli project preview
|
|
1956
|
+
\`\`\`
|
|
1957
|
+
|
|
1958
|
+
This starts a live preview at \`http://localhost:7970\` where every edit you make is instantly visible.
|
|
1959
|
+
|
|
1960
|
+
## 2. Customize Everything
|
|
1961
|
+
|
|
1962
|
+
Make it yours with themes, custom CSS, and MDX. Configure your documentation structure, navigation, and styling through \`scalar.config.json\`.
|
|
1963
|
+
|
|
1964
|
+
## 3. Publish Your Docs
|
|
1965
|
+
|
|
1966
|
+
First, authenticate with your Scalar account:
|
|
1967
|
+
|
|
1968
|
+
\`\`\`bash
|
|
1969
|
+
npx @scalar/cli auth login
|
|
1970
|
+
\`\`\`
|
|
1971
|
+
|
|
1972
|
+
Then publish your documentation:
|
|
1973
|
+
|
|
1974
|
+
\`\`\`bash
|
|
1975
|
+
npx @scalar/cli project publish --slug [dashboard-project-slug]
|
|
1976
|
+
\`\`\`
|
|
1977
|
+
|
|
1978
|
+
Your site will be available at \`<your-slug>.apidocumentation.com\`.
|
|
1979
|
+
|
|
1980
|
+
## Stuck?
|
|
1981
|
+
|
|
1982
|
+
Check whether your \`scalar.config.json\` is valid:
|
|
1983
|
+
|
|
1984
|
+
\`\`\`bash
|
|
1985
|
+
npx @scalar/cli project check-config
|
|
1986
|
+
\`\`\`
|
|
1987
|
+
|
|
1988
|
+
We're here to help:
|
|
1989
|
+
|
|
1990
|
+
- [Email support@scalar.com](mailto:support@scalar.com)
|
|
1991
|
+
- [Chat with us on Discord](https://discord.gg/scalar)
|
|
1992
|
+
- [Schedule a call](https://scalar.cal.com/scalar/chat-with-scalar)
|
|
1993
|
+
`;
|
|
1994
|
+
|
|
1995
|
+
// src/domains/project/init/action.ts
|
|
1996
|
+
async function fileExists(path2) {
|
|
1997
|
+
try {
|
|
1998
|
+
await fs.access(path2, fs.constants.F_OK);
|
|
1999
|
+
return true;
|
|
2000
|
+
} catch {
|
|
2001
|
+
return false;
|
|
2002
|
+
}
|
|
2003
|
+
}
|
|
2004
|
+
async function initAction({
|
|
2005
|
+
subdomain,
|
|
2006
|
+
force
|
|
2007
|
+
}) {
|
|
2008
|
+
const configFile = findConfig() || CONFIG_FILE_DEFAULT;
|
|
2009
|
+
const nextSteps = () => {
|
|
2010
|
+
output.info().line("What to do next:").line(
|
|
2011
|
+
` ${as.cyan("scalar project preview")} to preview your project locally`
|
|
2012
|
+
).line(
|
|
2013
|
+
` ${as.cyan("scalar project check-config")} to validate your scalar.config.json file`
|
|
2014
|
+
).line(
|
|
2015
|
+
` ${as.cyan("scalar project publish --slug")} ${as.gray("[dashboard-project-slug]")} to publish your project`
|
|
2016
|
+
).line(
|
|
2017
|
+
as.white(
|
|
2018
|
+
`Run ${as.magenta("scalar --help")} to see all available commands.`
|
|
2019
|
+
)
|
|
2020
|
+
).print();
|
|
2021
|
+
};
|
|
2022
|
+
const handleCancel = () => {
|
|
2023
|
+
cancel("Operation cancelled.");
|
|
2024
|
+
nextSteps();
|
|
2025
|
+
process.exit(0);
|
|
2026
|
+
};
|
|
2027
|
+
if (await fileExists(configFile)) {
|
|
2028
|
+
output.info().line(
|
|
2029
|
+
`${as.green("\u26A0")} Found existing configuration: ${as.green.bold(`${configFile}`)}`
|
|
2030
|
+
).print();
|
|
2031
|
+
if (force) {
|
|
2032
|
+
output.info().line(`${as.green("\u2714")} Overwriting existing file\u2026`).print();
|
|
2033
|
+
}
|
|
2034
|
+
const shouldOverwriteExisting = force ?? await confirm({
|
|
2035
|
+
message: "Do you want to override the file?",
|
|
2036
|
+
initialValue: false
|
|
2037
|
+
});
|
|
2038
|
+
if (isCancel(shouldOverwriteExisting)) {
|
|
2039
|
+
handleCancel();
|
|
2040
|
+
}
|
|
2041
|
+
if (!shouldOverwriteExisting) {
|
|
2042
|
+
handleCancel();
|
|
2043
|
+
}
|
|
2044
|
+
}
|
|
2045
|
+
const currentDir = path.resolve(path.dirname(configFile));
|
|
2046
|
+
const configuration = scalarConfigSchema.parse({
|
|
2047
|
+
info: {},
|
|
2048
|
+
navigation: {
|
|
2049
|
+
routes: {
|
|
2050
|
+
"/": {
|
|
2051
|
+
type: "group",
|
|
2052
|
+
title: "Documentation",
|
|
2053
|
+
children: {
|
|
2054
|
+
"/": {
|
|
2055
|
+
type: "page",
|
|
2056
|
+
title: "Quickstart",
|
|
2057
|
+
filepath: DEFAULT_MARKDOWN_FILE_NAME
|
|
2058
|
+
},
|
|
2059
|
+
"/openapi": {
|
|
2060
|
+
type: "openapi",
|
|
2061
|
+
title: "Scalar Galaxy",
|
|
2062
|
+
mode: "flat",
|
|
2063
|
+
filepath: DEFAULT_OPENAPI_FILE_NAME
|
|
2064
|
+
}
|
|
2065
|
+
}
|
|
2066
|
+
}
|
|
2067
|
+
}
|
|
2068
|
+
}
|
|
2069
|
+
});
|
|
2070
|
+
const { auth } = await getMetadata();
|
|
2071
|
+
const apiClient = auth ? await apiService({ noExit: true }).catch(() => null) : void 0;
|
|
2072
|
+
if (!apiClient) {
|
|
2073
|
+
output.warn().message(
|
|
2074
|
+
"Subdomain availability was not checked. Run scalar auth login to check availability."
|
|
2075
|
+
).print();
|
|
2076
|
+
}
|
|
2077
|
+
const folderName = getCurrentFolderName();
|
|
2078
|
+
const suppliedSubdomain = typeof subdomain === "string" ? subdomain.trim().toLowerCase() : void 0;
|
|
2079
|
+
if (subdomain !== void 0 && !suppliedSubdomain) {
|
|
2080
|
+
return output.error().message("Provide a name with --subdomain.").exit("error");
|
|
2081
|
+
}
|
|
2082
|
+
while (true) {
|
|
2083
|
+
const response = suppliedSubdomain ?? await text({
|
|
2084
|
+
message: "What is the name of your project?",
|
|
2085
|
+
defaultValue: folderName,
|
|
2086
|
+
placeholder: folderName
|
|
2087
|
+
});
|
|
2088
|
+
if (isCancel(response)) {
|
|
2089
|
+
return handleCancel();
|
|
2090
|
+
}
|
|
2091
|
+
const title = response.toString();
|
|
2092
|
+
const slug = suppliedSubdomain ?? slugify(title);
|
|
2093
|
+
const validSubdomain = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/.test(slug);
|
|
2094
|
+
if (!validSubdomain) {
|
|
2095
|
+
const message = "Use a subdomain with 1 to 63 letters, numbers, or hyphens, starting and ending with a letter or number.";
|
|
2096
|
+
if (suppliedSubdomain) {
|
|
2097
|
+
return output.error().message(message).exit("error");
|
|
2098
|
+
}
|
|
2099
|
+
output.error().message(message).print();
|
|
2100
|
+
continue;
|
|
2101
|
+
}
|
|
2102
|
+
if (apiClient) {
|
|
2103
|
+
const result = await apiClient.publish.getDomainAvailability(`${slug}.${config.publishTld}`).catch(() => null);
|
|
2104
|
+
if (!result || result.error) {
|
|
2105
|
+
return output.error().message("Could not check subdomain availability. Please try again.").exit("error");
|
|
2106
|
+
}
|
|
2107
|
+
if (!result.data.available) {
|
|
2108
|
+
const message = `Subdomain "${slug}" is already taken. Choose another name.`;
|
|
2109
|
+
if (suppliedSubdomain) {
|
|
2110
|
+
return output.error().message(message).exit("error");
|
|
2111
|
+
}
|
|
2112
|
+
output.error().message(message).print();
|
|
2113
|
+
continue;
|
|
2114
|
+
}
|
|
2115
|
+
}
|
|
2116
|
+
configuration.info = { title, description: `Documentation for ${title}` };
|
|
2117
|
+
configuration.siteConfig.subdomain = slug;
|
|
2118
|
+
output.info().line(`${as.green("\u2714")} Subdomain: ${as.green(slug)}`).print();
|
|
2119
|
+
break;
|
|
2120
|
+
}
|
|
2121
|
+
const content = JSON.stringify(configuration, null, 2);
|
|
2122
|
+
await fs.writeFile(configFile, content);
|
|
2123
|
+
await fs.writeFile(
|
|
2124
|
+
path.join(currentDir, DEFAULT_MARKDOWN_FILE_NAME),
|
|
2125
|
+
quickstartMarkdown
|
|
2126
|
+
);
|
|
2127
|
+
await fs.writeFile(
|
|
2128
|
+
path.join(currentDir, DEFAULT_OPENAPI_FILE_NAME),
|
|
2129
|
+
JSON.stringify(__default, null, 2)
|
|
2130
|
+
);
|
|
2131
|
+
output.info().line(`${as.green("\u2714")} Configuration stored.
|
|
2132
|
+
`).line(`${as.green.bold(`${configFile}`)}
|
|
2133
|
+
`).line(
|
|
2134
|
+
`${as.grey(
|
|
2135
|
+
content.split("\n").map((line) => ` ${line}`).join("\n")
|
|
2136
|
+
)}`
|
|
2137
|
+
).print();
|
|
2138
|
+
nextSteps();
|
|
2139
|
+
}
|
|
2140
|
+
export {
|
|
2141
|
+
initAction
|
|
2142
|
+
};
|