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