@shipworthy/openapi-parser 0.0.0-stage → 0.0.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.
Files changed (99) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +361 -2
  3. package/dist/bundle.d.ts +973 -0
  4. package/dist/bundle.js +11 -0
  5. package/dist/codec.d.ts +2188 -0
  6. package/dist/codec.js +42 -0
  7. package/dist/document.d.ts +9 -0
  8. package/dist/document.js +28 -0
  9. package/dist/errors.d.ts +105 -0
  10. package/dist/errors.js +162 -0
  11. package/dist/hoist.d.ts +10 -0
  12. package/dist/hoist.js +444 -0
  13. package/dist/http.d.ts +2 -0
  14. package/dist/http.js +163 -0
  15. package/dist/index.d.ts +3 -0
  16. package/dist/index.js +2 -0
  17. package/dist/load.d.ts +17 -0
  18. package/dist/load.js +128 -0
  19. package/dist/loader.d.ts +11 -0
  20. package/dist/loader.js +89 -0
  21. package/dist/parsers.d.ts +5 -0
  22. package/dist/parsers.js +90 -0
  23. package/dist/pipeline.d.ts +3 -0
  24. package/dist/pipeline.js +446 -0
  25. package/dist/plugins.d.ts +95 -0
  26. package/dist/plugins.js +61 -0
  27. package/dist/pointer.d.ts +7 -0
  28. package/dist/pointer.js +80 -0
  29. package/dist/run.d.ts +17 -0
  30. package/dist/run.js +313 -0
  31. package/dist/schemas/3.1/callback.d.ts +205 -0
  32. package/dist/schemas/3.1/callback.js +4 -0
  33. package/dist/schemas/3.1/components.d.ts +801 -0
  34. package/dist/schemas/3.1/components.js +25 -0
  35. package/dist/schemas/3.1/contact.d.ts +7 -0
  36. package/dist/schemas/3.1/contact.js +7 -0
  37. package/dist/schemas/3.1/document.d.ts +1093 -0
  38. package/dist/schemas/3.1/document.js +25 -0
  39. package/dist/schemas/3.1/encoding.d.ts +14 -0
  40. package/dist/schemas/3.1/encoding.js +11 -0
  41. package/dist/schemas/3.1/example.d.ts +8 -0
  42. package/dist/schemas/3.1/example.js +10 -0
  43. package/dist/schemas/3.1/external-docs.d.ts +6 -0
  44. package/dist/schemas/3.1/external-docs.js +6 -0
  45. package/dist/schemas/3.1/header.d.ts +194 -0
  46. package/dist/schemas/3.1/header.js +29 -0
  47. package/dist/schemas/3.1/http-method.d.ts +4 -0
  48. package/dist/schemas/3.1/http-method.js +12 -0
  49. package/dist/schemas/3.1/index.d.ts +29 -0
  50. package/dist/schemas/3.1/index.js +29 -0
  51. package/dist/schemas/3.1/info.d.ts +19 -0
  52. package/dist/schemas/3.1/info.js +13 -0
  53. package/dist/schemas/3.1/license.d.ts +7 -0
  54. package/dist/schemas/3.1/license.js +9 -0
  55. package/dist/schemas/3.1/link.d.ts +18 -0
  56. package/dist/schemas/3.1/link.js +13 -0
  57. package/dist/schemas/3.1/media-type.d.ts +27 -0
  58. package/dist/schemas/3.1/media-type.js +14 -0
  59. package/dist/schemas/3.1/oauth-flow.d.ts +8 -0
  60. package/dist/schemas/3.1/oauth-flow.js +8 -0
  61. package/dist/schemas/3.1/oauth-flows.d.ts +28 -0
  62. package/dist/schemas/3.1/oauth-flows.js +13 -0
  63. package/dist/schemas/3.1/object.d.ts +5 -0
  64. package/dist/schemas/3.1/object.js +17 -0
  65. package/dist/schemas/3.1/operation.d.ts +1040 -0
  66. package/dist/schemas/3.1/operation.js +25 -0
  67. package/dist/schemas/3.1/parameter.d.ts +101 -0
  68. package/dist/schemas/3.1/parameter.js +33 -0
  69. package/dist/schemas/3.1/path-item.d.ts +127 -0
  70. package/dist/schemas/3.1/path-item.js +22 -0
  71. package/dist/schemas/3.1/paths.d.ts +126 -0
  72. package/dist/schemas/3.1/paths.js +4 -0
  73. package/dist/schemas/3.1/reference.d.ts +13 -0
  74. package/dist/schemas/3.1/reference.js +11 -0
  75. package/dist/schemas/3.1/request-body.d.ts +31 -0
  76. package/dist/schemas/3.1/request-body.js +8 -0
  77. package/dist/schemas/3.1/response.d.ts +149 -0
  78. package/dist/schemas/3.1/response.js +12 -0
  79. package/dist/schemas/3.1/responses.d.ts +152 -0
  80. package/dist/schemas/3.1/responses.js +7 -0
  81. package/dist/schemas/3.1/schema.d.ts +4 -0
  82. package/dist/schemas/3.1/schema.js +6 -0
  83. package/dist/schemas/3.1/security-requirement.d.ts +3 -0
  84. package/dist/schemas/3.1/security-requirement.js +2 -0
  85. package/dist/schemas/3.1/security-scheme.d.ts +49 -0
  86. package/dist/schemas/3.1/security-scheme.js +25 -0
  87. package/dist/schemas/3.1/server-variable.d.ts +7 -0
  88. package/dist/schemas/3.1/server-variable.js +7 -0
  89. package/dist/schemas/3.1/server.d.ts +11 -0
  90. package/dist/schemas/3.1/server.js +8 -0
  91. package/dist/schemas/3.1/tag.d.ts +10 -0
  92. package/dist/schemas/3.1/tag.js +8 -0
  93. package/dist/upgraders/3.0-to-3.1.d.ts +9 -0
  94. package/dist/upgraders/3.0-to-3.1.js +310 -0
  95. package/dist/url.d.ts +29 -0
  96. package/dist/url.js +255 -0
  97. package/dist/yaml.d.ts +6 -0
  98. package/dist/yaml.js +235 -0
  99. package/package.json +50 -4
