@voltro/plugin-openapi 0.84.0 → 0.86.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.
- package/CHANGELOG.md +1215 -0
- package/README.md +6 -0
- package/THIRD-PARTY-NOTICES.md +118 -600
- package/dist/generate.js +436 -0
- package/dist/index.js +94 -563
- package/dist/rpc.js +45 -0
- package/dist/swaggerUi.js +20 -0
- package/package.json +4 -4
package/dist/generate.js
ADDED
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
import { rpcPathItems as e } from "./rpc.js";
|
|
2
|
+
import { jsonSchemaDocumentOf as t } from "@voltro/protocol";
|
|
3
|
+
import { publicSurfaceDigest as n } from "@voltro/protocol/rest";
|
|
4
|
+
//#region src/generate.ts
|
|
5
|
+
var r = (e) => e.replace(/:([A-Za-z0-9_]+)/g, "{$1}"), i = (e) => {
|
|
6
|
+
let t = e.anyOf ?? e.oneOf;
|
|
7
|
+
if (!Array.isArray(t)) return e;
|
|
8
|
+
let n = t.filter((e) => e.type !== "null");
|
|
9
|
+
return n.length === 1 && n.length < t.length ? n[0] : e;
|
|
10
|
+
}, a = (e, n) => {
|
|
11
|
+
let r = t(e, { closed: !1 });
|
|
12
|
+
for (let [e, t] of Object.entries(r.definitions)) n[e] = t;
|
|
13
|
+
return r.schema;
|
|
14
|
+
}, o = (e) => {
|
|
15
|
+
if (Array.isArray(e)) return e.map(o);
|
|
16
|
+
if (e && typeof e == "object") {
|
|
17
|
+
let t = {};
|
|
18
|
+
for (let [n, r] of Object.entries(e)) t[n] = n === "$ref" && typeof r == "string" && r.startsWith("#/$defs/") ? `#/components/schemas/${r.slice(8)}` : o(r);
|
|
19
|
+
return t;
|
|
20
|
+
}
|
|
21
|
+
return e;
|
|
22
|
+
}, s = (e, t) => {
|
|
23
|
+
if (!e) return {
|
|
24
|
+
parameters: [],
|
|
25
|
+
requestBody: void 0
|
|
26
|
+
};
|
|
27
|
+
let n = a(e, t), r = n.properties ?? {}, i = new Set(n.required ?? []), o = [];
|
|
28
|
+
for (let [e, t] of [["query", "query"], ["params", "path"]]) {
|
|
29
|
+
let n = r[e];
|
|
30
|
+
if (!n || typeof n != "object") continue;
|
|
31
|
+
let i = n.properties ?? {}, a = new Set(n.required ?? []);
|
|
32
|
+
for (let [e, n] of Object.entries(i)) o.push({
|
|
33
|
+
name: e,
|
|
34
|
+
in: t,
|
|
35
|
+
required: t === "path" || a.has(e),
|
|
36
|
+
schema: n
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
let s = r.body;
|
|
40
|
+
return {
|
|
41
|
+
parameters: o,
|
|
42
|
+
requestBody: s && typeof s == "object" ? {
|
|
43
|
+
required: i.has("body"),
|
|
44
|
+
content: { "application/json": { schema: s } }
|
|
45
|
+
} : void 0
|
|
46
|
+
};
|
|
47
|
+
}, c = "VoltroHttpError", l = {
|
|
48
|
+
type: "object",
|
|
49
|
+
description: "The serve pipeline's error envelope.",
|
|
50
|
+
properties: {
|
|
51
|
+
error: {
|
|
52
|
+
type: "string",
|
|
53
|
+
description: "Human-readable error message."
|
|
54
|
+
},
|
|
55
|
+
detail: {
|
|
56
|
+
type: "string",
|
|
57
|
+
description: "Decode failure detail (400 only)."
|
|
58
|
+
},
|
|
59
|
+
replacement: {
|
|
60
|
+
type: "string",
|
|
61
|
+
description: "Replacement endpoint hint (410 only)."
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
required: ["error"]
|
|
65
|
+
}, u = (e) => ({
|
|
66
|
+
description: e,
|
|
67
|
+
content: { "application/json": { schema: { $ref: `#/components/schemas/${c}` } } }
|
|
68
|
+
}), d = "ProblemDetails", f = {
|
|
69
|
+
type: "object",
|
|
70
|
+
description: "RFC 9457 Problem Details. Extension members carry the error's own fields.",
|
|
71
|
+
properties: {
|
|
72
|
+
type: {
|
|
73
|
+
type: "string",
|
|
74
|
+
format: "uri",
|
|
75
|
+
description: "The error type — `urn:voltro:error:<Tag>`."
|
|
76
|
+
},
|
|
77
|
+
title: { type: "string" },
|
|
78
|
+
status: { type: "integer" },
|
|
79
|
+
detail: { type: "string" }
|
|
80
|
+
},
|
|
81
|
+
required: [
|
|
82
|
+
"type",
|
|
83
|
+
"title",
|
|
84
|
+
"status"
|
|
85
|
+
],
|
|
86
|
+
additionalProperties: !0
|
|
87
|
+
}, p = (e, t, n = 0) => {
|
|
88
|
+
if (n > 6) return null;
|
|
89
|
+
let r = e.$ref;
|
|
90
|
+
if (typeof r == "string") {
|
|
91
|
+
let e = t[r.split("/").pop() ?? ""];
|
|
92
|
+
return e !== void 0 && typeof e == "object" ? p(e, t, n + 1) : null;
|
|
93
|
+
}
|
|
94
|
+
if (e.example !== void 0) return e.example;
|
|
95
|
+
if (Array.isArray(e.examples) && e.examples.length > 0) return e.examples[0];
|
|
96
|
+
if (e.const !== void 0) return e.const;
|
|
97
|
+
if (Array.isArray(e.enum) && e.enum.length > 0) return e.enum[0];
|
|
98
|
+
let i = e.anyOf ?? e.oneOf;
|
|
99
|
+
if (Array.isArray(i) && i.length > 0) return p(i.find((e) => e.type !== "null") ?? i[0], t, n + 1);
|
|
100
|
+
let a = e.allOf;
|
|
101
|
+
if (Array.isArray(a) && a.length > 0) {
|
|
102
|
+
let e = a.map((e) => p(e, t, n + 1));
|
|
103
|
+
return e.every((e) => typeof e == "object" && !!e && !Array.isArray(e)) ? Object.assign({}, ...e) : e[0];
|
|
104
|
+
}
|
|
105
|
+
let o = e.type;
|
|
106
|
+
switch (Array.isArray(o) ? o.find((e) => e !== "null") : o) {
|
|
107
|
+
case "string": {
|
|
108
|
+
let t = e.format;
|
|
109
|
+
if (t === "date-time") return "2026-01-01T00:00:00.000Z";
|
|
110
|
+
if (t === "date") return "2026-01-01";
|
|
111
|
+
if (t === "email") return "user@example.com";
|
|
112
|
+
if (t === "uri" || t === "url") return "https://example.com";
|
|
113
|
+
if (t === "uuid") return "00000000-0000-4000-8000-000000000000";
|
|
114
|
+
let n = typeof e.minLength == "number" ? e.minLength : 0;
|
|
115
|
+
return "string".padEnd(Math.max(n, 6), "x");
|
|
116
|
+
}
|
|
117
|
+
case "integer": return typeof e.minimum == "number" ? e.minimum : 1;
|
|
118
|
+
case "number": return typeof e.minimum == "number" ? e.minimum : 1;
|
|
119
|
+
case "boolean": return !0;
|
|
120
|
+
case "null": return null;
|
|
121
|
+
case "array": {
|
|
122
|
+
let r = e.items;
|
|
123
|
+
return r !== void 0 && typeof r == "object" && !Array.isArray(r) ? [p(r, t, n + 1)] : [];
|
|
124
|
+
}
|
|
125
|
+
case "object": {
|
|
126
|
+
let r = e.properties ?? {}, i = {};
|
|
127
|
+
for (let [e, a] of Object.entries(r)) i[e] = p(a, t, n + 1);
|
|
128
|
+
return i;
|
|
129
|
+
}
|
|
130
|
+
default: return typeof e.properties == "object" ? p({
|
|
131
|
+
...e,
|
|
132
|
+
type: "object"
|
|
133
|
+
}, t, n) : null;
|
|
134
|
+
}
|
|
135
|
+
}, m = {
|
|
136
|
+
400: {
|
|
137
|
+
tag: "InvalidRequest",
|
|
138
|
+
detail: "Invalid request"
|
|
139
|
+
},
|
|
140
|
+
401: {
|
|
141
|
+
tag: "Unauthorized",
|
|
142
|
+
detail: "Authentication required"
|
|
143
|
+
},
|
|
144
|
+
403: {
|
|
145
|
+
tag: "Forbidden",
|
|
146
|
+
detail: "Missing required scope: <scope>"
|
|
147
|
+
},
|
|
148
|
+
410: {
|
|
149
|
+
tag: "Gone",
|
|
150
|
+
detail: "Gone"
|
|
151
|
+
},
|
|
152
|
+
500: {
|
|
153
|
+
tag: "InternalServerError",
|
|
154
|
+
detail: "Internal Server Error"
|
|
155
|
+
}
|
|
156
|
+
}, h = {
|
|
157
|
+
400: "Bad Request",
|
|
158
|
+
401: "Unauthorized",
|
|
159
|
+
403: "Forbidden",
|
|
160
|
+
404: "Not Found",
|
|
161
|
+
409: "Conflict",
|
|
162
|
+
410: "Gone",
|
|
163
|
+
422: "Unprocessable Content",
|
|
164
|
+
429: "Too Many Requests",
|
|
165
|
+
500: "Internal Server Error"
|
|
166
|
+
}, g = (e, t, n) => {
|
|
167
|
+
let r = t.format.errors === "problem-details" && t.format.encodeError === void 0, i = r ? "application/problem+json" : "application/json", o = /* @__PURE__ */ new Map();
|
|
168
|
+
for (let e of t.errorResponses) {
|
|
169
|
+
let t = o.get(e.status) ?? [], i = a(e.schema, n), s = p(i, n), { _tag: c, ...l } = typeof s == "object" && s ? s : {}, u = r ? {
|
|
170
|
+
type: `urn:voltro:error:${e.tag}`,
|
|
171
|
+
title: e.tag.replace(/([a-z0-9])([A-Z])/g, "$1 $2"),
|
|
172
|
+
status: e.status,
|
|
173
|
+
...l
|
|
174
|
+
} : {
|
|
175
|
+
error: e.tag,
|
|
176
|
+
...l
|
|
177
|
+
};
|
|
178
|
+
t.push({
|
|
179
|
+
tag: e.tag,
|
|
180
|
+
example: u,
|
|
181
|
+
schema: r ? { allOf: [{ $ref: `#/components/schemas/${d}` }, {
|
|
182
|
+
type: "object",
|
|
183
|
+
properties: { type: { const: `urn:voltro:error:${e.tag}` } }
|
|
184
|
+
}] } : i
|
|
185
|
+
}), o.set(e.status, t);
|
|
186
|
+
}
|
|
187
|
+
let s = (e, t) => {
|
|
188
|
+
if (!r) return u(t);
|
|
189
|
+
let n = m[e], a = n === void 0 ? {} : { example: {
|
|
190
|
+
type: `urn:voltro:error:${n.tag}`,
|
|
191
|
+
title: n.tag.replace(/([a-z])([A-Z])/g, "$1 $2"),
|
|
192
|
+
status: e,
|
|
193
|
+
detail: n.detail
|
|
194
|
+
} };
|
|
195
|
+
return {
|
|
196
|
+
description: t,
|
|
197
|
+
content: { [i]: {
|
|
198
|
+
schema: { $ref: `#/components/schemas/${d}` },
|
|
199
|
+
...a
|
|
200
|
+
} }
|
|
201
|
+
};
|
|
202
|
+
}, c = {};
|
|
203
|
+
c[400] = s(400, "Invalid request — the input failed schema decode."), t.security !== "none" && (c[401] = s(401, "Unauthorized — no valid bearer.")), (t.security === "required" || (e.guards?.length ?? 0) > 0) && (c[403] = s(403, "Forbidden — the caller lacks a required scope."));
|
|
204
|
+
for (let [e, t] of [...o.entries()].sort((e, t) => e[0] - t[0])) {
|
|
205
|
+
let n = t.map((e) => e.tag);
|
|
206
|
+
c[String(e)] = {
|
|
207
|
+
description: `${h[e] ?? "Error"} — ${n.join(" | ")}`,
|
|
208
|
+
content: { [i]: {
|
|
209
|
+
schema: t.length === 1 ? t[0].schema : { oneOf: t.map((e) => e.schema) },
|
|
210
|
+
example: t[0].example
|
|
211
|
+
} }
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
return e.sunset !== void 0 && (c[410] = s(410, `Gone — the route is past its sunset date (${e.sunset}).`)), c[500] = s(500, "Internal Server Error."), c;
|
|
215
|
+
}, _ = (e, t, n) => {
|
|
216
|
+
let r = a(t.input, n), o = r.properties ?? {}, s = new Set(r.required ?? []), c = new Set(t.pathParams), l = [], u = {}, d = [], f = e.example?.request, p = (e) => typeof f == "object" && f && e in f ? { example: f[e] } : {};
|
|
217
|
+
for (let [t, n] of Object.entries(o)) {
|
|
218
|
+
let r = s.has(t) ? n : i(n);
|
|
219
|
+
c.has(t) ? l.push({
|
|
220
|
+
name: t,
|
|
221
|
+
in: "path",
|
|
222
|
+
required: !0,
|
|
223
|
+
schema: r,
|
|
224
|
+
...p(t)
|
|
225
|
+
}) : e.method === "GET" ? l.push({
|
|
226
|
+
name: t,
|
|
227
|
+
in: "query",
|
|
228
|
+
required: s.has(t),
|
|
229
|
+
schema: r,
|
|
230
|
+
...p(t)
|
|
231
|
+
}) : (u[t] = r, s.has(t) && d.push(t));
|
|
232
|
+
}
|
|
233
|
+
return {
|
|
234
|
+
parameters: l,
|
|
235
|
+
requestBody: e.method !== "GET" && Object.keys(u).length > 0 ? {
|
|
236
|
+
required: d.length > 0,
|
|
237
|
+
content: {
|
|
238
|
+
"application/json": { schema: {
|
|
239
|
+
...r,
|
|
240
|
+
properties: u,
|
|
241
|
+
required: d
|
|
242
|
+
} },
|
|
243
|
+
"application/x-www-form-urlencoded": { schema: {
|
|
244
|
+
...r,
|
|
245
|
+
properties: u,
|
|
246
|
+
required: d
|
|
247
|
+
} }
|
|
248
|
+
}
|
|
249
|
+
} : void 0
|
|
250
|
+
};
|
|
251
|
+
}, v = (e, t, n) => {
|
|
252
|
+
if (e.streaming === !0) return {
|
|
253
|
+
description: "Server-Sent Events stream (`snapshot`, then `delta` per change)",
|
|
254
|
+
content: { "text/event-stream": { schema: { type: "string" } } }
|
|
255
|
+
};
|
|
256
|
+
let r = a(t.output, n), i = t.format, o = i.pagination === "link-header" && y(r, n, i.cursorField), s = i.encodeSuccess === void 0 ? i.envelope === "data" ? {
|
|
257
|
+
type: "object",
|
|
258
|
+
properties: {
|
|
259
|
+
data: r,
|
|
260
|
+
...o ? { next: {
|
|
261
|
+
type: "string",
|
|
262
|
+
description: "The next page's cursor, when there is one."
|
|
263
|
+
} } : {}
|
|
264
|
+
},
|
|
265
|
+
required: ["data"]
|
|
266
|
+
} : i.envelope === "jsonapi" ? {
|
|
267
|
+
type: "object",
|
|
268
|
+
properties: {
|
|
269
|
+
data: { description: "One resource or an array of resources — `{ type, id, attributes }`." },
|
|
270
|
+
links: {
|
|
271
|
+
type: "object",
|
|
272
|
+
properties: { next: { type: "string" } }
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
required: ["data"]
|
|
276
|
+
} : r : { description: `Encoded by the '${i.name}' format.` }, c = i.envelope === "jsonapi" ? "application/vnd.api+json" : "application/json", l = {
|
|
277
|
+
...o ? { Link: {
|
|
278
|
+
description: "RFC 8288 — `<url>; rel=\"next\"` when there is a next page.",
|
|
279
|
+
schema: { type: "string" }
|
|
280
|
+
} } : {},
|
|
281
|
+
...e.etag === !0 ? { ETag: {
|
|
282
|
+
description: "Weak validator; send it back as `If-None-Match` for a 304.",
|
|
283
|
+
schema: { type: "string" }
|
|
284
|
+
} } : {},
|
|
285
|
+
...e.cache !== void 0 && e.method === "GET" ? {
|
|
286
|
+
"Cache-Control": {
|
|
287
|
+
description: `\`public, max-age=${e.cache.maxAge}\` for a request without a credential; \`private, no-cache\` for one with \`Authorization\` or a cookie.`,
|
|
288
|
+
schema: { type: "string" }
|
|
289
|
+
},
|
|
290
|
+
...e.cache.tags === void 0 ? {} : {
|
|
291
|
+
"Cache-Tag": {
|
|
292
|
+
description: "Purge tags, comma-separated (only on a public answer).",
|
|
293
|
+
schema: { type: "string" }
|
|
294
|
+
},
|
|
295
|
+
"Surrogate-Key": {
|
|
296
|
+
description: "The same purge tags, space-separated (only on a public answer).",
|
|
297
|
+
schema: { type: "string" }
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
} : {}
|
|
301
|
+
};
|
|
302
|
+
return {
|
|
303
|
+
description: "OK",
|
|
304
|
+
...Object.keys(l).length > 0 ? { headers: l } : {},
|
|
305
|
+
content: { [c]: {
|
|
306
|
+
schema: s,
|
|
307
|
+
...b(e.example?.response, s, n)
|
|
308
|
+
} }
|
|
309
|
+
};
|
|
310
|
+
}, y = (e, t, n) => {
|
|
311
|
+
let r = e.$ref, i = (typeof r == "string" ? t[r.split("/").pop() ?? ""] : e)?.properties;
|
|
312
|
+
return typeof i == "object" && !!i && n in i;
|
|
313
|
+
}, b = (e, t, n) => e === void 0 ? {
|
|
314
|
+
example: p(t, n),
|
|
315
|
+
"x-voltro-example": "derived"
|
|
316
|
+
} : { example: e }, x = (e) => ({
|
|
317
|
+
...e.input === void 0 ? {} : { 400: u("Invalid request — the input failed schema decode.") },
|
|
318
|
+
...e.guards !== void 0 && e.guards.length > 0 ? {
|
|
319
|
+
401: u("Unauthorized — a guard rejected the unauthenticated request."),
|
|
320
|
+
403: u("Forbidden — a guard rejected the request (e.g. a required scope is missing).")
|
|
321
|
+
} : {},
|
|
322
|
+
...e.sunset === void 0 ? {} : { 410: u(`Gone — the route is past its sunset date (${e.sunset}).`) },
|
|
323
|
+
500: u("Internal Server Error.")
|
|
324
|
+
});
|
|
325
|
+
function S(t, i = {}, u = {}, p = {}) {
|
|
326
|
+
let m = {}, h = {}, y = t.some((e) => e.guards !== void 0 && e.guards.length > 0), S = t.some((e) => e.projection !== void 0 && e.projection.security !== "none"), C = t.some((e) => e.projection?.format.errors === "problem-details" && e.projection.format.encodeError === void 0), w = /* @__PURE__ */ new Set();
|
|
327
|
+
for (let e of t) {
|
|
328
|
+
let t = e.projection, { parameters: n, requestBody: i } = t === void 0 ? s(e.input, h) : _(e, t, h), o = e.etag === !0 && e.method === "GET" && e.streaming !== !0, c = o ? [...n, {
|
|
329
|
+
name: "If-None-Match",
|
|
330
|
+
in: "header",
|
|
331
|
+
required: !1,
|
|
332
|
+
description: "A previously returned ETag. A matching validator returns 304 without a body.",
|
|
333
|
+
schema: { type: "string" }
|
|
334
|
+
}] : n, l = o ? { 304: {
|
|
335
|
+
description: "Not Modified",
|
|
336
|
+
headers: { ETag: {
|
|
337
|
+
description: "The current representation validator.",
|
|
338
|
+
schema: { type: "string" }
|
|
339
|
+
} }
|
|
340
|
+
} } : {}, u = e.guards !== void 0 && e.guards.length > 0;
|
|
341
|
+
if (i !== void 0) {
|
|
342
|
+
let t = i.content;
|
|
343
|
+
t["application/json"] = {
|
|
344
|
+
...t["application/json"],
|
|
345
|
+
...b(e.example?.request, t["application/json"].schema, h)
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
let d = t === void 0 ? u ? { security: [{ bearerAuth: [] }] } : {} : t.security === "required" ? { security: [{ bearerAuth: [] }] } : t.security === "optional" ? { security: [{ bearerAuth: [] }, {}] } : {}, f = e.tags ?? (e.version === void 0 ? void 0 : [e.version]);
|
|
349
|
+
for (let e of f ?? []) w.add(e);
|
|
350
|
+
let p = t?.version ?? e.version, y = {
|
|
351
|
+
...e.operationId === void 0 ? {} : { operationId: e.operationId },
|
|
352
|
+
...e.summary ? { summary: e.summary } : {},
|
|
353
|
+
...e.description ? { description: e.description } : {},
|
|
354
|
+
...e.deprecated === void 0 ? {} : { deprecated: !0 },
|
|
355
|
+
...e.sunset === void 0 ? {} : { "x-sunset": e.sunset },
|
|
356
|
+
...f === void 0 ? {} : { tags: f },
|
|
357
|
+
...p === void 0 ? {} : { "x-voltro-api-version": p },
|
|
358
|
+
...c.length > 0 ? { parameters: c } : {},
|
|
359
|
+
...i ? { requestBody: i } : {},
|
|
360
|
+
...d,
|
|
361
|
+
responses: t === void 0 ? {
|
|
362
|
+
200: e.streaming === !0 ? {
|
|
363
|
+
description: "Server-Sent Events stream (`snapshot`, then `delta` per change)",
|
|
364
|
+
content: { "text/event-stream": { schema: { type: "string" } } }
|
|
365
|
+
} : {
|
|
366
|
+
description: "OK",
|
|
367
|
+
content: { "application/json": {
|
|
368
|
+
schema: a(e.output, h),
|
|
369
|
+
...b(e.example?.response, a(e.output, h), h)
|
|
370
|
+
} }
|
|
371
|
+
},
|
|
372
|
+
...x(e),
|
|
373
|
+
...l
|
|
374
|
+
} : {
|
|
375
|
+
200: v(e, t, h),
|
|
376
|
+
...l,
|
|
377
|
+
...g(e, t, h)
|
|
378
|
+
}
|
|
379
|
+
};
|
|
380
|
+
t?.format.describe !== void 0 && (y = t.format.describe(y, {
|
|
381
|
+
tag: t.tag,
|
|
382
|
+
method: e.method,
|
|
383
|
+
path: e.path
|
|
384
|
+
}));
|
|
385
|
+
let S = r(e.path), C = m[S] ?? {};
|
|
386
|
+
C[e.method.toLowerCase()] = y, m[S] = C;
|
|
387
|
+
}
|
|
388
|
+
let T = u.procedures ?? [];
|
|
389
|
+
if (T.length > 0) {
|
|
390
|
+
let t = e(T, h);
|
|
391
|
+
for (let [e, n] of Object.entries(t)) m[e] = {
|
|
392
|
+
...n,
|
|
393
|
+
...m[e] ?? {}
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
let E = [...w].sort().map((e) => ({
|
|
397
|
+
name: e,
|
|
398
|
+
...p.tagDescriptions?.[e] === void 0 ? {} : { description: p.tagDescriptions[e] },
|
|
399
|
+
...p.tagExternalDocs?.[e] === void 0 ? {} : { externalDocs: p.tagExternalDocs[e] }
|
|
400
|
+
})), D = (p.servers ?? []).map((e) => ({
|
|
401
|
+
url: e.url,
|
|
402
|
+
...e.description === void 0 ? {} : { description: e.description },
|
|
403
|
+
...e.environment === void 0 ? {} : { "x-voltro-environment": e.environment }
|
|
404
|
+
}));
|
|
405
|
+
return {
|
|
406
|
+
openapi: "3.1.0",
|
|
407
|
+
info: {
|
|
408
|
+
title: i.title ?? "API",
|
|
409
|
+
version: i.version ?? "1.0.0",
|
|
410
|
+
...i.description ? { description: i.description } : {},
|
|
411
|
+
...i.contact === void 0 ? {} : { contact: i.contact },
|
|
412
|
+
...i.license === void 0 ? {} : { license: i.license },
|
|
413
|
+
...i.termsOfService === void 0 ? {} : { termsOfService: i.termsOfService },
|
|
414
|
+
...i.logo === void 0 ? {} : { "x-logo": i.logo }
|
|
415
|
+
},
|
|
416
|
+
...D.length > 0 ? { servers: D } : {},
|
|
417
|
+
...p.externalDocs === void 0 ? {} : { externalDocs: p.externalDocs },
|
|
418
|
+
...p.environment === void 0 ? {} : { "x-voltro-environment": p.environment },
|
|
419
|
+
...t.some((e) => e.projection !== void 0) ? { "x-voltro-surface-digest": n(t) } : {},
|
|
420
|
+
...E.length > 0 ? { tags: E } : {},
|
|
421
|
+
paths: o(m),
|
|
422
|
+
components: {
|
|
423
|
+
schemas: {
|
|
424
|
+
...o(h),
|
|
425
|
+
[c]: l,
|
|
426
|
+
...C ? { [d]: f } : {}
|
|
427
|
+
},
|
|
428
|
+
...y || S ? { securitySchemes: { bearerAuth: {
|
|
429
|
+
type: "http",
|
|
430
|
+
scheme: "bearer"
|
|
431
|
+
} } } : {}
|
|
432
|
+
}
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
//#endregion
|
|
436
|
+
export { l as HTTP_ERROR_SCHEMA, c as HTTP_ERROR_SCHEMA_NAME, f as PROBLEM_DETAILS_SCHEMA, d as PROBLEM_DETAILS_SCHEMA_NAME, p as deriveExample, u as errorResponse, S as generateOpenApiSpec, o as rewriteRefs, a as toJsonSchema };
|