@mintlify/msft-sdk 1.1.62 → 1.1.64
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/dist/api-playground/ApiPlayground/Response/DownloadFileButton.js +6 -5
- package/dist/api-playground/ApiPlayground/Response/ResponseBody/CodeResponseContent.js +13 -12
- package/dist/api-playground/ApiPlayground/Response/ResponsePlaceholder.js +8 -7
- package/dist/api-playground/ApiPlayground/Response/ResponseTable.js +3 -2
- package/dist/api-playground/ApiPlayground/Response/ResponseTopbar.js +9 -8
- package/dist/api-playground/ApiPlayground/Response/index.js +4 -3
- package/dist/api-playground/ApiPlayground/components/AdditionalPropertyButton.js +42 -21
- package/dist/api-playground/ApiPlayground/components/ParamFieldWrapper.js +13 -9
- package/dist/api-playground/ApiPlayground/components/PlaygroundModalWrapper.js +7 -6
- package/dist/api-playground/ApiPlayground/components/SendPill.js +3 -2
- package/dist/api-playground/ApiPlayground/components/TypeDropdown.js +6 -5
- package/dist/api-playground/EndpointFields/ParamFields/ExampleDescription.js +3 -2
- package/dist/api-playground/EndpointFields/components/Description.js +6 -5
- package/dist/api-playground/EndpointFields/components/OptionDropdown.js +9 -8
- package/dist/api-playground/EndpointFields/components/SectionHeading.js +8 -7
- package/dist/api-playground-2/ApiExamples.js +19 -20
- package/dist/api-playground-2/ApiFields.js +20 -247
- package/dist/api-playground-2/EndpointHeader.js +59 -47
- package/dist/api-playground-2/OperationPage.js +70 -67
- package/dist/api-playground-2/Playground.js +67 -83
- package/dist/api-playground-2/SchemaPage.js +22 -9
- package/dist/api-playground-2/components/EndpointFields/Body.js +40 -0
- package/dist/api-playground-2/components/EndpointFields/Parameters.js +90 -0
- package/dist/api-playground-2/components/EndpointFields/Response.js +146 -0
- package/dist/api-playground-2/components/EndpointFields/Security.js +88 -0
- package/dist/api-playground-2/components/EndpointFields/fields/ArrayParamField.js +93 -0
- package/dist/api-playground-2/components/EndpointFields/fields/Enum.js +29 -11
- package/dist/api-playground-2/components/EndpointFields/fields/ObjectParamField.js +145 -0
- package/dist/api-playground-2/components/EndpointFields/fields/PrimitiveParamField.js +60 -48
- package/dist/api-playground-2/components/EndpointFields/fields/SchemaField.js +230 -0
- package/dist/api-playground-2/components/Example/GeneratedRequestExample.js +93 -89
- package/dist/api-playground-2/components/Example/GeneratedResponseExample.js +18 -17
- package/dist/api-playground-2/components/Example/RequestExample.js +92 -93
- package/dist/api-playground-2/components/Example/ResponseExample.js +19 -15
- package/dist/api-playground-2/components/Request/ParameterSection.js +20 -18
- package/dist/api-playground-2/components/Request/SecuritySection.js +53 -43
- package/dist/api-playground-2/components/Request/inputs/ArrayInput.js +89 -40
- package/dist/api-playground-2/components/Request/inputs/DifferentiatedInput.js +12 -12
- package/dist/api-playground-2/components/Request/inputs/FileInput.js +16 -15
- package/dist/api-playground-2/components/Request/inputs/InputContainer.js +76 -57
- package/dist/api-playground-2/components/Request/inputs/NumberInput.js +10 -9
- package/dist/api-playground-2/components/Request/inputs/ObjectInput.js +98 -80
- package/dist/api-playground-2/components/Request/inputs/OneOfInput.js +55 -47
- package/dist/api-playground-2/components/Request/inputs/SelectInput.js +18 -17
- package/dist/api-playground-2/components/Request/inputs/StringInput.js +19 -18
- package/dist/api-playground-2/components/Request/inputs/TextInput.js +12 -11
- package/dist/api-playground-2/components/SendPillWrapper.js +35 -0
- package/dist/api-playground-2/contexts/ApiPlaygroundContext.js +3 -5
- package/dist/api-playground-2/generators/createCookies.js +23 -0
- package/dist/api-playground-2/generators/createHeaders.js +53 -36
- package/dist/api-playground-2/generators/createQueryString.js +30 -0
- package/dist/api-playground-2/generators/generateAuthPlaceholder.js +14 -0
- package/dist/api-playground-2/generators/generateInteractiveCodeSample.js +27 -25
- package/dist/api-playground-2/generators/generateRequest.js +47 -51
- package/dist/api-playground-2/generators/generateResponseExampleMap.js +15 -11
- package/dist/api-playground-2/generators/generateSnippetMap.js +13 -11
- package/dist/api-playground-2/hooks/useCopyPathWithInputs.js +11 -11
- package/dist/api-playground-2/hooks/useInitializeInputs.js +185 -88
- package/dist/api-playground-2/hooks/usePlaygroundInputsStore.js +70 -25
- package/dist/api-playground-2/hooks/useSelectedBaseUrl.js +13 -0
- package/dist/api-playground-2/hooks/useSelectedExample.js +10 -0
- package/dist/api-playground-2/hooks/useSelectedRequestBodyContentType.js +12 -0
- package/dist/api-playground-2/hooks/useSelectedResponseContentType.js +12 -0
- package/dist/api-playground-2/hooks/useSelectedSecurityOption.js +31 -0
- package/dist/api-playground-2/hooks/useSendPlaygroundRequest.js +114 -101
- package/dist/api-playground-2/schemaGraph/addApiReferenceDataFromMdxAndDocsConfig.js +23 -32
- package/dist/api-playground-2/schemaGraph/addTypeLabelsToSchema.js +50 -0
- package/dist/api-playground-2/schemaGraph/addUniqueKeysToSchema.js +40 -24
- package/dist/api-playground-2/schemaGraph/getExampleBodyInputs.js +94 -0
- package/dist/api-playground-2/schemaGraph/getSchemaGraphOperationData.js +56 -50
- package/dist/api-playground-2/schemaGraph/processExamples.js +117 -52
- package/dist/api-playground-2/schemaGraph/processSchema.js +10 -0
- package/dist/api-playground-2/schemaGraph/processSecurityOptions.js +58 -28
- package/dist/api-playground-2/schemaGraph/reduceCompositions.js +220 -181
- package/dist/api-playground-2/schemaGraph/resolveOperationWithDependencies.js +128 -89
- package/dist/api-playground-2/schemaGraph/resolveSchemaWithDependencies.js +15 -16
- package/dist/api-playground-2/schemaGraph/sortSchemaByRequired.js +14 -12
- package/dist/api-playground-2/schemaGraph/utils.js +185 -147
- package/dist/common/guards.js +11 -19
- package/dist/components/Api/Expandable.js +10 -9
- package/dist/components/Api/Param.js +11 -13
- package/dist/components/Api/dropdown-menu.js +10 -9
- package/dist/components/apiPage.js +125 -0
- package/dist/components/content-components/code-group.js +4 -4
- package/dist/components/docsPage.js +54 -56
- package/dist/contexts/EndpointLocationContext.js +3 -3
- package/dist/hooks/useApiParamFieldOption.js +10 -0
- package/dist/hooks/useEndpoint.js +3 -3
- package/dist/hooks/useKeyboardShortcut.js +13 -13
- package/dist/hooks/useSendPlaygroundRequest.js +14 -146
- package/dist/index.d.ts +80 -60
- package/dist/index.js +99 -101
- package/dist/openapi/generateTypeStringFromSchema.js +2 -31
- package/dist/plugins/sanitize/rehype-pre-to-mdx-fence.js +13 -13
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/api-playground/ApiPlayground/Request/BodySection.js +0 -64
- package/dist/api-playground/ApiPlayground/Request/ParameterSection.js +0 -32
- package/dist/api-playground/ApiPlayground/Request/PlaygroundModal.js +0 -201
- package/dist/api-playground/ApiPlayground/Request/SecuritySection.js +0 -146
- package/dist/api-playground/ApiPlayground/Request/ServerSection.js +0 -30
- package/dist/api-playground/ApiPlayground/Request/index.js +0 -43
- package/dist/api-playground/ApiPlayground/Request/inputs/ArrayInput.js +0 -93
- package/dist/api-playground/ApiPlayground/Request/inputs/DifferentiatedInput.js +0 -90
- package/dist/api-playground/ApiPlayground/Request/inputs/FileInput.js +0 -62
- package/dist/api-playground/ApiPlayground/Request/inputs/NullInput.js +0 -33
- package/dist/api-playground/ApiPlayground/Request/inputs/NumberInput.js +0 -61
- package/dist/api-playground/ApiPlayground/Request/inputs/ObjectChildren.js +0 -109
- package/dist/api-playground/ApiPlayground/Request/inputs/ObjectInput.js +0 -87
- package/dist/api-playground/ApiPlayground/Request/inputs/RecursiveInput.js +0 -61
- package/dist/api-playground/ApiPlayground/Request/inputs/SelectInput.js +0 -54
- package/dist/api-playground/ApiPlayground/Request/inputs/StringInput.js +0 -67
- package/dist/api-playground/ApiPlayground/Request/inputs/TextInput.js +0 -44
- package/dist/api-playground/ApiPlayground/components/EndpointsMenu.js +0 -42
- package/dist/api-playground/ApiPlayground/components/EndpointsMenuLink.js +0 -43
- package/dist/api-playground/ApiPlayground/components/EndpointsMenuSearch.js +0 -38
- package/dist/api-playground/ApiPlayground/components/InputContainer.js +0 -128
- package/dist/api-playground/ApiPlayground/components/InputSectionContainer.js +0 -59
- package/dist/api-playground/ApiPlayground/components/PathHeader.js +0 -162
- package/dist/api-playground/ApiPlayground/components/TrashButton.js +0 -26
- package/dist/api-playground/ApiPlayground/index.js +0 -67
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/Enum.js +0 -19
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/NumberMetadata.js +0 -18
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/StringMetadata.js +0 -28
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/index.js +0 -5
- package/dist/api-playground/EndpointFields/ParamFields/RecursiveParamField.js +0 -13
- package/dist/api-playground/EndpointFields/index.js +0 -7
- package/dist/api-playground-2/components/EndpointFields/EndpointSecurity.js +0 -87
- package/dist/api-playground-2/components/EndpointFields/fields/SimpleArrayParamField.js +0 -89
- package/dist/api-playground-2/components/EndpointFields/fields/SimpleObjectParamField.js +0 -121
- package/dist/api-playground-2/components/EndpointFields/fields/SimplePrimitiveParamField.js +0 -74
- package/dist/api-playground-2/components/EndpointFields/fields/SimpleSchemaField.js +0 -252
- package/dist/common/potentiallyParseOpenApiString.js +0 -24
- package/dist/common/replaceSlashIndex.js +0 -6
- package/dist/common/slugToTitle.js +0 -10
- package/dist/constants/prism-languages.js +0 -19
- package/dist/contexts/ApiPlaygroundInputsContext.js +0 -17
- package/dist/contexts/MDXContentContext.js +0 -17
- package/dist/hooks/useApiPlaygroundInputs.js +0 -6
- package/dist/hooks/useApiPlaygroundPrefillExamples.js +0 -39
- package/dist/hooks/useBaseUrlOptions.js +0 -18
- package/dist/hooks/useComponentSchemas.js +0 -9
- package/dist/hooks/useGenerateNextAdditionalProperties.js +0 -11
- package/dist/hooks/useGenerateNextItems.js +0 -11
- package/dist/hooks/useGenerateNextProperties.js +0 -11
- package/dist/hooks/useMDXContent.js +0 -6
- package/dist/hooks/useMDXContentController/useApiPlaygroundInputs.js +0 -9
- package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiBaseIndexCallback.js +0 -15
- package/dist/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiPlaygroundInputsCallback.js +0 -15
- package/dist/hooks/usePlaygroundSchemaOptions.js +0 -42
- package/dist/hooks/usePrefilledInputs/index.js +0 -65
- package/dist/hooks/usePrefilledInputs/storedServerVariables.js +0 -29
- package/dist/hooks/useSecurityOption.js +0 -10
- package/dist/hooks/useSetDefaultValue.js +0 -63
- package/dist/openapi/filterEnums.js +0 -20
- package/dist/openapi/generateNextAdditionalProperties.js +0 -7
- package/dist/openapi/generateNextItems.js +0 -7
- package/dist/openapi/generateNextProperties.js +0 -23
- package/dist/openapi/generateOptionLabels.js +0 -20
- package/dist/openapi/generateSimpleLabels.js +0 -4
- package/dist/openapi/getAuthFilteredSchemaArray.js +0 -18
- package/dist/paths/isEqualIgnoringLeadingSlash.js +0 -21
- package/dist/paths/optionallyRemoveLeadingSlash.js +0 -6
- package/dist/paths/optionallyRemoveTrailingSlash.js +0 -6
- package/dist/utils/api-playground/defaults.js +0 -15
- package/dist/utils/api-playground/paramFieldDefaults.js +0 -10
- package/dist/utils/api-reference/getFilteredSecurityOptions.js +0 -4
- package/dist/utils/api-reference/getNextPropertiesByType.js +0 -5
- package/dist/utils/flattenObject.js +0 -10
|
@@ -1,282 +1,321 @@
|
|
|
1
|
-
import { MAX_SCHEMA_COMBINATION_SIZE as
|
|
2
|
-
import { handleExistingError as
|
|
3
|
-
import { flattenSchemaOneOfs as
|
|
4
|
-
function
|
|
1
|
+
import { MAX_SCHEMA_COMBINATION_SIZE as w } from "../constants/index.js";
|
|
2
|
+
import { handleExistingError as c, ImpossibleSchemaError as v } from "./errors.js";
|
|
3
|
+
import { flattenSchemaOneOfs as L, isCircularRef as b, shouldTruncateForSize as C, createEmptyReducedSchema as I, createUnknownReducedSchema as $, combine as y, takeLast as O, isReducedSchema as A } from "./utils.js";
|
|
4
|
+
function B({
|
|
5
5
|
schema: e,
|
|
6
|
-
depth:
|
|
7
|
-
location:
|
|
8
|
-
flattenOneOfs:
|
|
6
|
+
depth: t,
|
|
7
|
+
location: i,
|
|
8
|
+
flattenOneOfs: o = !0
|
|
9
9
|
}) {
|
|
10
|
-
const l =
|
|
10
|
+
const l = m({
|
|
11
11
|
schema: e,
|
|
12
|
-
depth:
|
|
13
|
-
location:
|
|
12
|
+
depth: t,
|
|
13
|
+
location: i,
|
|
14
14
|
safeParse: !1,
|
|
15
15
|
path: ["#"]
|
|
16
16
|
});
|
|
17
|
-
return
|
|
17
|
+
return o ? L(l) : l;
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function m({
|
|
20
20
|
schema: e,
|
|
21
|
-
depth:
|
|
22
|
-
location:
|
|
23
|
-
safeParse:
|
|
21
|
+
depth: t,
|
|
22
|
+
location: i,
|
|
23
|
+
safeParse: o = !1,
|
|
24
24
|
path: l = ["#"]
|
|
25
25
|
}) {
|
|
26
26
|
try {
|
|
27
|
-
if (
|
|
27
|
+
if (typeof e == "boolean")
|
|
28
|
+
return { oneOf: [{}] };
|
|
29
|
+
if (typeof e != "object")
|
|
30
|
+
return { oneOf: [{ type: "any" }] };
|
|
31
|
+
if (b(e))
|
|
28
32
|
return { oneOf: [e] };
|
|
29
|
-
if (
|
|
33
|
+
if (C(e))
|
|
30
34
|
return { oneOf: [{ type: "any" }] };
|
|
31
|
-
if (e.oneOf && e.oneOf.length > 0 ? e.oneOf =
|
|
35
|
+
if (e.oneOf && e.oneOf.length > 0 ? e.oneOf = j({
|
|
32
36
|
schemaArray: e.oneOf,
|
|
33
|
-
depth:
|
|
34
|
-
location:
|
|
37
|
+
depth: t,
|
|
38
|
+
location: i,
|
|
35
39
|
path: [...l, "oneOf"]
|
|
36
|
-
}) : e.oneOf = [], e.anyOf && e.anyOf.length > 0 && (e.anyOf =
|
|
40
|
+
}) : e.oneOf = [], e.anyOf && e.anyOf.length > 0 && (e.anyOf = j({
|
|
37
41
|
schemaArray: e.anyOf,
|
|
38
|
-
depth:
|
|
39
|
-
location:
|
|
42
|
+
depth: t,
|
|
43
|
+
location: i,
|
|
40
44
|
path: [...l, "anyOf"]
|
|
41
45
|
})), e.allOf && e.allOf.length > 0) {
|
|
42
|
-
const
|
|
43
|
-
(
|
|
44
|
-
schema:
|
|
45
|
-
depth:
|
|
46
|
-
location:
|
|
47
|
-
safeParse:
|
|
48
|
-
path: [...l, "allOf",
|
|
46
|
+
const u = e.allOf.map(
|
|
47
|
+
(n, d) => m({
|
|
48
|
+
schema: n,
|
|
49
|
+
depth: t + 1,
|
|
50
|
+
location: i,
|
|
51
|
+
safeParse: o,
|
|
52
|
+
path: [...l, "allOf", d.toString()]
|
|
49
53
|
})
|
|
50
54
|
).reduce(
|
|
51
|
-
(
|
|
52
|
-
|
|
55
|
+
(n, d) => M(n, d, t + 1),
|
|
56
|
+
I()
|
|
53
57
|
);
|
|
54
|
-
e.oneOf =
|
|
58
|
+
e.oneOf = g(e.oneOf, u.oneOf, t);
|
|
55
59
|
}
|
|
56
60
|
if (e.properties)
|
|
57
|
-
for (const
|
|
58
|
-
const
|
|
59
|
-
if (
|
|
60
|
-
e.properties[
|
|
61
|
+
for (const u in e.properties) {
|
|
62
|
+
const n = e.properties[u];
|
|
63
|
+
if (b(n)) {
|
|
64
|
+
e.properties[u] = { oneOf: [n] };
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
if (typeof n == "boolean") {
|
|
68
|
+
e.properties[u] = { oneOf: [{}] };
|
|
61
69
|
continue;
|
|
62
70
|
}
|
|
63
|
-
if (
|
|
64
|
-
delete e.properties[
|
|
71
|
+
if (typeof n == "object" && (n.readOnly && i === "request" || n.writeOnly && i === "response")) {
|
|
72
|
+
delete e.properties[u];
|
|
65
73
|
continue;
|
|
66
74
|
}
|
|
67
|
-
const
|
|
75
|
+
const d = [...l, "properties", u];
|
|
68
76
|
try {
|
|
69
|
-
e.properties[
|
|
70
|
-
schema:
|
|
71
|
-
depth:
|
|
72
|
-
location:
|
|
73
|
-
safeParse:
|
|
74
|
-
path:
|
|
77
|
+
e.properties[u] = m({
|
|
78
|
+
schema: n,
|
|
79
|
+
depth: t + 1,
|
|
80
|
+
location: i,
|
|
81
|
+
safeParse: o,
|
|
82
|
+
path: d
|
|
75
83
|
});
|
|
76
|
-
} catch (
|
|
77
|
-
|
|
84
|
+
} catch (s) {
|
|
85
|
+
c(s, d, o, "error reducing property schema"), e.properties[u] = { oneOf: [{}] };
|
|
78
86
|
}
|
|
79
87
|
}
|
|
80
|
-
if ("items" in e && e.items && !
|
|
88
|
+
if ("items" in e && e.items && !b(e.items))
|
|
81
89
|
try {
|
|
82
|
-
e.items =
|
|
90
|
+
e.items = m({
|
|
83
91
|
schema: e.items,
|
|
84
|
-
depth:
|
|
85
|
-
location:
|
|
86
|
-
safeParse:
|
|
92
|
+
depth: t + 1,
|
|
93
|
+
location: i,
|
|
94
|
+
safeParse: o,
|
|
87
95
|
path: [...l, "items"]
|
|
88
96
|
});
|
|
89
|
-
} catch (
|
|
90
|
-
|
|
97
|
+
} catch (u) {
|
|
98
|
+
c(u, [...l, "items"], o, "error reducing items schema"), e.items = $();
|
|
91
99
|
}
|
|
92
|
-
if (e.additionalProperties && typeof e.additionalProperties == "object" && !
|
|
100
|
+
if (e.additionalProperties && typeof e.additionalProperties == "object" && !b(e.additionalProperties))
|
|
93
101
|
try {
|
|
94
|
-
e.additionalProperties =
|
|
102
|
+
e.additionalProperties = m({
|
|
95
103
|
schema: e.additionalProperties,
|
|
96
|
-
depth:
|
|
97
|
-
location:
|
|
98
|
-
safeParse:
|
|
104
|
+
depth: t + 1,
|
|
105
|
+
location: i,
|
|
106
|
+
safeParse: o,
|
|
99
107
|
path: [...l, "additionalProperties"]
|
|
100
108
|
});
|
|
101
|
-
} catch (
|
|
102
|
-
e.additionalProperties = !(
|
|
109
|
+
} catch (u) {
|
|
110
|
+
e.additionalProperties = !(u instanceof v);
|
|
103
111
|
}
|
|
104
|
-
e.anyOf && e.anyOf.length > 0 && (e.oneOf =
|
|
105
|
-
const
|
|
112
|
+
e.anyOf && e.anyOf.length > 0 && (e.oneOf = g(e.oneOf, e.anyOf, t));
|
|
113
|
+
const p = T(e);
|
|
106
114
|
return {
|
|
107
|
-
oneOf:
|
|
115
|
+
oneOf: g(e.oneOf, p, t, !0)
|
|
108
116
|
};
|
|
109
|
-
} catch (
|
|
110
|
-
return
|
|
117
|
+
} catch (p) {
|
|
118
|
+
return p instanceof Error && console.error("Error processing schema:", p.message), { oneOf: [{ type: "any" }] };
|
|
111
119
|
}
|
|
112
120
|
}
|
|
113
|
-
function
|
|
121
|
+
function q(e, t, i = !1) {
|
|
122
|
+
if (e.description && t.description && !t.discriminator) {
|
|
123
|
+
const o = e.type === "object" && t.type === "object", l = e.type && t.type && typeof e.type == "string" && typeof t.type == "string" && e.type === t.type;
|
|
124
|
+
if (o || l)
|
|
125
|
+
return i ? `${t.description}
|
|
126
|
+
${e.description}` : `${e.description}
|
|
127
|
+
${t.description}`;
|
|
128
|
+
}
|
|
129
|
+
return O(e, t, "description");
|
|
130
|
+
}
|
|
131
|
+
function j({
|
|
114
132
|
schemaArray: e,
|
|
115
|
-
depth:
|
|
116
|
-
location:
|
|
117
|
-
path:
|
|
133
|
+
depth: t,
|
|
134
|
+
location: i,
|
|
135
|
+
path: o = ["#"]
|
|
118
136
|
}) {
|
|
119
|
-
const l = e.flatMap((
|
|
137
|
+
const l = e.flatMap((p, u) => {
|
|
120
138
|
try {
|
|
121
|
-
return
|
|
122
|
-
schema:
|
|
123
|
-
depth:
|
|
124
|
-
location:
|
|
139
|
+
return m({
|
|
140
|
+
schema: p,
|
|
141
|
+
depth: t + 1,
|
|
142
|
+
location: i,
|
|
125
143
|
safeParse: !1,
|
|
126
|
-
path: [...
|
|
144
|
+
path: [...o, u.toString()]
|
|
127
145
|
}).oneOf;
|
|
128
|
-
} catch (
|
|
129
|
-
if (
|
|
146
|
+
} catch (n) {
|
|
147
|
+
if (n instanceof v)
|
|
130
148
|
return [];
|
|
131
|
-
throw
|
|
149
|
+
throw n;
|
|
132
150
|
}
|
|
133
151
|
});
|
|
134
152
|
if (l.length === 0)
|
|
135
|
-
throw new
|
|
153
|
+
throw new v(o, "no valid options in schema");
|
|
136
154
|
return l;
|
|
137
155
|
}
|
|
138
|
-
function
|
|
139
|
-
if (e.length *
|
|
156
|
+
function g(e, t, i, o = !1) {
|
|
157
|
+
if (e.length * t.length > w)
|
|
140
158
|
return [{}];
|
|
141
|
-
if (e.length === 0 &&
|
|
159
|
+
if (e.length === 0 && t.length === 0)
|
|
142
160
|
return [{}];
|
|
143
161
|
if (e.length === 0)
|
|
144
|
-
return
|
|
145
|
-
if (
|
|
162
|
+
return t;
|
|
163
|
+
if (t.length === 0)
|
|
146
164
|
return e;
|
|
147
|
-
const
|
|
165
|
+
const p = e.flatMap((u) => t.flatMap((n) => {
|
|
148
166
|
try {
|
|
149
|
-
return [
|
|
150
|
-
|
|
151
|
-
|
|
167
|
+
return [R(
|
|
168
|
+
u,
|
|
169
|
+
n,
|
|
170
|
+
i + 1,
|
|
171
|
+
o
|
|
172
|
+
)];
|
|
173
|
+
} catch (d) {
|
|
174
|
+
if (d instanceof v)
|
|
152
175
|
return [];
|
|
153
|
-
throw
|
|
176
|
+
throw d;
|
|
154
177
|
}
|
|
155
178
|
}));
|
|
156
|
-
return
|
|
179
|
+
return p.length, p;
|
|
157
180
|
}
|
|
158
|
-
function
|
|
181
|
+
function M(e, t, i) {
|
|
159
182
|
return {
|
|
160
|
-
oneOf:
|
|
183
|
+
oneOf: g(
|
|
161
184
|
e.oneOf ?? [],
|
|
162
|
-
|
|
163
|
-
|
|
185
|
+
t.oneOf ?? [],
|
|
186
|
+
i,
|
|
187
|
+
!1
|
|
164
188
|
)
|
|
165
189
|
};
|
|
166
190
|
}
|
|
167
|
-
function
|
|
168
|
-
let
|
|
169
|
-
if (
|
|
170
|
-
throw new
|
|
171
|
-
for (const
|
|
172
|
-
typeof
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
191
|
+
function R(e, t, i, o = !1) {
|
|
192
|
+
let l = e.type, p = t.type;
|
|
193
|
+
if (l === "integer" && p === "number" ? p = "integer" : l === "number" && p === "integer" && (l = "integer"), l && p && l !== p)
|
|
194
|
+
throw new v([], `mismatched type in composition: "${l}" "${p}"`);
|
|
195
|
+
for (const r of [e, t])
|
|
196
|
+
typeof r.exclusiveMaximum == "number" && (r.maximum === void 0 || r.maximum >= r.exclusiveMaximum ? (r.maximum = r.exclusiveMaximum, r.exclusiveMaximum = !0) : r.exclusiveMaximum = void 0), typeof r.exclusiveMinimum == "number" && (r.minimum === void 0 || r.minimum <= r.exclusiveMinimum ? (r.minimum = r.exclusiveMinimum, r.exclusiveMinimum = !0) : r.exclusiveMinimum = void 0);
|
|
197
|
+
const u = q(
|
|
198
|
+
e,
|
|
199
|
+
t,
|
|
200
|
+
o
|
|
201
|
+
), n = {
|
|
202
|
+
title: O(e, t, "title"),
|
|
203
|
+
description: u,
|
|
204
|
+
format: O(e, t, "format"),
|
|
205
|
+
default: O(e, t, "default"),
|
|
206
|
+
multipleOf: y(e, t, "multipleOf", D),
|
|
207
|
+
maximum: y(e, t, "maximum", Math.min),
|
|
208
|
+
minimum: y(e, t, "minimum", Math.max),
|
|
209
|
+
maxLength: y(e, t, "maxLength", Math.min),
|
|
210
|
+
minLength: y(e, t, "minLength", Math.max),
|
|
211
|
+
pattern: O(e, t, "pattern"),
|
|
212
|
+
maxItems: y(e, t, "maxItems", Math.min),
|
|
213
|
+
minItems: y(e, t, "minItems", Math.max),
|
|
214
|
+
uniqueItems: O(e, t, "uniqueItems"),
|
|
215
|
+
maxProperties: y(e, t, "maxProperties", Math.min),
|
|
216
|
+
minProperties: y(e, t, "minProperties", Math.max),
|
|
217
|
+
required: y(
|
|
190
218
|
e,
|
|
191
|
-
|
|
219
|
+
t,
|
|
192
220
|
"required",
|
|
193
|
-
(
|
|
221
|
+
(r, f) => f.concat(r.filter((a) => !f.includes(a)))
|
|
194
222
|
),
|
|
195
|
-
enum:
|
|
196
|
-
const:
|
|
197
|
-
readOnly: e.readOnly &&
|
|
198
|
-
writeOnly: e.writeOnly &&
|
|
199
|
-
deprecated: e.deprecated ||
|
|
223
|
+
enum: y(e, t, "enum", (r, f) => f.filter((a) => r.includes(a))),
|
|
224
|
+
const: y(e, t, "const", (r, f) => f ?? r),
|
|
225
|
+
readOnly: e.readOnly && t.readOnly,
|
|
226
|
+
writeOnly: e.writeOnly && t.writeOnly,
|
|
227
|
+
deprecated: e.deprecated || t.deprecated
|
|
200
228
|
};
|
|
201
|
-
for (const
|
|
202
|
-
Object.keys(
|
|
203
|
-
f.startsWith("x-") && (
|
|
229
|
+
for (const r of [e, t])
|
|
230
|
+
Object.keys(r).forEach((f) => {
|
|
231
|
+
f.startsWith("x-") && (n[f] = O(
|
|
204
232
|
e,
|
|
205
|
-
|
|
233
|
+
t,
|
|
206
234
|
f
|
|
207
235
|
));
|
|
208
236
|
});
|
|
209
|
-
Object.entries(
|
|
210
|
-
f === void 0 && delete
|
|
237
|
+
Object.entries(n).forEach(([r, f]) => {
|
|
238
|
+
f === void 0 && delete n[r];
|
|
211
239
|
});
|
|
212
|
-
const d =
|
|
213
|
-
d !== void 0 && (
|
|
214
|
-
const
|
|
215
|
-
if (
|
|
216
|
-
|
|
240
|
+
const d = z(e, t);
|
|
241
|
+
d !== void 0 && (n.example = d), n.maximum !== void 0 && (n.exclusiveMaximum = (e.maximum === n.maximum ? e.exclusiveMaximum : void 0) || (t.maximum === n.maximum ? t.exclusiveMaximum : void 0)), n.minimum !== void 0 && (n.exclusiveMinimum = (e.minimum === n.minimum ? e.exclusiveMinimum : void 0) || (t.minimum === n.minimum ? t.exclusiveMinimum : void 0));
|
|
242
|
+
const s = l ?? p;
|
|
243
|
+
if (s === "array") {
|
|
244
|
+
let r = {};
|
|
245
|
+
"items" in e && e.items !== void 0 && (typeof e.items == "boolean" ? r = { oneOf: [{}] } : typeof e.items == "object" && (r = e.items));
|
|
246
|
+
let f = {};
|
|
247
|
+
return "items" in t && t.items !== void 0 && (typeof t.items == "boolean" ? f = { oneOf: [{}] } : typeof t.items == "object" && (f = t.items)), {
|
|
217
248
|
type: "array",
|
|
218
|
-
items:
|
|
219
|
-
|
|
220
|
-
"items" in i && i.items ? i.items : {},
|
|
221
|
-
r + 1
|
|
222
|
-
),
|
|
223
|
-
...o
|
|
249
|
+
items: M(r, f, i + 1),
|
|
250
|
+
...n
|
|
224
251
|
};
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
252
|
+
}
|
|
253
|
+
if (e.properties && t.properties) {
|
|
254
|
+
const r = { ...e.properties };
|
|
255
|
+
Object.entries(t.properties).forEach(([f, a]) => {
|
|
256
|
+
let x = a;
|
|
257
|
+
typeof a == "boolean" && (x = { oneOf: [{}] });
|
|
258
|
+
const S = r[f];
|
|
259
|
+
if (S) {
|
|
260
|
+
let P = S;
|
|
261
|
+
typeof S == "boolean" && (P = { oneOf: [{}] }), typeof x == "object" && typeof P == "object" ? r[f] = M(
|
|
262
|
+
P,
|
|
263
|
+
x,
|
|
264
|
+
i + 1
|
|
265
|
+
) : r[f] = x;
|
|
266
|
+
} else
|
|
267
|
+
r[f] = x;
|
|
268
|
+
}), n.properties = r;
|
|
269
|
+
} else (e.properties || t.properties) && (n.properties = {
|
|
232
270
|
...e.properties,
|
|
233
|
-
...
|
|
271
|
+
...t.properties
|
|
234
272
|
});
|
|
235
|
-
if (e.additionalProperties === !1 ||
|
|
236
|
-
|
|
273
|
+
if (e.additionalProperties === !1 || t.additionalProperties === !1)
|
|
274
|
+
n.additionalProperties = !1;
|
|
237
275
|
else {
|
|
238
|
-
const
|
|
239
|
-
|
|
240
|
-
|
|
276
|
+
const r = A(e.additionalProperties) ? e.additionalProperties : void 0, f = A(t.additionalProperties) ? t.additionalProperties : void 0;
|
|
277
|
+
r && f ? n.additionalProperties = M(
|
|
278
|
+
r,
|
|
241
279
|
f,
|
|
242
|
-
|
|
243
|
-
) :
|
|
280
|
+
i + 1
|
|
281
|
+
) : r ? n.additionalProperties = r : f ? n.additionalProperties = f : (e.additionalProperties === !0 || t.additionalProperties === !0) && (n.additionalProperties = !0);
|
|
244
282
|
}
|
|
245
|
-
return
|
|
283
|
+
return s ? { type: s, ...n } : n;
|
|
246
284
|
}
|
|
247
|
-
function
|
|
285
|
+
function T(e) {
|
|
248
286
|
if (e.nullable) {
|
|
249
|
-
const
|
|
250
|
-
delete
|
|
251
|
-
const
|
|
252
|
-
return delete
|
|
287
|
+
const i = { ...e };
|
|
288
|
+
delete i.oneOf, delete i.anyOf, delete i.allOf, delete i.nullable;
|
|
289
|
+
const o = { ...e };
|
|
290
|
+
return delete o.oneOf, delete o.anyOf, delete o.allOf, delete o.nullable, o.type = "null", [i, o];
|
|
253
291
|
}
|
|
254
292
|
if (Array.isArray(e.type)) {
|
|
255
293
|
if (e.type.length === 0) {
|
|
256
|
-
const
|
|
257
|
-
return delete
|
|
294
|
+
const i = { ...e };
|
|
295
|
+
return delete i.oneOf, delete i.anyOf, delete i.allOf, delete i.type, [i];
|
|
258
296
|
}
|
|
259
|
-
return e.type.map((
|
|
260
|
-
const
|
|
261
|
-
return delete
|
|
297
|
+
return e.type.map((i) => {
|
|
298
|
+
const o = { ...e };
|
|
299
|
+
return delete o.oneOf, delete o.anyOf, delete o.allOf, o.type = i, o;
|
|
262
300
|
});
|
|
263
301
|
}
|
|
264
|
-
const
|
|
265
|
-
return delete
|
|
302
|
+
const t = { ...e };
|
|
303
|
+
return delete t.oneOf, delete t.anyOf, delete t.allOf, [t];
|
|
266
304
|
}
|
|
267
|
-
function
|
|
268
|
-
const
|
|
269
|
-
return l &&
|
|
305
|
+
function z(e, t) {
|
|
306
|
+
const i = "examples" in e ? e.examples : void 0, o = "examples" in t ? t.examples : void 0, l = (i == null ? void 0 : i[0]) !== void 0 ? i[0] : e.example, p = (o == null ? void 0 : o[0]) !== void 0 ? o[0] : t.example;
|
|
307
|
+
return l && p && typeof l == "object" && typeof p == "object" && !Array.isArray(l) && !Array.isArray(p) ? {
|
|
270
308
|
...l,
|
|
271
|
-
...
|
|
272
|
-
} :
|
|
309
|
+
...p
|
|
310
|
+
} : p !== void 0 ? p : l;
|
|
273
311
|
}
|
|
274
|
-
function
|
|
275
|
-
return Math.abs(e *
|
|
312
|
+
function D(e, t) {
|
|
313
|
+
return Math.abs(e * t) / E(e, t);
|
|
276
314
|
}
|
|
277
|
-
function
|
|
278
|
-
return
|
|
315
|
+
function E(e, t) {
|
|
316
|
+
return t === 0 ? e : E(t, e % t);
|
|
279
317
|
}
|
|
280
318
|
export {
|
|
281
|
-
|
|
319
|
+
q as getCombinedDescription,
|
|
320
|
+
B as reduceExpandedSchema
|
|
282
321
|
};
|