package/dist/run.d.ts ADDED
@@ -0,0 +1,17 @@
1
+ import { Effect, FileSystem } from "effect";
2
+ import type { HttpClient } from "effect/http";
3
+ import { type TaggedFailure } from "./errors.ts";
4
+ import { Options } from "./plugins.ts";
5
+ interface RunResult {
6
+ schema: unknown;
7
+ documents: Map<string, unknown>;
8
+ }
9
+ type RunMode = "parse" | "bundle" | "dereference";
10
+ interface RunRequest {
11
+ readonly path: string;
12
+ readonly schema?: unknown;
13
+ readonly options?: Options;
14
+ readonly mode?: RunMode;
15
+ }
16
+ export declare const runEffect: (args: RunRequest) => Effect.Effect<RunResult, TaggedFailure, FileSystem.FileSystem | HttpClient.HttpClient>;
17
+ export {};
package/dist/run.js ADDED
@@ -0,0 +1,313 @@
1
+ import { Array, Cache, Effect, Predicate, Ref, Schema } from "effect";
2
+ import { ParserFailure, groupFailure, isLeafFailure, missingPointerFailure, syncFailure, } from "./errors.js";
3
+ import { hoistExternalRefs } from "./hoist.js";
4
+ import { loadDocument, makeContext } from "./loader.js";
5
+ import { Options } from "./plugins.js";
6
+ import { cloneData, joinPointer, parsePointer } from "./pointer.js";
7
+ import { inlineRemaining, runSchemaPipeline } from "./pipeline.js";
8
+ import { isOpenApi3, upgradeOpenApi3_0 } from "./upgraders/3.0-to-3.1.js";
9
+ import { getHash, isHttp, normalizeRef, resolveAgainst, stripHash } from "./url.js";
10
+ const loadConcurrency = 8;
11
+ export const runEffect = Effect.fn("openapi-parser.run")(function* (args) {
12
+ const mode = args.mode ?? "bundle";
13
+ const options = yield* Schema.decodeEffect(Options)(args.options ?? {}).pipe(Effect.mapError((cause) => new ParserFailure({ message: cause.message, source: args.path, cause })));
14
+ const rootUrl = yield* normalizeRef(args.path);
15
+ const context = makeContext(rootUrl, options);
16
+ const failures = yield* Ref.make([]);
17
+ const recorded = new Set();
18
+ const cache = yield* Cache.make({
19
+ capacity: 10_000,
20
+ lookup: (url) => loadDocument(url, context).pipe(Effect.withSpan("openapi-parser.load", { attributes: { url } })),
21
+ });
22
+ const documents = new Map();
23
+ const rootKey = stripHash(rootUrl);
24
+ const root = args.schema === undefined
25
+ ? yield* loadCaught(cache, rootKey, options, failures, recorded)
26
+ : cloneData(args.schema);
27
+ if (root === undefined)
28
+ return yield* failCollected(rootUrl, failures);
29
+ documents.set(rootKey, root);
30
+ if (mode === "parse")
31
+ return { schema: root, documents };
32
+ const kept = new Set();
33
+ const ids = new Map();
34
+ const keep = (ref) => Boolean(options.keepUrlRefs && isHttp(ref));
35
+ if (typeof root === "object" && root !== null)
36
+ absolutize(root, rootUrl, ids, keep, kept);
37
+ yield* loadClosure(root, cache, documents, ids, keep, kept, options, failures, recorded);
38
+ const collected = yield* Ref.get(failures);
39
+ if (collected.length > 0 && options.continueOnError)
40
+ return yield* failCollected(rootUrl, failures);
41
+ if (typeof root !== "object" || root === null || Array.isArray(root))
42
+ return { schema: root, documents };
43
+ const record = root;
44
+ yield* Effect.try({
45
+ try: () => {
46
+ const placed = hoistExternalRefs(record, (url) => documents.get(stripHash(url)), options.bundle, (ref) => kept.has(ref) || ids.has(stripHash(ref)));
47
+ rewriteIdRefs(record, ids);
48
+ rewriteMappings(record, placed, ids);
49
+ if (isOpenApi3(record)) {
50
+ upgradeOpenApi3_0(record);
51
+ runSchemaPipeline(record, mode === "dereference" ? "dereference" : "bundle", options.dereference);
52
+ }
53
+ else if (mode === "dereference") {
54
+ inlineRemaining(record, new Set(), options.dereference);
55
+ }
56
+ },
57
+ catch: syncFailure,
58
+ });
59
+ yield* inlineExternalValues(record, cache, keep, kept, options, failures, recorded);
60
+ if ((yield* Ref.get(failures)).length > 0)
61
+ return yield* failCollected(rootUrl, failures);
62
+ return { schema: root, documents };
63
+ });
64
+ const failCollected = Effect.fnUntraced(function* (source, failures) {
65
+ return yield* Ref.get(failures).pipe(Effect.flatMap((errors) => Effect.fail(groupFailure(source, errors))));
66
+ });
67
+ const loadCaught = Effect.fnUntraced(function* (cache, url, options, failures, recorded) {
68
+ return yield* Cache.get(cache, url).pipe(Effect.catch((error) => {
69
+ if (!options.continueOnError || !isLeafFailure(error))
70
+ return Effect.fail(error);
71
+ if (recorded.has(url))
72
+ return Effect.void;
73
+ recorded.add(url);
74
+ return Ref.update(failures, (list) => [...list, error]).pipe(Effect.asVoid);
75
+ }));
76
+ });
77
+ const loadClosure = Effect.fnUntraced(function* (root, cache, documents, ids, keep, kept, options, failures, recorded) {
78
+ const pending = new Set();
79
+ let pass = 0;
80
+ let remaining = true;
81
+ yield* Effect.whileLoop({
82
+ while: () => pass < 1000 && remaining,
83
+ body: () => Effect.gen(function* () {
84
+ pending.clear();
85
+ Array.forEach([root, ...documents.values()], (document) => {
86
+ Array.forEach(Array.fromIterable(externalRefs(document, kept)), (ref) => {
87
+ const url = stripHash(ref);
88
+ if (!ids.has(url) && !documents.has(url) && !kept.has(ref) && !recorded.has(url))
89
+ pending.add(url);
90
+ });
91
+ });
92
+ if (pending.size === 0)
93
+ return false;
94
+ yield* Effect.forEach(pending, Effect.fnUntraced(function* (url) {
95
+ const loaded = yield* loadCaught(cache, url, options, failures, recorded);
96
+ if (loaded === undefined)
97
+ return;
98
+ absolutize(loaded, url, ids, keep, kept);
99
+ documents.set(url, loaded);
100
+ }), { concurrency: loadConcurrency, discard: true });
101
+ return true;
102
+ }),
103
+ step: (more) => {
104
+ remaining = more;
105
+ pass++;
106
+ },
107
+ });
108
+ });
109
+ const referenceKeys = new Set(["$ref", "summary", "description"]);
110
+ /** HTTP `$ref` fields inside example payloads are data, not OpenAPI references. */
111
+ function isBundledRef(record) {
112
+ const ref = record.$ref;
113
+ if (typeof ref !== "string" || !isHttp(ref))
114
+ return true;
115
+ return Object.keys(record).every((key) => referenceKeys.has(key));
116
+ }
117
+ function* externalRefs(node, kept) {
118
+ const seen = new Set();
119
+ const stack = [node];
120
+ while (stack.length > 0) {
121
+ const current = stack.pop();
122
+ if (typeof current !== "object" || current === null || seen.has(current))
123
+ continue;
124
+ seen.add(current);
125
+ if (Array.isArray(current)) {
126
+ stack.push(...current);
127
+ continue;
128
+ }
129
+ const record = current;
130
+ if (typeof record.$ref === "string" &&
131
+ !record.$ref.startsWith("#") &&
132
+ !kept.has(record.$ref) &&
133
+ isBundledRef(record)) {
134
+ yield record.$ref;
135
+ }
136
+ if (typeof record.externalValue === "string" && !kept.has(record.externalValue))
137
+ yield record.externalValue;
138
+ stack.push(...Object.values(record));
139
+ }
140
+ }
141
+ function absolutize(node, base, ids, keep, kept, seen = new Set()) {
142
+ if (typeof node !== "object" || node === null || seen.has(node))
143
+ return;
144
+ seen.add(node);
145
+ if (Array.isArray(node)) {
146
+ for (const item of node)
147
+ absolutize(item, base, ids, keep, kept, seen);
148
+ return;
149
+ }
150
+ const record = node;
151
+ let next = base;
152
+ if (typeof record.$id === "string") {
153
+ next = resolveAgainst(base, record.$id);
154
+ ids.set(stripHash(next), record);
155
+ }
156
+ if (typeof record.$ref === "string" && !record.$ref.startsWith("#")) {
157
+ if (keep(record.$ref))
158
+ kept.add(record.$ref);
159
+ else
160
+ record.$ref = resolveAgainst(base, record.$ref);
161
+ }
162
+ const discriminator = record.discriminator;
163
+ const mapping = Predicate.isObject(discriminator) && Predicate.isObject(discriminator.mapping)
164
+ ? discriminator.mapping
165
+ : undefined;
166
+ if (mapping) {
167
+ for (const [key, value] of Object.entries(mapping)) {
168
+ if (typeof value !== "string" || value.startsWith("#"))
169
+ continue;
170
+ if (keep(value))
171
+ kept.add(value);
172
+ else
173
+ mapping[key] = resolveAgainst(base, value);
174
+ }
175
+ }
176
+ if (typeof record.externalValue === "string") {
177
+ if (keep(record.externalValue))
178
+ kept.add(record.externalValue);
179
+ else
180
+ record.externalValue = resolveAgainst(base, record.externalValue);
181
+ }
182
+ for (const [key, value] of Object.entries(record)) {
183
+ if (key === "$ref" || key === "$id")
184
+ continue;
185
+ absolutize(value, next, ids, keep, kept, seen);
186
+ }
187
+ }
188
+ function rewriteIdRefs(root, ids) {
189
+ const pointers = new Map();
190
+ for (const [url, node] of ids) {
191
+ const pointer = findPointer(root, node);
192
+ if (pointer)
193
+ pointers.set(url, pointer);
194
+ }
195
+ walkRecords(root, (record) => {
196
+ if (typeof record.$ref !== "string" || record.$ref.startsWith("#"))
197
+ return;
198
+ const url = stripHash(record.$ref);
199
+ const pointer = pointers.get(url);
200
+ if (!pointer)
201
+ return;
202
+ const hash = getHash(record.$ref);
203
+ if (hash === "#") {
204
+ record.$ref = pointer;
205
+ return;
206
+ }
207
+ const tokens = parsePointer(hash, record.$ref);
208
+ if (tokens[0] === "$defs" && tokens.length === 2)
209
+ record.$ref = joinPointer("#/$defs", tokens[1]);
210
+ else
211
+ record.$ref = joinPointer(pointer, tokens);
212
+ });
213
+ }
214
+ function rewriteMappings(root, placed, ids) {
215
+ const idPointers = new Map();
216
+ for (const [url, node] of ids) {
217
+ const pointer = findPointer(root, node);
218
+ if (pointer)
219
+ idPointers.set(url, pointer);
220
+ }
221
+ walkRecords(root, (record) => {
222
+ const discriminator = record.discriminator;
223
+ const mapping = Predicate.isObject(discriminator) && Predicate.isObject(discriminator.mapping)
224
+ ? discriminator.mapping
225
+ : undefined;
226
+ if (!mapping)
227
+ return;
228
+ for (const [key, value] of Object.entries(mapping)) {
229
+ if (typeof value !== "string" || value.startsWith("#"))
230
+ continue;
231
+ const url = stripHash(value);
232
+ const hash = getHash(value);
233
+ const target = placed.get(`${url}${hash}`) ?? idPointers.get(url);
234
+ if (target)
235
+ mapping[key] =
236
+ hash === "#" || placed.has(`${url}${hash}`)
237
+ ? target
238
+ : joinPointer(target, parsePointer(hash));
239
+ }
240
+ });
241
+ }
242
+ function findPointer(root, target, pointer = "#", seen = new Set()) {
243
+ if (root === target)
244
+ return pointer;
245
+ if (typeof root !== "object" || root === null || seen.has(root))
246
+ return undefined;
247
+ seen.add(root);
248
+ if (Array.isArray(root)) {
249
+ for (let index = 0; index < root.length; index++) {
250
+ const found = findPointer(root[index], target, joinPointer(pointer, String(index)), seen);
251
+ if (found)
252
+ return found;
253
+ }
254
+ return undefined;
255
+ }
256
+ for (const [key, value] of Object.entries(root)) {
257
+ const found = findPointer(value, target, joinPointer(pointer, key), seen);
258
+ if (found)
259
+ return found;
260
+ }
261
+ return undefined;
262
+ }
263
+ function walkRecords(node, visit, seen = new Set()) {
264
+ if (typeof node !== "object" || node === null || seen.has(node))
265
+ return;
266
+ seen.add(node);
267
+ if (Array.isArray(node)) {
268
+ for (const item of node)
269
+ walkRecords(item, visit, seen);
270
+ return;
271
+ }
272
+ const record = node;
273
+ visit(record);
274
+ for (const value of Object.values(record))
275
+ walkRecords(value, visit, seen);
276
+ }
277
+ const inlineExternalValues = Effect.fnUntraced(function* (root, cache, keep, kept, options, failures, recorded) {
278
+ const pending = [];
279
+ walkRecords(root, (record) => {
280
+ if (typeof record.externalValue === "string" && record.value === undefined)
281
+ pending.push(record);
282
+ });
283
+ yield* Effect.forEach(pending, (record) => Effect.gen(function* () {
284
+ const externalValue = record.externalValue;
285
+ if (typeof externalValue !== "string")
286
+ return;
287
+ if (kept.has(externalValue) || keep(externalValue))
288
+ return;
289
+ const loaded = yield* loadCaught(cache, stripHash(externalValue), options, failures, recorded);
290
+ if (loaded === undefined)
291
+ return;
292
+ const hash = getHash(externalValue);
293
+ const resolved = yield* Effect.try({
294
+ try: () => ({ value: hash === "#" ? loaded : valueAt(loaded, hash) }),
295
+ catch: syncFailure,
296
+ }).pipe(Effect.catchIf((error) => options.continueOnError === true && isLeafFailure(error), (error) => Ref.update(failures, (list) => [...list, error]).pipe(Effect.asVoid)));
297
+ if (!resolved)
298
+ return;
299
+ record.value = resolved.value;
300
+ delete record.externalValue;
301
+ }), { concurrency: loadConcurrency, discard: true });
302
+ });
303
+ function valueAt(document, hash) {
304
+ const tokens = parsePointer(hash);
305
+ let current = document;
306
+ for (const token of tokens) {
307
+ if (typeof current !== "object" || current === null || !Object.hasOwn(current, token)) {
308
+ throw missingPointerFailure(token, hash);
309
+ }
310
+ current = current[token];
311
+ }
312
+ return current;
313
+ }
@@ -0,0 +1,205 @@
1
+ import { Schema } from "effect";
2
+ export declare const OpenApiCallback: Schema.StructWithRest<Schema.$Record<Schema.String, Schema.suspend<Schema.Codec<{
3
+ readonly [x: string]: unknown;
4
+ readonly $ref?: string | undefined;
5
+ readonly summary?: string | undefined;
6
+ readonly description?: string | undefined;
7
+ readonly get?: import("./operation.ts").OpenApiOperation | undefined;
8
+ readonly put?: import("./operation.ts").OpenApiOperation | undefined;
9
+ readonly post?: import("./operation.ts").OpenApiOperation | undefined;
10
+ readonly delete?: import("./operation.ts").OpenApiOperation | undefined;
11
+ readonly options?: import("./operation.ts").OpenApiOperation | undefined;
12
+ readonly head?: import("./operation.ts").OpenApiOperation | undefined;
13
+ readonly patch?: import("./operation.ts").OpenApiOperation | undefined;
14
+ readonly trace?: import("./operation.ts").OpenApiOperation | undefined;
15
+ readonly servers?: readonly {
16
+ readonly [x: string]: unknown;
17
+ readonly url: string;
18
+ readonly description?: string | undefined;
19
+ readonly variables?: {
20
+ readonly [x: string]: {
21
+ readonly [x: string]: unknown;
22
+ readonly default: string;
23
+ readonly enum?: readonly [string, ...string[]] | undefined;
24
+ readonly description?: string | undefined;
25
+ };
26
+ } | undefined;
27
+ }[] | undefined;
28
+ readonly parameters?: readonly ({
29
+ readonly [x: string]: unknown;
30
+ readonly $ref: string;
31
+ readonly summary?: string | undefined;
32
+ readonly description?: string | undefined;
33
+ } | {
34
+ readonly [x: string]: unknown;
35
+ readonly description?: string | undefined;
36
+ readonly required?: boolean | undefined;
37
+ readonly deprecated?: boolean | undefined;
38
+ readonly explode?: boolean | undefined;
39
+ readonly schema?: boolean | {
40
+ readonly [x: string]: unknown;
41
+ } | undefined;
42
+ readonly content?: {
43
+ readonly [x: string]: {
44
+ readonly [x: string]: unknown;
45
+ readonly schema?: boolean | {
46
+ readonly [x: string]: unknown;
47
+ } | undefined;
48
+ readonly example?: unknown;
49
+ readonly examples?: {
50
+ readonly [x: string]: {
51
+ readonly [x: string]: unknown;
52
+ readonly summary?: string | undefined;
53
+ readonly description?: string | undefined;
54
+ readonly value?: unknown;
55
+ readonly externalValue?: string | undefined;
56
+ } | {
57
+ readonly [x: string]: unknown;
58
+ readonly $ref: string;
59
+ readonly summary?: string | undefined;
60
+ readonly description?: string | undefined;
61
+ };
62
+ } | undefined;
63
+ readonly encoding?: {
64
+ readonly [x: string]: {
65
+ readonly [x: string]: unknown;
66
+ readonly contentType?: string | undefined;
67
+ readonly headers?: {
68
+ readonly [x: string]: import("./header.ts").OpenApiHeader | {
69
+ readonly [x: string]: unknown;
70
+ readonly $ref: string;
71
+ readonly summary?: string | undefined;
72
+ readonly description?: string | undefined;
73
+ };
74
+ } | undefined;
75
+ readonly style?: "deepObject" | "form" | "pipeDelimited" | "spaceDelimited" | undefined;
76
+ readonly explode?: boolean | undefined;
77
+ readonly allowReserved?: boolean | undefined;
78
+ };
79
+ } | undefined;
80
+ };
81
+ } | undefined;
82
+ readonly example?: unknown;
83
+ readonly examples?: {
84
+ readonly [x: string]: {
85
+ readonly [x: string]: unknown;
86
+ readonly summary?: string | undefined;
87
+ readonly description?: string | undefined;
88
+ readonly value?: unknown;
89
+ readonly externalValue?: string | undefined;
90
+ } | {
91
+ readonly [x: string]: unknown;
92
+ readonly $ref: string;
93
+ readonly summary?: string | undefined;
94
+ readonly description?: string | undefined;
95
+ };
96
+ } | undefined;
97
+ readonly name: string;
98
+ readonly in: "cookie" | "header" | "path" | "query";
99
+ readonly style?: "deepObject" | "form" | "label" | "matrix" | "pipeDelimited" | "simple" | "spaceDelimited" | undefined;
100
+ readonly allowEmptyValue?: boolean | undefined;
101
+ readonly allowReserved?: boolean | undefined;
102
+ })[] | undefined;
103
+ }, {
104
+ readonly [x: string]: unknown;
105
+ readonly $ref?: string | undefined;
106
+ readonly summary?: string | undefined;
107
+ readonly description?: string | undefined;
108
+ readonly get?: import("./operation.ts").OpenApiOperation | undefined;
109
+ readonly put?: import("./operation.ts").OpenApiOperation | undefined;
110
+ readonly post?: import("./operation.ts").OpenApiOperation | undefined;
111
+ readonly delete?: import("./operation.ts").OpenApiOperation | undefined;
112
+ readonly options?: import("./operation.ts").OpenApiOperation | undefined;
113
+ readonly head?: import("./operation.ts").OpenApiOperation | undefined;
114
+ readonly patch?: import("./operation.ts").OpenApiOperation | undefined;
115
+ readonly trace?: import("./operation.ts").OpenApiOperation | undefined;
116
+ readonly servers?: readonly {
117
+ readonly [x: string]: unknown;
118
+ readonly url: string;
119
+ readonly description?: string | undefined;
120
+ readonly variables?: {
121
+ readonly [x: string]: {
122
+ readonly [x: string]: unknown;
123
+ readonly default: string;
124
+ readonly enum?: readonly [string, ...string[]] | undefined;
125
+ readonly description?: string | undefined;
126
+ };
127
+ } | undefined;
128
+ }[] | undefined;
129
+ readonly parameters?: readonly ({
130
+ readonly [x: string]: unknown;
131
+ readonly $ref: string;
132
+ readonly summary?: string | undefined;
133
+ readonly description?: string | undefined;
134
+ } | {
135
+ readonly [x: string]: unknown;
136
+ readonly description?: string | undefined;
137
+ readonly required?: boolean | undefined;
138
+ readonly deprecated?: boolean | undefined;
139
+ readonly explode?: boolean | undefined;
140
+ readonly schema?: boolean | {
141
+ readonly [x: string]: unknown;
142
+ } | undefined;
143
+ readonly content?: {
144
+ readonly [x: string]: {
145
+ readonly [x: string]: unknown;
146
+ readonly schema?: boolean | {
147
+ readonly [x: string]: unknown;
148
+ } | undefined;
149
+ readonly example?: unknown;
150
+ readonly examples?: {
151
+ readonly [x: string]: {
152
+ readonly [x: string]: unknown;
153
+ readonly summary?: string | undefined;
154
+ readonly description?: string | undefined;
155
+ readonly value?: unknown;
156
+ readonly externalValue?: string | undefined;
157
+ } | {
158
+ readonly [x: string]: unknown;
159
+ readonly $ref: string;
160
+ readonly summary?: string | undefined;
161
+ readonly description?: string | undefined;
162
+ };
163
+ } | undefined;
164
+ readonly encoding?: {
165
+ readonly [x: string]: {
166
+ readonly [x: string]: unknown;
167
+ readonly contentType?: string | undefined;
168
+ readonly headers?: {
169
+ readonly [x: string]: import("./header.ts").OpenApiHeader | {
170
+ readonly [x: string]: unknown;
171
+ readonly $ref: string;
172
+ readonly summary?: string | undefined;
173
+ readonly description?: string | undefined;
174
+ };
175
+ } | undefined;
176
+ readonly style?: "deepObject" | "form" | "pipeDelimited" | "spaceDelimited" | undefined;
177
+ readonly explode?: boolean | undefined;
178
+ readonly allowReserved?: boolean | undefined;
179
+ };
180
+ } | undefined;
181
+ };
182
+ } | undefined;
183
+ readonly example?: unknown;
184
+ readonly examples?: {
185
+ readonly [x: string]: {
186
+ readonly [x: string]: unknown;
187
+ readonly summary?: string | undefined;
188
+ readonly description?: string | undefined;
189
+ readonly value?: unknown;
190
+ readonly externalValue?: string | undefined;
191
+ } | {
192
+ readonly [x: string]: unknown;
193
+ readonly $ref: string;
194
+ readonly summary?: string | undefined;
195
+ readonly description?: string | undefined;
196
+ };
197
+ } | undefined;
198
+ readonly name: string;
199
+ readonly in: "cookie" | "header" | "path" | "query";
200
+ readonly style?: "deepObject" | "form" | "label" | "matrix" | "pipeDelimited" | "simple" | "spaceDelimited" | undefined;
201
+ readonly allowEmptyValue?: boolean | undefined;
202
+ readonly allowReserved?: boolean | undefined;
203
+ })[] | undefined;
204
+ }, never, never>>>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>;
205
+ export type OpenApiCallback = typeof OpenApiCallback.Type;
@@ -0,0 +1,4 @@
1
+ import { Schema } from "effect";
2
+ import { openApiMap } from "./object.js";
3
+ import { OpenApiPathItem } from "./path-item.js";
4
+ export const OpenApiCallback = openApiMap(Schema.String.check(Schema.makeFilter((key) => !key.startsWith("x-"))), Schema.suspend(() => OpenApiPathItem));