@effect/platform 0.70.6 → 0.71.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/README.md +22 -34
- package/dist/cjs/HttpApi.js +15 -6
- package/dist/cjs/HttpApi.js.map +1 -1
- package/dist/cjs/HttpApiBuilder.js +1 -1
- package/dist/cjs/HttpApiBuilder.js.map +1 -1
- package/dist/cjs/HttpApiClient.js.map +1 -1
- package/dist/cjs/HttpApiError.js +109 -1
- package/dist/cjs/HttpApiError.js.map +1 -1
- package/dist/cjs/HttpApiGroup.js.map +1 -1
- package/dist/cjs/HttpApiSchema.js +46 -2
- package/dist/cjs/HttpApiSchema.js.map +1 -1
- package/dist/cjs/OpenApi.js +20 -4
- package/dist/cjs/OpenApi.js.map +1 -1
- package/dist/cjs/OpenApiJsonSchema.js +18 -477
- package/dist/cjs/OpenApiJsonSchema.js.map +1 -1
- package/dist/dts/HttpApi.d.ts +13 -12
- package/dist/dts/HttpApi.d.ts.map +1 -1
- package/dist/dts/HttpApiBuilder.d.ts +8 -8
- package/dist/dts/HttpApiBuilder.d.ts.map +1 -1
- package/dist/dts/HttpApiClient.d.ts +3 -3
- package/dist/dts/HttpApiClient.d.ts.map +1 -1
- package/dist/dts/HttpApiError.d.ts +85 -0
- package/dist/dts/HttpApiError.d.ts.map +1 -1
- package/dist/dts/HttpApiGroup.d.ts +3 -2
- package/dist/dts/HttpApiGroup.d.ts.map +1 -1
- package/dist/dts/HttpApiSchema.d.ts +19 -1
- package/dist/dts/HttpApiSchema.d.ts.map +1 -1
- package/dist/dts/OpenApi.d.ts +8 -0
- package/dist/dts/OpenApi.d.ts.map +1 -1
- package/dist/dts/OpenApiJsonSchema.d.ts +34 -5
- package/dist/dts/OpenApiJsonSchema.d.ts.map +1 -1
- package/dist/esm/HttpApi.js +13 -5
- package/dist/esm/HttpApi.js.map +1 -1
- package/dist/esm/HttpApiBuilder.js +1 -1
- package/dist/esm/HttpApiBuilder.js.map +1 -1
- package/dist/esm/HttpApiClient.js.map +1 -1
- package/dist/esm/HttpApiError.js +96 -0
- package/dist/esm/HttpApiError.js.map +1 -1
- package/dist/esm/HttpApiGroup.js.map +1 -1
- package/dist/esm/HttpApiSchema.js +45 -2
- package/dist/esm/HttpApiSchema.js.map +1 -1
- package/dist/esm/OpenApi.js +17 -2
- package/dist/esm/OpenApi.js.map +1 -1
- package/dist/esm/OpenApiJsonSchema.js +18 -477
- package/dist/esm/OpenApiJsonSchema.js.map +1 -1
- package/package.json +2 -2
- package/src/HttpApi.ts +35 -19
- package/src/HttpApiBuilder.ts +17 -15
- package/src/HttpApiClient.ts +8 -6
- package/src/HttpApiError.ts +108 -0
- package/src/HttpApiGroup.ts +4 -3
- package/src/HttpApiSchema.ts +63 -5
- package/src/OpenApi.ts +19 -3
- package/src/OpenApiJsonSchema.ts +45 -513
|
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.makeWithDefs = exports.make = void 0;
|
|
7
|
-
var
|
|
8
|
-
var Option = _interopRequireWildcard(require("effect/Option"));
|
|
9
|
-
var Predicate = _interopRequireWildcard(require("effect/Predicate"));
|
|
7
|
+
var JSONSchema = _interopRequireWildcard(require("effect/JSONSchema"));
|
|
10
8
|
var Record = _interopRequireWildcard(require("effect/Record"));
|
|
11
|
-
var AST = _interopRequireWildcard(require("effect/SchemaAST"));
|
|
12
9
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
13
10
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
11
|
/**
|
|
@@ -20,491 +17,35 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
20
17
|
* @since 1.0.0
|
|
21
18
|
*/
|
|
22
19
|
const make = schema => {
|
|
23
|
-
const
|
|
20
|
+
const defs = {};
|
|
24
21
|
const out = makeWithDefs(schema, {
|
|
25
|
-
defs
|
|
22
|
+
defs
|
|
26
23
|
});
|
|
27
|
-
if (!Record.isEmptyRecord(
|
|
28
|
-
out.$defs =
|
|
24
|
+
if (!Record.isEmptyRecord(defs)) {
|
|
25
|
+
out.$defs = defs;
|
|
29
26
|
}
|
|
30
27
|
return out;
|
|
31
28
|
};
|
|
32
29
|
/**
|
|
30
|
+
* Creates a schema with additional options and definitions.
|
|
31
|
+
*
|
|
32
|
+
* - `defs`: A record of definitions that are included in the schema.
|
|
33
|
+
* - `defsPath`: The path to the definitions within the schema (defaults to "#/$defs/").
|
|
34
|
+
* - `topLevelReferenceStrategy`: Controls the handling of the top-level reference. Possible values are:
|
|
35
|
+
* - `"keep"`: Keep the top-level reference (default behavior).
|
|
36
|
+
* - `"skip"`: Skip the top-level reference.
|
|
37
|
+
*
|
|
33
38
|
* @category encoding
|
|
34
39
|
* @since 1.0.0
|
|
35
40
|
*/
|
|
36
41
|
exports.make = make;
|
|
37
42
|
const makeWithDefs = (schema, options) => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
43
|
+
return JSONSchema.fromAST(schema.ast, {
|
|
44
|
+
definitions: options.defs,
|
|
45
|
+
definitionPath: options.defsPath ?? "#/components/schemas/",
|
|
46
|
+
target: "openApi3.1",
|
|
47
|
+
topLevelReferenceStrategy: options.topLevelReferenceStrategy ?? "keep"
|
|
42
48
|
});
|
|
43
|
-
for (const id in options.defs) {
|
|
44
|
-
if (options.defs[id]["$ref"] === getRef(id)) {
|
|
45
|
-
delete options.defs[id];
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return out;
|
|
49
49
|
};
|
|
50
50
|
exports.makeWithDefs = makeWithDefs;
|
|
51
|
-
const constAny = {
|
|
52
|
-
$id: "/schemas/any"
|
|
53
|
-
};
|
|
54
|
-
const constUnknown = {
|
|
55
|
-
$id: "/schemas/unknown"
|
|
56
|
-
};
|
|
57
|
-
const constVoid = {
|
|
58
|
-
$id: "/schemas/void"
|
|
59
|
-
};
|
|
60
|
-
const constAnyObject = {
|
|
61
|
-
"$id": "/schemas/object",
|
|
62
|
-
"anyOf": [{
|
|
63
|
-
"type": "object"
|
|
64
|
-
}, {
|
|
65
|
-
"type": "array"
|
|
66
|
-
}]
|
|
67
|
-
};
|
|
68
|
-
const constEmpty = {
|
|
69
|
-
"$id": "/schemas/{}",
|
|
70
|
-
"anyOf": [{
|
|
71
|
-
"type": "object"
|
|
72
|
-
}, {
|
|
73
|
-
"type": "array"
|
|
74
|
-
}]
|
|
75
|
-
};
|
|
76
|
-
const getJsonSchemaAnnotations = annotated => Record.getSomes({
|
|
77
|
-
description: AST.getDescriptionAnnotation(annotated),
|
|
78
|
-
title: AST.getTitleAnnotation(annotated),
|
|
79
|
-
examples: AST.getExamplesAnnotation(annotated),
|
|
80
|
-
default: AST.getDefaultAnnotation(annotated)
|
|
81
|
-
});
|
|
82
|
-
const removeDefaultJsonSchemaAnnotations = (jsonSchemaAnnotations, ast) => {
|
|
83
|
-
if (jsonSchemaAnnotations["title"] === ast.annotations[AST.TitleAnnotationId]) {
|
|
84
|
-
delete jsonSchemaAnnotations["title"];
|
|
85
|
-
}
|
|
86
|
-
if (jsonSchemaAnnotations["description"] === ast.annotations[AST.DescriptionAnnotationId]) {
|
|
87
|
-
delete jsonSchemaAnnotations["description"];
|
|
88
|
-
}
|
|
89
|
-
return jsonSchemaAnnotations;
|
|
90
|
-
};
|
|
91
|
-
const getASTJsonSchemaAnnotations = ast => {
|
|
92
|
-
const jsonSchemaAnnotations = getJsonSchemaAnnotations(ast);
|
|
93
|
-
switch (ast._tag) {
|
|
94
|
-
case "StringKeyword":
|
|
95
|
-
return removeDefaultJsonSchemaAnnotations(jsonSchemaAnnotations, AST.stringKeyword);
|
|
96
|
-
case "NumberKeyword":
|
|
97
|
-
return removeDefaultJsonSchemaAnnotations(jsonSchemaAnnotations, AST.numberKeyword);
|
|
98
|
-
case "BooleanKeyword":
|
|
99
|
-
return removeDefaultJsonSchemaAnnotations(jsonSchemaAnnotations, AST.booleanKeyword);
|
|
100
|
-
default:
|
|
101
|
-
return jsonSchemaAnnotations;
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
const pruneUndefinedFromPropertySignature = ast => {
|
|
105
|
-
if (Option.isNone(AST.getJSONSchemaAnnotation(ast))) {
|
|
106
|
-
switch (ast._tag) {
|
|
107
|
-
case "Union":
|
|
108
|
-
{
|
|
109
|
-
const types = ast.types.filter(type => !AST.isUndefinedKeyword(type));
|
|
110
|
-
if (types.length < ast.types.length) {
|
|
111
|
-
return AST.Union.make(types, ast.annotations);
|
|
112
|
-
}
|
|
113
|
-
break;
|
|
114
|
-
}
|
|
115
|
-
case "Transformation":
|
|
116
|
-
return pruneUndefinedFromPropertySignature(isParseJsonTransformation(ast.from) ? ast.to : ast.from);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
const getRefinementInnerTransformation = ast => {
|
|
121
|
-
switch (ast.from._tag) {
|
|
122
|
-
case "Transformation":
|
|
123
|
-
return ast.from;
|
|
124
|
-
case "Refinement":
|
|
125
|
-
return getRefinementInnerTransformation(ast.from);
|
|
126
|
-
case "Suspend":
|
|
127
|
-
{
|
|
128
|
-
const from = ast.from.f();
|
|
129
|
-
if (AST.isRefinement(from)) {
|
|
130
|
-
return getRefinementInnerTransformation(from);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
const isParseJsonTransformation = ast => ast.annotations[AST.SchemaIdAnnotationId] === AST.ParseJsonSchemaId;
|
|
136
|
-
const isOverrideAnnotation = jsonSchema => {
|
|
137
|
-
return "type" in jsonSchema || "oneOf" in jsonSchema || "anyOf" in jsonSchema || "const" in jsonSchema || "enum" in jsonSchema || "$ref" in jsonSchema;
|
|
138
|
-
};
|
|
139
|
-
const go = (ast, $defs, handleIdentifier, path, options) => {
|
|
140
|
-
const hook = AST.getJSONSchemaAnnotation(ast);
|
|
141
|
-
if (Option.isSome(hook)) {
|
|
142
|
-
const handler = hook.value;
|
|
143
|
-
if (AST.isRefinement(ast)) {
|
|
144
|
-
const t = getRefinementInnerTransformation(ast);
|
|
145
|
-
if (t === undefined) {
|
|
146
|
-
try {
|
|
147
|
-
return {
|
|
148
|
-
...go(ast.from, $defs, true, path, options),
|
|
149
|
-
...getJsonSchemaAnnotations(ast),
|
|
150
|
-
...handler
|
|
151
|
-
};
|
|
152
|
-
} catch (e) {
|
|
153
|
-
return {
|
|
154
|
-
...getJsonSchemaAnnotations(ast),
|
|
155
|
-
...handler
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
} else if (!isOverrideAnnotation(handler)) {
|
|
159
|
-
return {
|
|
160
|
-
...go(t, $defs, true, path, options),
|
|
161
|
-
...getJsonSchemaAnnotations(ast)
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
return handler;
|
|
166
|
-
}
|
|
167
|
-
const surrogate = AST.getSurrogateAnnotation(ast);
|
|
168
|
-
if (handleIdentifier && !AST.isRefinement(ast)) {
|
|
169
|
-
const identifier = AST.getJSONIdentifier(Option.isSome(surrogate) ? {
|
|
170
|
-
annotations: {
|
|
171
|
-
...(ast._tag === "Transformation" ? ast.to.annotations : {}),
|
|
172
|
-
...ast.annotations
|
|
173
|
-
}
|
|
174
|
-
} : ast);
|
|
175
|
-
if (Option.isSome(identifier)) {
|
|
176
|
-
const id = identifier.value;
|
|
177
|
-
const out = {
|
|
178
|
-
$ref: options.getRef(id)
|
|
179
|
-
};
|
|
180
|
-
if (!Record.has($defs, id)) {
|
|
181
|
-
$defs[id] = out;
|
|
182
|
-
$defs[id] = go(ast, $defs, false, path, options);
|
|
183
|
-
}
|
|
184
|
-
return out;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
if (Option.isSome(surrogate)) {
|
|
188
|
-
return {
|
|
189
|
-
...go(surrogate.value, $defs, handleIdentifier, path, options),
|
|
190
|
-
...(ast._tag === "Transformation" ? getJsonSchemaAnnotations(ast.to) : {}),
|
|
191
|
-
...getJsonSchemaAnnotations(ast)
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
switch (ast._tag) {
|
|
195
|
-
case "Declaration":
|
|
196
|
-
throw new Error(getJSONSchemaMissingAnnotationErrorMessage(path, ast));
|
|
197
|
-
case "Literal":
|
|
198
|
-
{
|
|
199
|
-
const literal = ast.literal;
|
|
200
|
-
if (literal === null) {
|
|
201
|
-
return {
|
|
202
|
-
enum: [null],
|
|
203
|
-
...getJsonSchemaAnnotations(ast)
|
|
204
|
-
};
|
|
205
|
-
} else if (Predicate.isString(literal) || Predicate.isNumber(literal) || Predicate.isBoolean(literal)) {
|
|
206
|
-
return {
|
|
207
|
-
enum: [literal],
|
|
208
|
-
...getJsonSchemaAnnotations(ast)
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
throw new Error(getJSONSchemaMissingAnnotationErrorMessage(path, ast));
|
|
212
|
-
}
|
|
213
|
-
case "UniqueSymbol":
|
|
214
|
-
throw new Error(getJSONSchemaMissingAnnotationErrorMessage(path, ast));
|
|
215
|
-
case "UndefinedKeyword":
|
|
216
|
-
throw new Error(getJSONSchemaMissingAnnotationErrorMessage(path, ast));
|
|
217
|
-
case "VoidKeyword":
|
|
218
|
-
return {
|
|
219
|
-
...constVoid,
|
|
220
|
-
...getJsonSchemaAnnotations(ast)
|
|
221
|
-
};
|
|
222
|
-
case "NeverKeyword":
|
|
223
|
-
throw new Error(getJSONSchemaMissingAnnotationErrorMessage(path, ast));
|
|
224
|
-
case "UnknownKeyword":
|
|
225
|
-
return {
|
|
226
|
-
...constUnknown,
|
|
227
|
-
...getJsonSchemaAnnotations(ast)
|
|
228
|
-
};
|
|
229
|
-
case "AnyKeyword":
|
|
230
|
-
return {
|
|
231
|
-
...constAny,
|
|
232
|
-
...getJsonSchemaAnnotations(ast)
|
|
233
|
-
};
|
|
234
|
-
case "ObjectKeyword":
|
|
235
|
-
return {
|
|
236
|
-
...constAnyObject,
|
|
237
|
-
...getJsonSchemaAnnotations(ast)
|
|
238
|
-
};
|
|
239
|
-
case "StringKeyword":
|
|
240
|
-
return {
|
|
241
|
-
type: "string",
|
|
242
|
-
...getASTJsonSchemaAnnotations(ast)
|
|
243
|
-
};
|
|
244
|
-
case "NumberKeyword":
|
|
245
|
-
return {
|
|
246
|
-
type: "number",
|
|
247
|
-
...getASTJsonSchemaAnnotations(ast)
|
|
248
|
-
};
|
|
249
|
-
case "BooleanKeyword":
|
|
250
|
-
return {
|
|
251
|
-
type: "boolean",
|
|
252
|
-
...getASTJsonSchemaAnnotations(ast)
|
|
253
|
-
};
|
|
254
|
-
case "BigIntKeyword":
|
|
255
|
-
throw new Error(getJSONSchemaMissingAnnotationErrorMessage(path, ast));
|
|
256
|
-
case "SymbolKeyword":
|
|
257
|
-
throw new Error(getJSONSchemaMissingAnnotationErrorMessage(path, ast));
|
|
258
|
-
case "TupleType":
|
|
259
|
-
{
|
|
260
|
-
const elements = ast.elements.map((e, i) => ({
|
|
261
|
-
...go(e.type, $defs, true, path.concat(i), options),
|
|
262
|
-
...getJsonSchemaAnnotations(e)
|
|
263
|
-
}));
|
|
264
|
-
const rest = ast.rest.map(annotatedAST => ({
|
|
265
|
-
...go(annotatedAST.type, $defs, true, path, options),
|
|
266
|
-
...getJsonSchemaAnnotations(annotatedAST)
|
|
267
|
-
}));
|
|
268
|
-
const output = {
|
|
269
|
-
type: "array"
|
|
270
|
-
};
|
|
271
|
-
// ---------------------------------------------
|
|
272
|
-
// handle elements
|
|
273
|
-
// ---------------------------------------------
|
|
274
|
-
const len = ast.elements.length;
|
|
275
|
-
if (len > 0) {
|
|
276
|
-
output.minItems = len - ast.elements.filter(element => element.isOptional).length;
|
|
277
|
-
output.items = elements;
|
|
278
|
-
}
|
|
279
|
-
// ---------------------------------------------
|
|
280
|
-
// handle rest element
|
|
281
|
-
// ---------------------------------------------
|
|
282
|
-
const restLength = rest.length;
|
|
283
|
-
if (restLength > 0) {
|
|
284
|
-
const head = rest[0];
|
|
285
|
-
const isHomogeneous = restLength === 1 && ast.elements.every(e => e.type === ast.rest[0].type);
|
|
286
|
-
if (isHomogeneous) {
|
|
287
|
-
output.items = head;
|
|
288
|
-
} else {
|
|
289
|
-
output.additionalItems = head;
|
|
290
|
-
}
|
|
291
|
-
// ---------------------------------------------
|
|
292
|
-
// handle post rest elements
|
|
293
|
-
// ---------------------------------------------
|
|
294
|
-
if (restLength > 1) {
|
|
295
|
-
throw new Error(getJSONSchemaUnsupportedPostRestElementsErrorMessage(path));
|
|
296
|
-
}
|
|
297
|
-
} else {
|
|
298
|
-
if (len > 0) {
|
|
299
|
-
output.additionalItems = false;
|
|
300
|
-
} else {
|
|
301
|
-
output.maxItems = 0;
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
return {
|
|
305
|
-
...output,
|
|
306
|
-
...getJsonSchemaAnnotations(ast)
|
|
307
|
-
};
|
|
308
|
-
}
|
|
309
|
-
case "TypeLiteral":
|
|
310
|
-
{
|
|
311
|
-
if (ast.propertySignatures.length === 0 && ast.indexSignatures.length === 0) {
|
|
312
|
-
return {
|
|
313
|
-
...constEmpty,
|
|
314
|
-
...getJsonSchemaAnnotations(ast)
|
|
315
|
-
};
|
|
316
|
-
}
|
|
317
|
-
let patternProperties = undefined;
|
|
318
|
-
let propertyNames = undefined;
|
|
319
|
-
for (const is of ast.indexSignatures) {
|
|
320
|
-
const parameter = is.parameter;
|
|
321
|
-
switch (parameter._tag) {
|
|
322
|
-
case "StringKeyword":
|
|
323
|
-
{
|
|
324
|
-
patternProperties = go(is.type, $defs, true, path, options);
|
|
325
|
-
break;
|
|
326
|
-
}
|
|
327
|
-
case "TemplateLiteral":
|
|
328
|
-
{
|
|
329
|
-
patternProperties = go(is.type, $defs, true, path, options);
|
|
330
|
-
propertyNames = {
|
|
331
|
-
type: "string",
|
|
332
|
-
pattern: AST.getTemplateLiteralRegExp(parameter).source
|
|
333
|
-
};
|
|
334
|
-
break;
|
|
335
|
-
}
|
|
336
|
-
case "Refinement":
|
|
337
|
-
{
|
|
338
|
-
patternProperties = go(is.type, $defs, true, path, options);
|
|
339
|
-
propertyNames = go(parameter, $defs, true, path, options);
|
|
340
|
-
break;
|
|
341
|
-
}
|
|
342
|
-
case "SymbolKeyword":
|
|
343
|
-
throw new Error(getJSONSchemaUnsupportedParameterErrorMessage(path, parameter));
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
const output = {
|
|
347
|
-
type: "object",
|
|
348
|
-
required: [],
|
|
349
|
-
properties: {},
|
|
350
|
-
additionalProperties: false
|
|
351
|
-
};
|
|
352
|
-
// ---------------------------------------------
|
|
353
|
-
// handle property signatures
|
|
354
|
-
// ---------------------------------------------
|
|
355
|
-
for (let i = 0; i < ast.propertySignatures.length; i++) {
|
|
356
|
-
const ps = ast.propertySignatures[i];
|
|
357
|
-
const name = ps.name;
|
|
358
|
-
if (Predicate.isString(name)) {
|
|
359
|
-
const pruned = pruneUndefinedFromPropertySignature(ps.type);
|
|
360
|
-
output.properties[name] = {
|
|
361
|
-
...go(pruned ? pruned : ps.type, $defs, true, path.concat(ps.name), options),
|
|
362
|
-
...getJsonSchemaAnnotations(ps)
|
|
363
|
-
};
|
|
364
|
-
// ---------------------------------------------
|
|
365
|
-
// handle optional property signatures
|
|
366
|
-
// ---------------------------------------------
|
|
367
|
-
if (!ps.isOptional && pruned === undefined) {
|
|
368
|
-
output.required.push(name);
|
|
369
|
-
}
|
|
370
|
-
} else {
|
|
371
|
-
throw new Error(getJSONSchemaUnsupportedKeyErrorMessage(name, path));
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
// ---------------------------------------------
|
|
375
|
-
// handle index signatures
|
|
376
|
-
// ---------------------------------------------
|
|
377
|
-
if (patternProperties !== undefined) {
|
|
378
|
-
delete output.additionalProperties;
|
|
379
|
-
output.patternProperties = {
|
|
380
|
-
"": patternProperties
|
|
381
|
-
};
|
|
382
|
-
}
|
|
383
|
-
if (propertyNames !== undefined) {
|
|
384
|
-
output.propertyNames = propertyNames;
|
|
385
|
-
}
|
|
386
|
-
return {
|
|
387
|
-
...output,
|
|
388
|
-
...getJsonSchemaAnnotations(ast)
|
|
389
|
-
};
|
|
390
|
-
}
|
|
391
|
-
case "Union":
|
|
392
|
-
{
|
|
393
|
-
const enums = [];
|
|
394
|
-
const anyOf = [];
|
|
395
|
-
for (const type of ast.types) {
|
|
396
|
-
const schema = go(type, $defs, true, path, options);
|
|
397
|
-
if ("enum" in schema) {
|
|
398
|
-
if (Object.keys(schema).length > 1) {
|
|
399
|
-
anyOf.push(schema);
|
|
400
|
-
} else {
|
|
401
|
-
for (const e of schema.enum) {
|
|
402
|
-
enums.push(e);
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
} else {
|
|
406
|
-
anyOf.push(schema);
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
if (anyOf.length === 0) {
|
|
410
|
-
return {
|
|
411
|
-
enum: enums,
|
|
412
|
-
...getJsonSchemaAnnotations(ast)
|
|
413
|
-
};
|
|
414
|
-
} else {
|
|
415
|
-
if (enums.length >= 1) {
|
|
416
|
-
anyOf.push({
|
|
417
|
-
enum: enums
|
|
418
|
-
});
|
|
419
|
-
}
|
|
420
|
-
return {
|
|
421
|
-
anyOf,
|
|
422
|
-
...getJsonSchemaAnnotations(ast)
|
|
423
|
-
};
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
case "Enums":
|
|
427
|
-
{
|
|
428
|
-
return {
|
|
429
|
-
$comment: "/schemas/enums",
|
|
430
|
-
anyOf: ast.enums.map(e => ({
|
|
431
|
-
title: e[0],
|
|
432
|
-
enum: [e[1]]
|
|
433
|
-
})),
|
|
434
|
-
...getJsonSchemaAnnotations(ast)
|
|
435
|
-
};
|
|
436
|
-
}
|
|
437
|
-
case "Refinement":
|
|
438
|
-
{
|
|
439
|
-
if (AST.encodedBoundAST(ast) === ast) {
|
|
440
|
-
throw new Error(getJSONSchemaMissingAnnotationErrorMessage(path, ast));
|
|
441
|
-
}
|
|
442
|
-
return go(ast.from, $defs, true, path, options);
|
|
443
|
-
}
|
|
444
|
-
case "TemplateLiteral":
|
|
445
|
-
{
|
|
446
|
-
const regex = AST.getTemplateLiteralRegExp(ast);
|
|
447
|
-
return {
|
|
448
|
-
type: "string",
|
|
449
|
-
description: "a template literal",
|
|
450
|
-
pattern: regex.source,
|
|
451
|
-
...getJsonSchemaAnnotations(ast)
|
|
452
|
-
};
|
|
453
|
-
}
|
|
454
|
-
case "Suspend":
|
|
455
|
-
{
|
|
456
|
-
const identifier = Option.orElse(AST.getJSONIdentifier(ast), () => AST.getJSONIdentifier(ast.f()));
|
|
457
|
-
if (Option.isNone(identifier)) {
|
|
458
|
-
throw new Error(getJSONSchemaMissingIdentifierAnnotationErrorMessage(path, ast));
|
|
459
|
-
}
|
|
460
|
-
return {
|
|
461
|
-
...go(ast.f(), $defs, true, path, options),
|
|
462
|
-
...getJsonSchemaAnnotations(ast)
|
|
463
|
-
};
|
|
464
|
-
}
|
|
465
|
-
case "Transformation":
|
|
466
|
-
{
|
|
467
|
-
// Properly handle S.parseJson transformations by focusing on
|
|
468
|
-
// the 'to' side of the AST. This approach prevents the generation of useless schemas
|
|
469
|
-
// derived from the 'from' side (type: string), ensuring the output matches the intended
|
|
470
|
-
// complex schema type.
|
|
471
|
-
if (isParseJsonTransformation(ast.from)) {
|
|
472
|
-
return {
|
|
473
|
-
type: "string",
|
|
474
|
-
contentMediaType: "application/json",
|
|
475
|
-
contentSchema: go(ast.to, $defs, true, path, options),
|
|
476
|
-
...getJsonSchemaAnnotations(ast)
|
|
477
|
-
};
|
|
478
|
-
}
|
|
479
|
-
return {
|
|
480
|
-
...getASTJsonSchemaAnnotations(ast.to),
|
|
481
|
-
...go(ast.from, $defs, true, path, options),
|
|
482
|
-
...getJsonSchemaAnnotations(ast)
|
|
483
|
-
};
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
};
|
|
487
|
-
const getJSONSchemaMissingAnnotationErrorMessage = (path, ast) => getMissingAnnotationErrorMessage(`Generating a JSON Schema for this schema requires a "jsonSchema" annotation`, path, ast);
|
|
488
|
-
const getJSONSchemaMissingIdentifierAnnotationErrorMessage = (path, ast) => getMissingAnnotationErrorMessage(`Generating a JSON Schema for this schema requires an "identifier" annotation`, path, ast);
|
|
489
|
-
const getJSONSchemaUnsupportedParameterErrorMessage = (path, parameter) => getErrorMessage("Unsupported index signature parameter", undefined, path, parameter);
|
|
490
|
-
const getJSONSchemaUnsupportedPostRestElementsErrorMessage = path => getErrorMessage("Generating a JSON Schema for post-rest elements is not currently supported. You're welcome to contribute by submitting a Pull Request", undefined, path);
|
|
491
|
-
const getJSONSchemaUnsupportedKeyErrorMessage = (key, path) => getErrorMessage("Unsupported key", `Cannot encode ${formatPropertyKey(key)} key to JSON Schema`, path);
|
|
492
|
-
const getMissingAnnotationErrorMessage = (details, path, ast) => getErrorMessage("Missing annotation", details, path, ast);
|
|
493
|
-
const getErrorMessage = (reason, details, path, ast) => {
|
|
494
|
-
let out = reason;
|
|
495
|
-
if (path && Arr.isNonEmptyReadonlyArray(path)) {
|
|
496
|
-
out += `\nat path: ${formatPath(path)}`;
|
|
497
|
-
}
|
|
498
|
-
if (details !== undefined) {
|
|
499
|
-
out += `\ndetails: ${details}`;
|
|
500
|
-
}
|
|
501
|
-
if (ast) {
|
|
502
|
-
out += `\nschema (${ast._tag}): ${ast}`;
|
|
503
|
-
}
|
|
504
|
-
return out;
|
|
505
|
-
};
|
|
506
|
-
const formatPathKey = key => `[${formatPropertyKey(key)}]`;
|
|
507
|
-
const formatPath = path => isNonEmpty(path) ? path.map(formatPathKey).join("") : formatPathKey(path);
|
|
508
|
-
const isNonEmpty = x => Array.isArray(x);
|
|
509
|
-
const formatPropertyKey = name => typeof name === "string" ? JSON.stringify(name) : String(name);
|
|
510
51
|
//# sourceMappingURL=OpenApiJsonSchema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenApiJsonSchema.js","names":["Arr","_interopRequireWildcard","require","Option","Predicate","Record","AST","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","make","schema","$defs","out","makeWithDefs","defs","isEmptyRecord","exports","options","defsPath","getRef","id","go","ast","constAny","$id","constUnknown","constVoid","constAnyObject","constEmpty","getJsonSchemaAnnotations","annotated","getSomes","description","getDescriptionAnnotation","title","getTitleAnnotation","examples","getExamplesAnnotation","getDefaultAnnotation","removeDefaultJsonSchemaAnnotations","jsonSchemaAnnotations","annotations","TitleAnnotationId","DescriptionAnnotationId","getASTJsonSchemaAnnotations","_tag","stringKeyword","numberKeyword","booleanKeyword","pruneUndefinedFromPropertySignature","isNone","getJSONSchemaAnnotation","types","filter","type","isUndefinedKeyword","length","Union","isParseJsonTransformation","from","to","getRefinementInnerTransformation","f","isRefinement","SchemaIdAnnotationId","ParseJsonSchemaId","isOverrideAnnotation","jsonSchema","handleIdentifier","path","hook","isSome","handler","value","undefined","surrogate","getSurrogateAnnotation","identifier","getJSONIdentifier","$ref","Error","getJSONSchemaMissingAnnotationErrorMessage","literal","enum","isString","isNumber","isBoolean","elements","map","concat","rest","annotatedAST","output","len","minItems","element","isOptional","items","restLength","head","isHomogeneous","every","additionalItems","getJSONSchemaUnsupportedPostRestElementsErrorMessage","maxItems","propertySignatures","indexSignatures","patternProperties","propertyNames","is","parameter","pattern","getTemplateLiteralRegExp","source","getJSONSchemaUnsupportedParameterErrorMessage","required","properties","additionalProperties","ps","name","pruned","push","getJSONSchemaUnsupportedKeyErrorMessage","enums","anyOf","keys","$comment","encodedBoundAST","regex","orElse","getJSONSchemaMissingIdentifierAnnotationErrorMessage","contentMediaType","contentSchema","getMissingAnnotationErrorMessage","getErrorMessage","key","formatPropertyKey","details","reason","isNonEmptyReadonlyArray","formatPath","formatPathKey","isNonEmpty","join","x","Array","isArray","JSON","stringify","String"],"sources":["../../src/OpenApiJsonSchema.ts"],"sourcesContent":[null],"mappings":";;;;;;AAGA,IAAAA,GAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,uBAAA,CAAAC,OAAA;AAEA,IAAAE,SAAA,GAAAH,uBAAA,CAAAC,OAAA;AACA,IAAAG,MAAA,GAAAJ,uBAAA,CAAAC,OAAA;AAEA,IAAAI,GAAA,GAAAL,uBAAA,CAAAC,OAAA;AAAuC,SAAAK,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAP,wBAAAO,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,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ACD,GAAG,CAAC,GAAG;AAEjF,MAAMK,UAAU,GAAIvE,IAAsB,IACxCyE,UAAU,CAACzE,IAAI,CAAC,GAAGA,IAAI,CAACmB,GAAG,CAACqD,aAAa,CAAC,CAACE,IAAI,CAAC,EAAE,CAAC,GAAGF,aAAa,CAACxE,IAAI,CAAC;AAE3E,MAAMyE,UAAU,GAAOE,CAAkC,IAAwCC,KAAK,CAACC,OAAO,CAACF,CAAC,CAAC;AAEjH,MAAMR,iBAAiB,GAAIjB,IAAiB,IAAa,OAAOA,IAAI,KAAK,QAAQ,GAAG4B,IAAI,CAACC,SAAS,CAAC7B,IAAI,CAAC,GAAG8B,MAAM,CAAC9B,IAAI,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"OpenApiJsonSchema.js","names":["JSONSchema","_interopRequireWildcard","require","Record","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","make","schema","defs","out","makeWithDefs","isEmptyRecord","$defs","exports","options","fromAST","ast","definitions","definitionPath","defsPath","target","topLevelReferenceStrategy"],"sources":["../../src/OpenApiJsonSchema.ts"],"sourcesContent":[null],"mappings":";;;;;;AAGA,IAAAA,UAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,uBAAA,CAAAC,OAAA;AAAuC,SAAAE,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAJ,wBAAAI,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAA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I;IACzBU,cAAc,EAAEJ,OAAO,CAACK,QAAQ,IAAI,uBAAuB;IAC3DC,MAAM,EAAE,YAAY;IACpBC,yBAAyB,EAAEP,OAAO,CAACO,yBAAyB,IAAI;GACjE,CAAC;AACJ,CAAC;AAAAR,OAAA,CAAAH,YAAA,GAAAA,YAAA","ignoreList":[]}
|
package/dist/dts/HttpApi.d.ts
CHANGED
|
@@ -39,9 +39,10 @@ export declare const isHttpApi: (u: unknown) => u is HttpApi.Any;
|
|
|
39
39
|
* @since 1.0.0
|
|
40
40
|
* @category models
|
|
41
41
|
*/
|
|
42
|
-
export interface HttpApi<out Groups extends HttpApiGroup.HttpApiGroup.Any = never, in out E = never, out R = never> extends Pipeable {
|
|
42
|
+
export interface HttpApi<out Id extends string, out Groups extends HttpApiGroup.HttpApiGroup.Any = never, in out E = never, out R = never> extends Pipeable {
|
|
43
43
|
new (_: never): {};
|
|
44
44
|
readonly [TypeId]: TypeId;
|
|
45
|
+
readonly identifier: Id;
|
|
45
46
|
readonly groups: Record.ReadonlyRecord<string, Groups>;
|
|
46
47
|
readonly annotations: Context.Context<never>;
|
|
47
48
|
readonly errorSchema: Schema.Schema<E, unknown, R>;
|
|
@@ -49,37 +50,37 @@ export interface HttpApi<out Groups extends HttpApiGroup.HttpApiGroup.Any = neve
|
|
|
49
50
|
/**
|
|
50
51
|
* Add a `HttpApiGroup` to the `HttpApi`.
|
|
51
52
|
*/
|
|
52
|
-
add<A extends HttpApiGroup.HttpApiGroup.Any>(group: A): HttpApi<Groups | A, E, R>;
|
|
53
|
+
add<A extends HttpApiGroup.HttpApiGroup.Any>(group: A): HttpApi<Id, Groups | A, E, R>;
|
|
53
54
|
/**
|
|
54
55
|
* Add another `HttpApi` to the `HttpApi`.
|
|
55
56
|
*/
|
|
56
|
-
addHttpApi<Groups2 extends HttpApiGroup.HttpApiGroup.Any, E2, R2>(api: HttpApi<Groups2, E2, R2>): HttpApi<Groups | HttpApiGroup.HttpApiGroup.AddContext<Groups2, R2>, E | E2, R>;
|
|
57
|
+
addHttpApi<Id2 extends string, Groups2 extends HttpApiGroup.HttpApiGroup.Any, E2, R2>(api: HttpApi<Id2, Groups2, E2, R2>): HttpApi<Id, Groups | HttpApiGroup.HttpApiGroup.AddContext<Groups2, R2>, E | E2, R>;
|
|
57
58
|
/**
|
|
58
59
|
* Add an global error to the `HttpApi`.
|
|
59
60
|
*/
|
|
60
61
|
addError<A, I, RX>(schema: Schema.Schema<A, I, RX>, annotations?: {
|
|
61
62
|
readonly status?: number | undefined;
|
|
62
|
-
}): HttpApi<Groups, E | A, R | RX>;
|
|
63
|
+
}): HttpApi<Id, Groups, E | A, R | RX>;
|
|
63
64
|
/**
|
|
64
65
|
* Prefix all endpoints in the `HttpApi`.
|
|
65
66
|
*/
|
|
66
|
-
prefix(prefix: PathInput): HttpApi<Groups, E, R>;
|
|
67
|
+
prefix(prefix: PathInput): HttpApi<Id, Groups, E, R>;
|
|
67
68
|
/**
|
|
68
69
|
* Add a middleware to a `HttpApi`. It will be applied to all endpoints in the
|
|
69
70
|
* `HttpApi`.
|
|
70
71
|
*/
|
|
71
|
-
middleware<I extends HttpApiMiddleware.HttpApiMiddleware.AnyId, S>(middleware: Context.Tag<I, S>): HttpApi<Groups, E | HttpApiMiddleware.HttpApiMiddleware.Error<I>, R | I | HttpApiMiddleware.HttpApiMiddleware.ErrorContext<I>>;
|
|
72
|
+
middleware<I extends HttpApiMiddleware.HttpApiMiddleware.AnyId, S>(middleware: Context.Tag<I, S>): HttpApi<Id, Groups, E | HttpApiMiddleware.HttpApiMiddleware.Error<I>, R | I | HttpApiMiddleware.HttpApiMiddleware.ErrorContext<I>>;
|
|
72
73
|
/**
|
|
73
74
|
* Annotate the `HttpApi`.
|
|
74
75
|
*/
|
|
75
|
-
annotate<I, S>(tag: Context.Tag<I, S>, value: S): HttpApi<Groups, E, R>;
|
|
76
|
+
annotate<I, S>(tag: Context.Tag<I, S>, value: S): HttpApi<Id, Groups, E, R>;
|
|
76
77
|
/**
|
|
77
78
|
* Annotate the `HttpApi` with a Context.
|
|
78
79
|
*/
|
|
79
|
-
annotateContext<I>(context: Context.Context<I>): HttpApi<Groups, E, R>;
|
|
80
|
+
annotateContext<I>(context: Context.Context<I>): HttpApi<Id, Groups, E, R>;
|
|
80
81
|
}
|
|
81
82
|
declare const Api_base: Context.TagClass<Api, "@effect/platform/HttpApi/Api", {
|
|
82
|
-
readonly api: HttpApi<HttpApiGroup.HttpApiGroup.AnyWithProps>;
|
|
83
|
+
readonly api: HttpApi<string, HttpApiGroup.HttpApiGroup.AnyWithProps>;
|
|
83
84
|
readonly context: Context.Context<never>;
|
|
84
85
|
}>;
|
|
85
86
|
/**
|
|
@@ -104,7 +105,7 @@ export declare namespace HttpApi {
|
|
|
104
105
|
* @since 1.0.0
|
|
105
106
|
* @category models
|
|
106
107
|
*/
|
|
107
|
-
type AnyWithProps = HttpApi<HttpApiGroup.HttpApiGroup.AnyWithProps, any, any>;
|
|
108
|
+
type AnyWithProps = HttpApi<string, HttpApiGroup.HttpApiGroup.AnyWithProps, any, any>;
|
|
108
109
|
}
|
|
109
110
|
/**
|
|
110
111
|
* An `HttpApi` is a collection of `HttpApiEndpoint`s. You can use an `HttpApi` to
|
|
@@ -115,7 +116,7 @@ export declare namespace HttpApi {
|
|
|
115
116
|
* @since 1.0.0
|
|
116
117
|
* @category constructors
|
|
117
118
|
*/
|
|
118
|
-
export declare const
|
|
119
|
+
export declare const make: <const Id extends string>(identifier: Id) => HttpApi<Id, never, HttpApiDecodeError>;
|
|
119
120
|
/**
|
|
120
121
|
* Extract metadata from an `HttpApi`, which can be used to generate documentation
|
|
121
122
|
* or other tooling.
|
|
@@ -125,7 +126,7 @@ export declare const empty: HttpApi<never, HttpApiDecodeError>;
|
|
|
125
126
|
* @since 1.0.0
|
|
126
127
|
* @category reflection
|
|
127
128
|
*/
|
|
128
|
-
export declare const reflect: <Groups extends HttpApiGroup.HttpApiGroup.Any, Error, R>(self: HttpApi<Groups, Error, R>, options: {
|
|
129
|
+
export declare const reflect: <Id extends string, Groups extends HttpApiGroup.HttpApiGroup.Any, Error, R>(self: HttpApi<Id, Groups, Error, R>, options: {
|
|
129
130
|
readonly predicate?: Predicate.Predicate<{
|
|
130
131
|
readonly endpoint: HttpApiEndpoint.HttpApiEndpoint.AnyWithProps;
|
|
131
132
|
readonly group: HttpApiGroup.HttpApiGroup.AnyWithProps;
|