@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.
- package/LICENSE +21 -0
- package/README.md +361 -2
- package/dist/bundle.d.ts +973 -0
- package/dist/bundle.js +11 -0
- package/dist/codec.d.ts +2188 -0
- package/dist/codec.js +42 -0
- package/dist/document.d.ts +9 -0
- package/dist/document.js +28 -0
- package/dist/errors.d.ts +105 -0
- package/dist/errors.js +162 -0
- package/dist/hoist.d.ts +10 -0
- package/dist/hoist.js +444 -0
- package/dist/http.d.ts +2 -0
- package/dist/http.js +163 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2 -0
- package/dist/load.d.ts +17 -0
- package/dist/load.js +128 -0
- package/dist/loader.d.ts +11 -0
- package/dist/loader.js +89 -0
- package/dist/parsers.d.ts +5 -0
- package/dist/parsers.js +90 -0
- package/dist/pipeline.d.ts +3 -0
- package/dist/pipeline.js +446 -0
- package/dist/plugins.d.ts +95 -0
- package/dist/plugins.js +61 -0
- package/dist/pointer.d.ts +7 -0
- package/dist/pointer.js +80 -0
- package/dist/run.d.ts +17 -0
- package/dist/run.js +313 -0
- package/dist/schemas/3.1/callback.d.ts +205 -0
- package/dist/schemas/3.1/callback.js +4 -0
- package/dist/schemas/3.1/components.d.ts +801 -0
- package/dist/schemas/3.1/components.js +25 -0
- package/dist/schemas/3.1/contact.d.ts +7 -0
- package/dist/schemas/3.1/contact.js +7 -0
- package/dist/schemas/3.1/document.d.ts +1093 -0
- package/dist/schemas/3.1/document.js +25 -0
- package/dist/schemas/3.1/encoding.d.ts +14 -0
- package/dist/schemas/3.1/encoding.js +11 -0
- package/dist/schemas/3.1/example.d.ts +8 -0
- package/dist/schemas/3.1/example.js +10 -0
- package/dist/schemas/3.1/external-docs.d.ts +6 -0
- package/dist/schemas/3.1/external-docs.js +6 -0
- package/dist/schemas/3.1/header.d.ts +194 -0
- package/dist/schemas/3.1/header.js +29 -0
- package/dist/schemas/3.1/http-method.d.ts +4 -0
- package/dist/schemas/3.1/http-method.js +12 -0
- package/dist/schemas/3.1/index.d.ts +29 -0
- package/dist/schemas/3.1/index.js +29 -0
- package/dist/schemas/3.1/info.d.ts +19 -0
- package/dist/schemas/3.1/info.js +13 -0
- package/dist/schemas/3.1/license.d.ts +7 -0
- package/dist/schemas/3.1/license.js +9 -0
- package/dist/schemas/3.1/link.d.ts +18 -0
- package/dist/schemas/3.1/link.js +13 -0
- package/dist/schemas/3.1/media-type.d.ts +27 -0
- package/dist/schemas/3.1/media-type.js +14 -0
- package/dist/schemas/3.1/oauth-flow.d.ts +8 -0
- package/dist/schemas/3.1/oauth-flow.js +8 -0
- package/dist/schemas/3.1/oauth-flows.d.ts +28 -0
- package/dist/schemas/3.1/oauth-flows.js +13 -0
- package/dist/schemas/3.1/object.d.ts +5 -0
- package/dist/schemas/3.1/object.js +17 -0
- package/dist/schemas/3.1/operation.d.ts +1040 -0
- package/dist/schemas/3.1/operation.js +25 -0
- package/dist/schemas/3.1/parameter.d.ts +101 -0
- package/dist/schemas/3.1/parameter.js +33 -0
- package/dist/schemas/3.1/path-item.d.ts +127 -0
- package/dist/schemas/3.1/path-item.js +22 -0
- package/dist/schemas/3.1/paths.d.ts +126 -0
- package/dist/schemas/3.1/paths.js +4 -0
- package/dist/schemas/3.1/reference.d.ts +13 -0
- package/dist/schemas/3.1/reference.js +11 -0
- package/dist/schemas/3.1/request-body.d.ts +31 -0
- package/dist/schemas/3.1/request-body.js +8 -0
- package/dist/schemas/3.1/response.d.ts +149 -0
- package/dist/schemas/3.1/response.js +12 -0
- package/dist/schemas/3.1/responses.d.ts +152 -0
- package/dist/schemas/3.1/responses.js +7 -0
- package/dist/schemas/3.1/schema.d.ts +4 -0
- package/dist/schemas/3.1/schema.js +6 -0
- package/dist/schemas/3.1/security-requirement.d.ts +3 -0
- package/dist/schemas/3.1/security-requirement.js +2 -0
- package/dist/schemas/3.1/security-scheme.d.ts +49 -0
- package/dist/schemas/3.1/security-scheme.js +25 -0
- package/dist/schemas/3.1/server-variable.d.ts +7 -0
- package/dist/schemas/3.1/server-variable.js +7 -0
- package/dist/schemas/3.1/server.d.ts +11 -0
- package/dist/schemas/3.1/server.js +8 -0
- package/dist/schemas/3.1/tag.d.ts +10 -0
- package/dist/schemas/3.1/tag.js +8 -0
- package/dist/upgraders/3.0-to-3.1.d.ts +9 -0
- package/dist/upgraders/3.0-to-3.1.js +310 -0
- package/dist/url.d.ts +29 -0
- package/dist/url.js +255 -0
- package/dist/yaml.d.ts +6 -0
- package/dist/yaml.js +235 -0
- package/package.json +50 -4
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { OpenApiCallback } from "./callback.js";
|
|
3
|
+
import { OpenApiExternalDocs } from "./external-docs.js";
|
|
4
|
+
import { openApiObject } from "./object.js";
|
|
5
|
+
import { OpenApiParameter } from "./parameter.js";
|
|
6
|
+
import { withReference } from "./reference.js";
|
|
7
|
+
import { OpenApiRequestBody } from "./request-body.js";
|
|
8
|
+
import { OpenApiResponses } from "./responses.js";
|
|
9
|
+
import { OpenApiSecurityRequirement } from "./security-requirement.js";
|
|
10
|
+
import { OpenApiServer } from "./server.js";
|
|
11
|
+
const fields = {
|
|
12
|
+
tags: Schema.optionalKey(Schema.Array(Schema.String)),
|
|
13
|
+
summary: Schema.optionalKey(Schema.String),
|
|
14
|
+
description: Schema.optionalKey(Schema.String),
|
|
15
|
+
externalDocs: Schema.optionalKey(OpenApiExternalDocs),
|
|
16
|
+
operationId: Schema.optionalKey(Schema.String),
|
|
17
|
+
parameters: Schema.optionalKey(Schema.Array(withReference(OpenApiParameter))),
|
|
18
|
+
requestBody: Schema.optionalKey(withReference(OpenApiRequestBody)),
|
|
19
|
+
responses: Schema.optionalKey(OpenApiResponses),
|
|
20
|
+
callbacks: Schema.optionalKey(Schema.Record(Schema.String, withReference(Schema.suspend(() => OpenApiCallback)))),
|
|
21
|
+
deprecated: Schema.optionalKey(Schema.Boolean),
|
|
22
|
+
security: Schema.optionalKey(Schema.Array(OpenApiSecurityRequirement)),
|
|
23
|
+
servers: Schema.optionalKey(Schema.Array(OpenApiServer)),
|
|
24
|
+
};
|
|
25
|
+
export const OpenApiOperation = openApiObject(fields);
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { OpenApiHeader } from "./header.ts";
|
|
3
|
+
export declare const OpenApiParameter: Schema.StructWithRest<Schema.Struct<{
|
|
4
|
+
readonly description: Schema.optionalKey<Schema.String>;
|
|
5
|
+
readonly required: Schema.optionalKey<Schema.Boolean>;
|
|
6
|
+
readonly deprecated: Schema.optionalKey<Schema.Boolean>;
|
|
7
|
+
readonly explode: Schema.optionalKey<Schema.Boolean>;
|
|
8
|
+
readonly schema: Schema.optionalKey<Schema.Union<readonly [Schema.$Record<Schema.String, Schema.Unknown>, Schema.Boolean]>>;
|
|
9
|
+
readonly content: Schema.optionalKey<Schema.$Record<Schema.String, Schema.suspend<Schema.Codec<{
|
|
10
|
+
readonly [x: string]: unknown;
|
|
11
|
+
readonly schema?: boolean | {
|
|
12
|
+
readonly [x: string]: unknown;
|
|
13
|
+
} | undefined;
|
|
14
|
+
readonly example?: unknown;
|
|
15
|
+
readonly examples?: {
|
|
16
|
+
readonly [x: string]: {
|
|
17
|
+
readonly [x: string]: unknown;
|
|
18
|
+
readonly $ref: string;
|
|
19
|
+
readonly summary?: string | undefined;
|
|
20
|
+
readonly description?: string | undefined;
|
|
21
|
+
} | {
|
|
22
|
+
readonly [x: string]: unknown;
|
|
23
|
+
readonly summary?: string | undefined;
|
|
24
|
+
readonly description?: string | undefined;
|
|
25
|
+
readonly value?: unknown;
|
|
26
|
+
readonly externalValue?: string | undefined;
|
|
27
|
+
};
|
|
28
|
+
} | undefined;
|
|
29
|
+
readonly encoding?: {
|
|
30
|
+
readonly [x: string]: {
|
|
31
|
+
readonly [x: string]: unknown;
|
|
32
|
+
readonly contentType?: string | undefined;
|
|
33
|
+
readonly headers?: {
|
|
34
|
+
readonly [x: string]: OpenApiHeader | {
|
|
35
|
+
readonly [x: string]: unknown;
|
|
36
|
+
readonly $ref: string;
|
|
37
|
+
readonly summary?: string | undefined;
|
|
38
|
+
readonly description?: string | undefined;
|
|
39
|
+
};
|
|
40
|
+
} | undefined;
|
|
41
|
+
readonly style?: "deepObject" | "form" | "pipeDelimited" | "spaceDelimited" | undefined;
|
|
42
|
+
readonly explode?: boolean | undefined;
|
|
43
|
+
readonly allowReserved?: boolean | undefined;
|
|
44
|
+
};
|
|
45
|
+
} | undefined;
|
|
46
|
+
}, {
|
|
47
|
+
readonly [x: string]: unknown;
|
|
48
|
+
readonly schema?: boolean | {
|
|
49
|
+
readonly [x: string]: unknown;
|
|
50
|
+
} | undefined;
|
|
51
|
+
readonly example?: unknown;
|
|
52
|
+
readonly examples?: {
|
|
53
|
+
readonly [x: string]: {
|
|
54
|
+
readonly [x: string]: unknown;
|
|
55
|
+
readonly $ref: string;
|
|
56
|
+
readonly summary?: string | undefined;
|
|
57
|
+
readonly description?: string | undefined;
|
|
58
|
+
} | {
|
|
59
|
+
readonly [x: string]: unknown;
|
|
60
|
+
readonly summary?: string | undefined;
|
|
61
|
+
readonly description?: string | undefined;
|
|
62
|
+
readonly value?: unknown;
|
|
63
|
+
readonly externalValue?: string | undefined;
|
|
64
|
+
};
|
|
65
|
+
} | undefined;
|
|
66
|
+
readonly encoding?: {
|
|
67
|
+
readonly [x: string]: {
|
|
68
|
+
readonly [x: string]: unknown;
|
|
69
|
+
readonly contentType?: string | undefined;
|
|
70
|
+
readonly headers?: {
|
|
71
|
+
readonly [x: string]: OpenApiHeader | {
|
|
72
|
+
readonly [x: string]: unknown;
|
|
73
|
+
readonly $ref: string;
|
|
74
|
+
readonly summary?: string | undefined;
|
|
75
|
+
readonly description?: string | undefined;
|
|
76
|
+
};
|
|
77
|
+
} | undefined;
|
|
78
|
+
readonly style?: "deepObject" | "form" | "pipeDelimited" | "spaceDelimited" | undefined;
|
|
79
|
+
readonly explode?: boolean | undefined;
|
|
80
|
+
readonly allowReserved?: boolean | undefined;
|
|
81
|
+
};
|
|
82
|
+
} | undefined;
|
|
83
|
+
}, never, never>>>>;
|
|
84
|
+
readonly example: Schema.optionalKey<Schema.Unknown>;
|
|
85
|
+
readonly examples: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
|
|
86
|
+
readonly $ref: Schema.String;
|
|
87
|
+
readonly summary: Schema.optionalKey<Schema.String>;
|
|
88
|
+
readonly description: Schema.optionalKey<Schema.String>;
|
|
89
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{
|
|
90
|
+
readonly summary: Schema.optionalKey<Schema.String>;
|
|
91
|
+
readonly description: Schema.optionalKey<Schema.String>;
|
|
92
|
+
readonly value: Schema.optionalKey<Schema.Unknown>;
|
|
93
|
+
readonly externalValue: Schema.optionalKey<Schema.String>;
|
|
94
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>]>>>;
|
|
95
|
+
readonly name: Schema.String;
|
|
96
|
+
readonly in: Schema.Literals<readonly ["query", "header", "path", "cookie"]>;
|
|
97
|
+
readonly style: Schema.optionalKey<Schema.Literals<readonly ["matrix", "label", "form", "simple", "spaceDelimited", "pipeDelimited", "deepObject"]>>;
|
|
98
|
+
readonly allowEmptyValue: Schema.optionalKey<Schema.Boolean>;
|
|
99
|
+
readonly allowReserved: Schema.optionalKey<Schema.Boolean>;
|
|
100
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>;
|
|
101
|
+
export type OpenApiParameter = typeof OpenApiParameter.Type;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { OpenApiHeader } from "./header.js";
|
|
3
|
+
import { openApiObject } from "./object.js";
|
|
4
|
+
export const OpenApiParameter = openApiObject({
|
|
5
|
+
...OpenApiHeader.schema.fields,
|
|
6
|
+
name: Schema.String,
|
|
7
|
+
in: Schema.Literals(["query", "header", "path", "cookie"]),
|
|
8
|
+
style: Schema.optionalKey(Schema.Literals([
|
|
9
|
+
"matrix",
|
|
10
|
+
"label",
|
|
11
|
+
"form",
|
|
12
|
+
"simple",
|
|
13
|
+
"spaceDelimited",
|
|
14
|
+
"pipeDelimited",
|
|
15
|
+
"deepObject",
|
|
16
|
+
])),
|
|
17
|
+
allowEmptyValue: Schema.optionalKey(Schema.Boolean),
|
|
18
|
+
allowReserved: Schema.optionalKey(Schema.Boolean),
|
|
19
|
+
}).check(Schema.makeFilter((value) => {
|
|
20
|
+
if (value.in === "path" && value.required !== true) {
|
|
21
|
+
return "Path parameters must set required to true";
|
|
22
|
+
}
|
|
23
|
+
if ((value.schema === undefined) === (value.content === undefined)) {
|
|
24
|
+
return "A parameter must have exactly one of schema or content";
|
|
25
|
+
}
|
|
26
|
+
if (value.content !== undefined && Object.keys(value.content).length !== 1) {
|
|
27
|
+
return "Parameter content must contain exactly one media type";
|
|
28
|
+
}
|
|
29
|
+
if (Object.hasOwn(value, "example") && value.examples !== undefined) {
|
|
30
|
+
return "Parameter example and examples are mutually exclusive";
|
|
31
|
+
}
|
|
32
|
+
return undefined;
|
|
33
|
+
}));
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { OpenApiOperation } from "./operation.ts";
|
|
3
|
+
export declare const OpenApiPathItem: Schema.StructWithRest<Schema.Struct<{
|
|
4
|
+
readonly $ref: Schema.optionalKey<Schema.String>;
|
|
5
|
+
readonly summary: Schema.optionalKey<Schema.String>;
|
|
6
|
+
readonly description: Schema.optionalKey<Schema.String>;
|
|
7
|
+
readonly get: Schema.optionalKey<Schema.suspend<Schema.Codec<OpenApiOperation, OpenApiOperation, never, never>>>;
|
|
8
|
+
readonly put: Schema.optionalKey<Schema.suspend<Schema.Codec<OpenApiOperation, OpenApiOperation, never, never>>>;
|
|
9
|
+
readonly post: Schema.optionalKey<Schema.suspend<Schema.Codec<OpenApiOperation, OpenApiOperation, never, never>>>;
|
|
10
|
+
readonly delete: Schema.optionalKey<Schema.suspend<Schema.Codec<OpenApiOperation, OpenApiOperation, never, never>>>;
|
|
11
|
+
readonly options: Schema.optionalKey<Schema.suspend<Schema.Codec<OpenApiOperation, OpenApiOperation, never, never>>>;
|
|
12
|
+
readonly head: Schema.optionalKey<Schema.suspend<Schema.Codec<OpenApiOperation, OpenApiOperation, never, never>>>;
|
|
13
|
+
readonly patch: Schema.optionalKey<Schema.suspend<Schema.Codec<OpenApiOperation, OpenApiOperation, never, never>>>;
|
|
14
|
+
readonly trace: Schema.optionalKey<Schema.suspend<Schema.Codec<OpenApiOperation, OpenApiOperation, never, never>>>;
|
|
15
|
+
readonly servers: Schema.optionalKey<Schema.$Array<Schema.StructWithRest<Schema.Struct<{
|
|
16
|
+
readonly url: Schema.String;
|
|
17
|
+
readonly description: Schema.optionalKey<Schema.String>;
|
|
18
|
+
readonly variables: Schema.optionalKey<Schema.$Record<Schema.String, Schema.StructWithRest<Schema.Struct<{
|
|
19
|
+
readonly default: Schema.String;
|
|
20
|
+
readonly enum: Schema.optionalKey<Schema.NonEmptyArray<Schema.String>>;
|
|
21
|
+
readonly description: Schema.optionalKey<Schema.String>;
|
|
22
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>>;
|
|
23
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>>;
|
|
24
|
+
readonly parameters: Schema.optionalKey<Schema.$Array<Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
|
|
25
|
+
readonly $ref: Schema.String;
|
|
26
|
+
readonly summary: Schema.optionalKey<Schema.String>;
|
|
27
|
+
readonly description: Schema.optionalKey<Schema.String>;
|
|
28
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{
|
|
29
|
+
readonly description: Schema.optionalKey<Schema.String>;
|
|
30
|
+
readonly required: Schema.optionalKey<Schema.Boolean>;
|
|
31
|
+
readonly deprecated: Schema.optionalKey<Schema.Boolean>;
|
|
32
|
+
readonly explode: Schema.optionalKey<Schema.Boolean>;
|
|
33
|
+
readonly schema: Schema.optionalKey<Schema.Union<readonly [Schema.$Record<Schema.String, Schema.Unknown>, Schema.Boolean]>>;
|
|
34
|
+
readonly content: Schema.optionalKey<Schema.$Record<Schema.String, Schema.suspend<Schema.Codec<{
|
|
35
|
+
readonly [x: string]: unknown;
|
|
36
|
+
readonly schema?: boolean | {
|
|
37
|
+
readonly [x: string]: unknown;
|
|
38
|
+
} | undefined;
|
|
39
|
+
readonly example?: unknown;
|
|
40
|
+
readonly examples?: {
|
|
41
|
+
readonly [x: string]: {
|
|
42
|
+
readonly [x: string]: unknown;
|
|
43
|
+
readonly $ref: string;
|
|
44
|
+
readonly summary?: string | undefined;
|
|
45
|
+
readonly description?: string | undefined;
|
|
46
|
+
} | {
|
|
47
|
+
readonly [x: string]: unknown;
|
|
48
|
+
readonly summary?: string | undefined;
|
|
49
|
+
readonly description?: string | undefined;
|
|
50
|
+
readonly value?: unknown;
|
|
51
|
+
readonly externalValue?: string | undefined;
|
|
52
|
+
};
|
|
53
|
+
} | undefined;
|
|
54
|
+
readonly encoding?: {
|
|
55
|
+
readonly [x: string]: {
|
|
56
|
+
readonly [x: string]: unknown;
|
|
57
|
+
readonly contentType?: string | undefined;
|
|
58
|
+
readonly headers?: {
|
|
59
|
+
readonly [x: string]: import("./header.ts").OpenApiHeader | {
|
|
60
|
+
readonly [x: string]: unknown;
|
|
61
|
+
readonly $ref: string;
|
|
62
|
+
readonly summary?: string | undefined;
|
|
63
|
+
readonly description?: string | undefined;
|
|
64
|
+
};
|
|
65
|
+
} | undefined;
|
|
66
|
+
readonly style?: "deepObject" | "form" | "pipeDelimited" | "spaceDelimited" | undefined;
|
|
67
|
+
readonly explode?: boolean | undefined;
|
|
68
|
+
readonly allowReserved?: boolean | undefined;
|
|
69
|
+
};
|
|
70
|
+
} | undefined;
|
|
71
|
+
}, {
|
|
72
|
+
readonly [x: string]: unknown;
|
|
73
|
+
readonly schema?: boolean | {
|
|
74
|
+
readonly [x: string]: unknown;
|
|
75
|
+
} | undefined;
|
|
76
|
+
readonly example?: unknown;
|
|
77
|
+
readonly examples?: {
|
|
78
|
+
readonly [x: string]: {
|
|
79
|
+
readonly [x: string]: unknown;
|
|
80
|
+
readonly $ref: string;
|
|
81
|
+
readonly summary?: string | undefined;
|
|
82
|
+
readonly description?: string | undefined;
|
|
83
|
+
} | {
|
|
84
|
+
readonly [x: string]: unknown;
|
|
85
|
+
readonly summary?: string | undefined;
|
|
86
|
+
readonly description?: string | undefined;
|
|
87
|
+
readonly value?: unknown;
|
|
88
|
+
readonly externalValue?: string | undefined;
|
|
89
|
+
};
|
|
90
|
+
} | undefined;
|
|
91
|
+
readonly encoding?: {
|
|
92
|
+
readonly [x: string]: {
|
|
93
|
+
readonly [x: string]: unknown;
|
|
94
|
+
readonly contentType?: string | undefined;
|
|
95
|
+
readonly headers?: {
|
|
96
|
+
readonly [x: string]: import("./header.ts").OpenApiHeader | {
|
|
97
|
+
readonly [x: string]: unknown;
|
|
98
|
+
readonly $ref: string;
|
|
99
|
+
readonly summary?: string | undefined;
|
|
100
|
+
readonly description?: string | undefined;
|
|
101
|
+
};
|
|
102
|
+
} | undefined;
|
|
103
|
+
readonly style?: "deepObject" | "form" | "pipeDelimited" | "spaceDelimited" | undefined;
|
|
104
|
+
readonly explode?: boolean | undefined;
|
|
105
|
+
readonly allowReserved?: boolean | undefined;
|
|
106
|
+
};
|
|
107
|
+
} | undefined;
|
|
108
|
+
}, never, never>>>>;
|
|
109
|
+
readonly example: Schema.optionalKey<Schema.Unknown>;
|
|
110
|
+
readonly examples: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
|
|
111
|
+
readonly $ref: Schema.String;
|
|
112
|
+
readonly summary: Schema.optionalKey<Schema.String>;
|
|
113
|
+
readonly description: Schema.optionalKey<Schema.String>;
|
|
114
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{
|
|
115
|
+
readonly summary: Schema.optionalKey<Schema.String>;
|
|
116
|
+
readonly description: Schema.optionalKey<Schema.String>;
|
|
117
|
+
readonly value: Schema.optionalKey<Schema.Unknown>;
|
|
118
|
+
readonly externalValue: Schema.optionalKey<Schema.String>;
|
|
119
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>]>>>;
|
|
120
|
+
readonly name: Schema.String;
|
|
121
|
+
readonly in: Schema.Literals<readonly ["query", "header", "path", "cookie"]>;
|
|
122
|
+
readonly style: Schema.optionalKey<Schema.Literals<readonly ["matrix", "label", "form", "simple", "spaceDelimited", "pipeDelimited", "deepObject"]>>;
|
|
123
|
+
readonly allowEmptyValue: Schema.optionalKey<Schema.Boolean>;
|
|
124
|
+
readonly allowReserved: Schema.optionalKey<Schema.Boolean>;
|
|
125
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>]>>>;
|
|
126
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>;
|
|
127
|
+
export type OpenApiPathItem = typeof OpenApiPathItem.Type;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { openApiObject } from "./object.js";
|
|
3
|
+
import { OpenApiOperation } from "./operation.js";
|
|
4
|
+
import { OpenApiParameter } from "./parameter.js";
|
|
5
|
+
import { withReference } from "./reference.js";
|
|
6
|
+
import { OpenApiServer } from "./server.js";
|
|
7
|
+
const operation = Schema.optionalKey(Schema.suspend(() => OpenApiOperation));
|
|
8
|
+
export const OpenApiPathItem = openApiObject({
|
|
9
|
+
$ref: Schema.optionalKey(Schema.String),
|
|
10
|
+
summary: Schema.optionalKey(Schema.String),
|
|
11
|
+
description: Schema.optionalKey(Schema.String),
|
|
12
|
+
get: operation,
|
|
13
|
+
put: operation,
|
|
14
|
+
post: operation,
|
|
15
|
+
delete: operation,
|
|
16
|
+
options: operation,
|
|
17
|
+
head: operation,
|
|
18
|
+
patch: operation,
|
|
19
|
+
trace: operation,
|
|
20
|
+
servers: Schema.optionalKey(Schema.Array(OpenApiServer)),
|
|
21
|
+
parameters: Schema.optionalKey(Schema.Array(withReference(OpenApiParameter))),
|
|
22
|
+
});
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
export declare const OpenApiPaths: Schema.StructWithRest<Schema.$Record<Schema.String, Schema.StructWithRest<Schema.Struct<{
|
|
3
|
+
readonly $ref: Schema.optionalKey<Schema.String>;
|
|
4
|
+
readonly summary: Schema.optionalKey<Schema.String>;
|
|
5
|
+
readonly description: Schema.optionalKey<Schema.String>;
|
|
6
|
+
readonly get: Schema.optionalKey<Schema.suspend<Schema.Codec<import("./operation.ts").OpenApiOperation, import("./operation.ts").OpenApiOperation, never, never>>>;
|
|
7
|
+
readonly put: Schema.optionalKey<Schema.suspend<Schema.Codec<import("./operation.ts").OpenApiOperation, import("./operation.ts").OpenApiOperation, never, never>>>;
|
|
8
|
+
readonly post: Schema.optionalKey<Schema.suspend<Schema.Codec<import("./operation.ts").OpenApiOperation, import("./operation.ts").OpenApiOperation, never, never>>>;
|
|
9
|
+
readonly delete: Schema.optionalKey<Schema.suspend<Schema.Codec<import("./operation.ts").OpenApiOperation, import("./operation.ts").OpenApiOperation, never, never>>>;
|
|
10
|
+
readonly options: Schema.optionalKey<Schema.suspend<Schema.Codec<import("./operation.ts").OpenApiOperation, import("./operation.ts").OpenApiOperation, never, never>>>;
|
|
11
|
+
readonly head: Schema.optionalKey<Schema.suspend<Schema.Codec<import("./operation.ts").OpenApiOperation, import("./operation.ts").OpenApiOperation, never, never>>>;
|
|
12
|
+
readonly patch: Schema.optionalKey<Schema.suspend<Schema.Codec<import("./operation.ts").OpenApiOperation, import("./operation.ts").OpenApiOperation, never, never>>>;
|
|
13
|
+
readonly trace: Schema.optionalKey<Schema.suspend<Schema.Codec<import("./operation.ts").OpenApiOperation, import("./operation.ts").OpenApiOperation, never, never>>>;
|
|
14
|
+
readonly servers: Schema.optionalKey<Schema.$Array<Schema.StructWithRest<Schema.Struct<{
|
|
15
|
+
readonly url: Schema.String;
|
|
16
|
+
readonly description: Schema.optionalKey<Schema.String>;
|
|
17
|
+
readonly variables: Schema.optionalKey<Schema.$Record<Schema.String, Schema.StructWithRest<Schema.Struct<{
|
|
18
|
+
readonly default: Schema.String;
|
|
19
|
+
readonly enum: Schema.optionalKey<Schema.NonEmptyArray<Schema.String>>;
|
|
20
|
+
readonly description: Schema.optionalKey<Schema.String>;
|
|
21
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>>;
|
|
22
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>>;
|
|
23
|
+
readonly parameters: Schema.optionalKey<Schema.$Array<Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
|
|
24
|
+
readonly $ref: Schema.String;
|
|
25
|
+
readonly summary: Schema.optionalKey<Schema.String>;
|
|
26
|
+
readonly description: Schema.optionalKey<Schema.String>;
|
|
27
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{
|
|
28
|
+
readonly description: Schema.optionalKey<Schema.String>;
|
|
29
|
+
readonly required: Schema.optionalKey<Schema.Boolean>;
|
|
30
|
+
readonly deprecated: Schema.optionalKey<Schema.Boolean>;
|
|
31
|
+
readonly explode: Schema.optionalKey<Schema.Boolean>;
|
|
32
|
+
readonly schema: Schema.optionalKey<Schema.Union<readonly [Schema.$Record<Schema.String, Schema.Unknown>, Schema.Boolean]>>;
|
|
33
|
+
readonly content: Schema.optionalKey<Schema.$Record<Schema.String, Schema.suspend<Schema.Codec<{
|
|
34
|
+
readonly [x: string]: unknown;
|
|
35
|
+
readonly schema?: boolean | {
|
|
36
|
+
readonly [x: string]: unknown;
|
|
37
|
+
} | undefined;
|
|
38
|
+
readonly example?: unknown;
|
|
39
|
+
readonly examples?: {
|
|
40
|
+
readonly [x: string]: {
|
|
41
|
+
readonly [x: string]: unknown;
|
|
42
|
+
readonly summary?: string | undefined;
|
|
43
|
+
readonly description?: string | undefined;
|
|
44
|
+
readonly value?: unknown;
|
|
45
|
+
readonly externalValue?: string | undefined;
|
|
46
|
+
} | {
|
|
47
|
+
readonly [x: string]: unknown;
|
|
48
|
+
readonly $ref: string;
|
|
49
|
+
readonly summary?: string | undefined;
|
|
50
|
+
readonly description?: string | undefined;
|
|
51
|
+
};
|
|
52
|
+
} | undefined;
|
|
53
|
+
readonly encoding?: {
|
|
54
|
+
readonly [x: string]: {
|
|
55
|
+
readonly [x: string]: unknown;
|
|
56
|
+
readonly contentType?: string | undefined;
|
|
57
|
+
readonly headers?: {
|
|
58
|
+
readonly [x: string]: import("./header.ts").OpenApiHeader | {
|
|
59
|
+
readonly [x: string]: unknown;
|
|
60
|
+
readonly $ref: string;
|
|
61
|
+
readonly summary?: string | undefined;
|
|
62
|
+
readonly description?: string | undefined;
|
|
63
|
+
};
|
|
64
|
+
} | undefined;
|
|
65
|
+
readonly style?: "deepObject" | "form" | "pipeDelimited" | "spaceDelimited" | undefined;
|
|
66
|
+
readonly explode?: boolean | undefined;
|
|
67
|
+
readonly allowReserved?: boolean | undefined;
|
|
68
|
+
};
|
|
69
|
+
} | undefined;
|
|
70
|
+
}, {
|
|
71
|
+
readonly [x: string]: unknown;
|
|
72
|
+
readonly schema?: boolean | {
|
|
73
|
+
readonly [x: string]: unknown;
|
|
74
|
+
} | undefined;
|
|
75
|
+
readonly example?: unknown;
|
|
76
|
+
readonly examples?: {
|
|
77
|
+
readonly [x: string]: {
|
|
78
|
+
readonly [x: string]: unknown;
|
|
79
|
+
readonly summary?: string | undefined;
|
|
80
|
+
readonly description?: string | undefined;
|
|
81
|
+
readonly value?: unknown;
|
|
82
|
+
readonly externalValue?: string | undefined;
|
|
83
|
+
} | {
|
|
84
|
+
readonly [x: string]: unknown;
|
|
85
|
+
readonly $ref: string;
|
|
86
|
+
readonly summary?: string | undefined;
|
|
87
|
+
readonly description?: string | undefined;
|
|
88
|
+
};
|
|
89
|
+
} | undefined;
|
|
90
|
+
readonly encoding?: {
|
|
91
|
+
readonly [x: string]: {
|
|
92
|
+
readonly [x: string]: unknown;
|
|
93
|
+
readonly contentType?: string | undefined;
|
|
94
|
+
readonly headers?: {
|
|
95
|
+
readonly [x: string]: import("./header.ts").OpenApiHeader | {
|
|
96
|
+
readonly [x: string]: unknown;
|
|
97
|
+
readonly $ref: string;
|
|
98
|
+
readonly summary?: string | undefined;
|
|
99
|
+
readonly description?: string | undefined;
|
|
100
|
+
};
|
|
101
|
+
} | undefined;
|
|
102
|
+
readonly style?: "deepObject" | "form" | "pipeDelimited" | "spaceDelimited" | undefined;
|
|
103
|
+
readonly explode?: boolean | undefined;
|
|
104
|
+
readonly allowReserved?: boolean | undefined;
|
|
105
|
+
};
|
|
106
|
+
} | undefined;
|
|
107
|
+
}, never, never>>>>;
|
|
108
|
+
readonly example: Schema.optionalKey<Schema.Unknown>;
|
|
109
|
+
readonly examples: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
|
|
110
|
+
readonly $ref: Schema.String;
|
|
111
|
+
readonly summary: Schema.optionalKey<Schema.String>;
|
|
112
|
+
readonly description: Schema.optionalKey<Schema.String>;
|
|
113
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{
|
|
114
|
+
readonly summary: Schema.optionalKey<Schema.String>;
|
|
115
|
+
readonly description: Schema.optionalKey<Schema.String>;
|
|
116
|
+
readonly value: Schema.optionalKey<Schema.Unknown>;
|
|
117
|
+
readonly externalValue: Schema.optionalKey<Schema.String>;
|
|
118
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>]>>>;
|
|
119
|
+
readonly name: Schema.String;
|
|
120
|
+
readonly in: Schema.Literals<readonly ["query", "header", "path", "cookie"]>;
|
|
121
|
+
readonly style: Schema.optionalKey<Schema.Literals<readonly ["matrix", "label", "form", "simple", "spaceDelimited", "pipeDelimited", "deepObject"]>>;
|
|
122
|
+
readonly allowEmptyValue: Schema.optionalKey<Schema.Boolean>;
|
|
123
|
+
readonly allowReserved: Schema.optionalKey<Schema.Boolean>;
|
|
124
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>]>>>;
|
|
125
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>;
|
|
126
|
+
export type OpenApiPaths = typeof OpenApiPaths.Type;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
export declare const OpenApiReference: Schema.StructWithRest<Schema.Struct<{
|
|
3
|
+
readonly $ref: Schema.String;
|
|
4
|
+
readonly summary: Schema.optionalKey<Schema.String>;
|
|
5
|
+
readonly description: Schema.optionalKey<Schema.String>;
|
|
6
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>;
|
|
7
|
+
export type OpenApiReference = typeof OpenApiReference.Type;
|
|
8
|
+
/** Reference Objects are permitted only at the specification's reference positions. */
|
|
9
|
+
export declare function withReference<S extends Schema.Constraint>(schema: S): Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
|
|
10
|
+
readonly $ref: Schema.String;
|
|
11
|
+
readonly summary: Schema.optionalKey<Schema.String>;
|
|
12
|
+
readonly description: Schema.optionalKey<Schema.String>;
|
|
13
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, S]>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { openApiObject } from "./object.js";
|
|
3
|
+
export const OpenApiReference = openApiObject({
|
|
4
|
+
$ref: Schema.String,
|
|
5
|
+
summary: Schema.optionalKey(Schema.String),
|
|
6
|
+
description: Schema.optionalKey(Schema.String),
|
|
7
|
+
});
|
|
8
|
+
/** Reference Objects are permitted only at the specification's reference positions. */
|
|
9
|
+
export function withReference(schema) {
|
|
10
|
+
return Schema.Union([OpenApiReference, schema]);
|
|
11
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
export declare const OpenApiRequestBody: Schema.StructWithRest<Schema.Struct<{
|
|
3
|
+
readonly description: Schema.optionalKey<Schema.String>;
|
|
4
|
+
readonly content: Schema.$Record<Schema.String, Schema.StructWithRest<Schema.Struct<{
|
|
5
|
+
readonly schema: Schema.optionalKey<Schema.Union<readonly [Schema.$Record<Schema.String, Schema.Unknown>, Schema.Boolean]>>;
|
|
6
|
+
readonly example: Schema.optionalKey<Schema.Unknown>;
|
|
7
|
+
readonly examples: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
|
|
8
|
+
readonly $ref: Schema.String;
|
|
9
|
+
readonly summary: Schema.optionalKey<Schema.String>;
|
|
10
|
+
readonly description: Schema.optionalKey<Schema.String>;
|
|
11
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{
|
|
12
|
+
readonly summary: Schema.optionalKey<Schema.String>;
|
|
13
|
+
readonly description: Schema.optionalKey<Schema.String>;
|
|
14
|
+
readonly value: Schema.optionalKey<Schema.Unknown>;
|
|
15
|
+
readonly externalValue: Schema.optionalKey<Schema.String>;
|
|
16
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>]>>>;
|
|
17
|
+
readonly encoding: Schema.optionalKey<Schema.$Record<Schema.String, Schema.StructWithRest<Schema.Struct<{
|
|
18
|
+
readonly contentType: Schema.optionalKey<Schema.String>;
|
|
19
|
+
readonly headers: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
|
|
20
|
+
readonly $ref: Schema.String;
|
|
21
|
+
readonly summary: Schema.optionalKey<Schema.String>;
|
|
22
|
+
readonly description: Schema.optionalKey<Schema.String>;
|
|
23
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.suspend<Schema.Codec<import("./header.ts").OpenApiHeader, import("./header.ts").OpenApiHeader, never, never>>]>>>;
|
|
24
|
+
readonly style: Schema.optionalKey<Schema.Literals<readonly ["form", "spaceDelimited", "pipeDelimited", "deepObject"]>>;
|
|
25
|
+
readonly explode: Schema.optionalKey<Schema.Boolean>;
|
|
26
|
+
readonly allowReserved: Schema.optionalKey<Schema.Boolean>;
|
|
27
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>>;
|
|
28
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>;
|
|
29
|
+
readonly required: Schema.optionalKey<Schema.Boolean>;
|
|
30
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>;
|
|
31
|
+
export type OpenApiRequestBody = typeof OpenApiRequestBody.Type;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { OpenApiMediaType } from "./media-type.js";
|
|
3
|
+
import { openApiObject } from "./object.js";
|
|
4
|
+
export const OpenApiRequestBody = openApiObject({
|
|
5
|
+
description: Schema.optionalKey(Schema.String),
|
|
6
|
+
content: Schema.Record(Schema.String, OpenApiMediaType),
|
|
7
|
+
required: Schema.optionalKey(Schema.Boolean),
|
|
8
|
+
});
|