@scalar/api-reference 1.29.3 → 1.31.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.
Files changed (159) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/README.md +13 -114
  3. package/dist/browser/standalone.js +6525 -6416
  4. package/dist/browser/webpack-stats.json +1 -1
  5. package/dist/components/ApiReferenceLayout.vue.d.ts.map +1 -1
  6. package/dist/components/ApiReferenceLayout.vue.js +1 -1
  7. package/dist/components/ApiReferenceLayout.vue2.js +164 -181
  8. package/dist/components/Content/ClientLibraries/ClientLibraries.vue.d.ts.map +1 -1
  9. package/dist/components/Content/ClientLibraries/ClientLibraries.vue.js +2 -2
  10. package/dist/components/Content/ClientLibraries/ClientLibraries.vue2.js +56 -51
  11. package/dist/components/Content/Content.vue.d.ts.map +1 -1
  12. package/dist/components/Content/Content.vue.js +1 -1
  13. package/dist/components/Content/Content.vue2.js +5 -5
  14. package/dist/components/Content/Introduction/Introduction.vue.d.ts +2 -2
  15. package/dist/components/Content/Introduction/Introduction.vue.d.ts.map +1 -1
  16. package/dist/components/Content/Introduction/Introduction.vue.js +2 -2
  17. package/dist/components/Content/Introduction/Introduction.vue2.js +57 -63
  18. package/dist/components/Content/Lazy/Loading.vue.d.ts.map +1 -1
  19. package/dist/components/Content/Lazy/Loading.vue.js +46 -46
  20. package/dist/components/Content/Models/Models.vue.d.ts +2 -2
  21. package/dist/components/Content/Models/Models.vue.d.ts.map +1 -1
  22. package/dist/components/Content/Models/Models.vue.js +2 -2
  23. package/dist/components/Content/Models/Models.vue2.js +7 -6
  24. package/dist/components/Content/Models/ModelsAccordion.vue.d.ts +2 -2
  25. package/dist/components/Content/Models/ModelsAccordion.vue.d.ts.map +1 -1
  26. package/dist/components/Content/Models/ModelsAccordion.vue.js +2 -2
  27. package/dist/components/Content/Schema/Schema.preview.d.ts +98 -56
  28. package/dist/components/Content/Schema/Schema.preview.d.ts.map +1 -1
  29. package/dist/components/Content/Schema/Schema.vue.d.ts +6 -3
  30. package/dist/components/Content/Schema/Schema.vue.d.ts.map +1 -1
  31. package/dist/components/Content/Schema/Schema.vue.js +1 -1
  32. package/dist/components/Content/Schema/Schema.vue2.js +140 -97
  33. package/dist/components/Content/Schema/SchemaComposition.vue.d.ts +2 -2
  34. package/dist/components/Content/Schema/SchemaComposition.vue.d.ts.map +1 -1
  35. package/dist/components/Content/Schema/SchemaComposition.vue.js +57 -53
  36. package/dist/components/Content/Schema/SchemaDiscriminator.vue.d.ts +13 -0
  37. package/dist/components/Content/Schema/SchemaDiscriminator.vue.d.ts.map +1 -0
  38. package/dist/components/Content/Schema/SchemaDiscriminator.vue.js +49 -0
  39. package/dist/components/Content/Schema/SchemaDiscriminator.vue2.js +4 -0
  40. package/dist/components/Content/Schema/SchemaHeading.vue.d.ts +2 -2
  41. package/dist/components/Content/Schema/SchemaHeading.vue.d.ts.map +1 -1
  42. package/dist/components/Content/Schema/SchemaHeading.vue.js +1 -1
  43. package/dist/components/Content/Schema/SchemaProperty.vue.d.ts +4 -2
  44. package/dist/components/Content/Schema/SchemaProperty.vue.d.ts.map +1 -1
  45. package/dist/components/Content/Schema/SchemaProperty.vue.js +2 -2
  46. package/dist/components/Content/Schema/SchemaProperty.vue2.js +40 -38
  47. package/dist/components/Content/Schema/SchemaPropertyHeading.vue.d.ts +3 -2
  48. package/dist/components/Content/Schema/SchemaPropertyHeading.vue.d.ts.map +1 -1
  49. package/dist/components/Content/Schema/SchemaPropertyHeading.vue.js +2 -2
  50. package/dist/components/Content/Schema/SchemaPropertyHeading.vue2.js +147 -143
  51. package/dist/components/Content/Schema/helpers/merge-all-of-schemas.d.ts +2 -2
  52. package/dist/components/Content/Schema/helpers/merge-all-of-schemas.d.ts.map +1 -1
  53. package/dist/components/Content/Schema/helpers/schema-discriminator.d.ts +9 -1
  54. package/dist/components/Content/Schema/helpers/schema-discriminator.d.ts.map +1 -1
  55. package/dist/components/Content/Schema/helpers/schema-discriminator.js +45 -0
  56. package/dist/components/Content/Tag/TagList.vue.d.ts +2 -2
  57. package/dist/components/Content/Tag/TagList.vue.d.ts.map +1 -1
  58. package/dist/components/DocumentSelector/DocumentSelector.vue.js +3 -3
  59. package/dist/components/Layouts/ClassicLayout.vue.js +10 -8
  60. package/dist/components/Layouts/Layouts.vue.js +11 -9
  61. package/dist/components/Layouts/ModernLayout.vue2.js +22 -20
  62. package/dist/components/Section/SectionHeader.vue.d.ts.map +1 -1
  63. package/dist/components/Section/SectionHeader.vue.js +2 -2
  64. package/dist/components/Section/SectionHeaderTag.vue.d.ts.map +1 -1
  65. package/dist/components/Section/SectionHeaderTag.vue.js +2 -2
  66. package/dist/components/Sidebar/Sidebar.vue.d.ts.map +1 -1
  67. package/dist/components/Sidebar/Sidebar.vue.js +2 -2
  68. package/dist/components/Sidebar/Sidebar.vue2.js +56 -56
  69. package/dist/components/SingleApiReference.vue.d.ts.map +1 -1
  70. package/dist/components/SingleApiReference.vue.js +27 -33
  71. package/dist/esm.d.ts.map +1 -1
  72. package/dist/features/ApiClientModal/ApiClientModal.vue.d.ts +2 -2
  73. package/dist/features/ApiClientModal/ApiClientModal.vue.d.ts.map +1 -1
  74. package/dist/features/ApiClientModal/ApiClientModal.vue.js +49 -50
  75. package/dist/features/ApiClientModal/useApiClient.d.ts +224 -204
  76. package/dist/features/ApiClientModal/useApiClient.d.ts.map +1 -1
  77. package/dist/features/DocumentSource/hooks/useDocumentFetcher.d.ts +11 -0
  78. package/dist/features/DocumentSource/hooks/useDocumentFetcher.d.ts.map +1 -0
  79. package/dist/features/DocumentSource/hooks/useDocumentFetcher.js +38 -0
  80. package/dist/features/DocumentSource/hooks/useDocumentSource.d.ts +21 -0
  81. package/dist/features/DocumentSource/hooks/useDocumentSource.d.ts.map +1 -0
  82. package/dist/features/DocumentSource/hooks/useDocumentSource.js +94 -0
  83. package/dist/features/DocumentSource/index.d.ts +2 -0
  84. package/dist/features/DocumentSource/index.d.ts.map +1 -0
  85. package/dist/features/DownloadLink/DownloadLink.vue.d.ts +1 -1
  86. package/dist/features/DownloadLink/DownloadLink.vue.d.ts.map +1 -1
  87. package/dist/features/DownloadLink/DownloadLink.vue.js +1 -1
  88. package/dist/features/DownloadLink/DownloadLink.vue2.js +18 -17
  89. package/dist/features/DownloadLink/index.d.ts +1 -0
  90. package/dist/features/DownloadLink/index.d.ts.map +1 -1
  91. package/dist/features/DownloadLink/openapi-version-symbol.d.ts +2 -0
  92. package/dist/features/DownloadLink/openapi-version-symbol.d.ts.map +1 -0
  93. package/dist/features/DownloadLink/openapi-version-symbol.js +4 -0
  94. package/dist/features/Operation/Operation.vue.d.ts +2 -2
  95. package/dist/features/Operation/Operation.vue.d.ts.map +1 -1
  96. package/dist/features/Operation/components/OperationParameters.vue.d.ts +2 -2
  97. package/dist/features/Operation/components/OperationParameters.vue.d.ts.map +1 -1
  98. package/dist/features/Operation/components/OperationResponses.vue.d.ts +2 -2
  99. package/dist/features/Operation/components/OperationResponses.vue.d.ts.map +1 -1
  100. package/dist/features/Operation/components/ParameterHeaders.vue.d.ts +2 -2
  101. package/dist/features/Operation/components/ParameterHeaders.vue.d.ts.map +1 -1
  102. package/dist/features/Operation/components/ParameterHeaders.vue.js +2 -2
  103. package/dist/features/Operation/components/ParameterList.vue.d.ts +2 -2
  104. package/dist/features/Operation/components/ParameterList.vue.d.ts.map +1 -1
  105. package/dist/features/Operation/components/ParameterList.vue.js +2 -2
  106. package/dist/features/Operation/components/ParameterListItem.vue.d.ts +2 -2
  107. package/dist/features/Operation/components/ParameterListItem.vue.d.ts.map +1 -1
  108. package/dist/features/Operation/components/ParameterListItem.vue.js +3 -3
  109. package/dist/features/Operation/components/ParameterListItem.vue2.js +6 -6
  110. package/dist/features/Operation/components/RequestBody.vue.d.ts +2 -2
  111. package/dist/features/Operation/components/RequestBody.vue.d.ts.map +1 -1
  112. package/dist/features/Operation/components/RequestBody.vue.js +2 -2
  113. package/dist/features/Operation/components/callbacks/Callback.vue.d.ts +14 -0
  114. package/dist/features/Operation/components/callbacks/Callback.vue.d.ts.map +1 -0
  115. package/dist/features/Operation/components/callbacks/Callback.vue.js +7 -0
  116. package/dist/features/Operation/components/callbacks/Callback.vue2.js +62 -0
  117. package/dist/features/Operation/components/callbacks/Callbacks.vue.d.ts +10 -0
  118. package/dist/features/Operation/components/callbacks/Callbacks.vue.d.ts.map +1 -0
  119. package/dist/features/Operation/components/callbacks/Callbacks.vue.js +30 -0
  120. package/dist/features/Operation/components/callbacks/Callbacks.vue2.js +4 -0
  121. package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts +2 -2
  122. package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts.map +1 -1
  123. package/dist/features/Operation/layouts/ClassicLayout.vue.js +2 -2
  124. package/dist/features/Operation/layouts/ClassicLayout.vue2.js +55 -55
  125. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts +2 -2
  126. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts.map +1 -1
  127. package/dist/features/Operation/layouts/ModernLayout.vue.js +1 -1
  128. package/dist/features/Operation/layouts/ModernLayout.vue2.js +94 -79
  129. package/dist/features/Operation/types/schemas.d.ts +3 -0
  130. package/dist/features/Operation/types/schemas.d.ts.map +1 -0
  131. package/dist/features/Search/SearchButton.vue.js +2 -2
  132. package/dist/helpers/local-storage.d.ts +8 -0
  133. package/dist/helpers/local-storage.d.ts.map +1 -0
  134. package/dist/helpers/local-storage.js +6 -0
  135. package/dist/helpers/measure.d.ts +21 -0
  136. package/dist/helpers/measure.d.ts.map +1 -0
  137. package/dist/helpers/measure.js +7 -0
  138. package/dist/helpers/parse.d.ts +3 -5
  139. package/dist/helpers/parse.d.ts.map +1 -1
  140. package/dist/helpers/parse.js +64 -86
  141. package/dist/helpers/scroll-to-id.d.ts.map +1 -1
  142. package/dist/helpers/scroll-to-id.js +18 -4
  143. package/dist/index.d.ts +0 -1
  144. package/dist/index.d.ts.map +1 -1
  145. package/dist/index.js +33 -35
  146. package/dist/libs/openapi.d.ts +3 -3
  147. package/dist/libs/openapi.d.ts.map +1 -1
  148. package/dist/libs/openapi.js +35 -42
  149. package/dist/standalone/lib/html-api.d.ts.map +1 -1
  150. package/dist/standalone/lib/html-api.js +15 -15
  151. package/dist/stores/useHttpClientStore.d.ts.map +1 -1
  152. package/dist/stores/useHttpClientStore.js +19 -18
  153. package/dist/style.css +1 -1
  154. package/dist/types.d.ts +27 -3
  155. package/dist/types.d.ts.map +1 -1
  156. package/package.json +15 -16
  157. package/dist/hooks/useReactiveSpec.d.ts +0 -448
  158. package/dist/hooks/useReactiveSpec.d.ts.map +0 -1
  159. package/dist/hooks/useReactiveSpec.js +0 -59
@@ -1,16 +1,18 @@
1
- import { defineComponent as V, computed as E, createBlock as i, createCommentVNode as o, openBlock as a, unref as r, withCtx as d, createElementVNode as j, normalizeClass as v, createElementBlock as s, withDirectives as w, createVNode as u, createTextVNode as h, toDisplayString as f, vShow as z, normalizeStyle as T, Fragment as t, renderList as A } from "vue";
2
- import { Disclosure as $, DisclosureButton as D, DisclosurePanel as F } from "@headlessui/vue";
3
- import { ScalarMarkdown as I, ScalarIcon as g } from "@scalar/components";
4
- import q from "../../ScreenReader.vue.js";
5
- import L from "./SchemaHeading.vue.js";
6
- import y from "./SchemaProperty.vue.js";
7
- const M = {
1
+ import { defineComponent as L, ref as R, computed as p, watch as U, createBlock as o, createCommentVNode as s, openBlock as l, unref as n, withCtx as v, createElementVNode as V, normalizeClass as N, createElementBlock as t, withDirectives as z, createVNode as h, createTextVNode as P, toDisplayString as H, vShow as A, normalizeStyle as G, Fragment as d, renderList as q } from "vue";
2
+ import { Disclosure as J, DisclosureButton as T, DisclosurePanel as K } from "@headlessui/vue";
3
+ import { ScalarMarkdown as Q, ScalarIcon as S } from "@scalar/components";
4
+ import { getDiscriminatorMapping as W, getDiscriminatorPropertyName as X, mergeDiscriminatorSchemas as Y } from "./helpers/schema-discriminator.js";
5
+ import Z from "./SchemaDiscriminator.vue.js";
6
+ import $ from "../../ScreenReader.vue.js";
7
+ import _ from "./SchemaHeading.vue.js";
8
+ import b from "./SchemaProperty.vue.js";
9
+ const x = {
8
10
  key: 0,
9
11
  class: "schema-card-description"
10
- }, R = {
12
+ }, ee = {
11
13
  key: 0,
12
14
  class: "schema-properties"
13
- }, X = /* @__PURE__ */ V({
15
+ }, de = /* @__PURE__ */ L({
14
16
  __name: "Schema",
15
17
  props: {
16
18
  value: { type: [Object, Boolean] },
@@ -20,96 +22,119 @@ const M = {
20
22
  noncollapsible: { type: Boolean, default: !1 },
21
23
  hideHeading: { type: Boolean },
22
24
  additionalProperties: { type: Boolean },
25
+ hideModelNames: { type: Boolean, default: !1 },
23
26
  schemas: {}
24
27
  },
25
- setup(N) {
26
- const k = N, b = E(() => !(k.noncollapsible || k.level === 0)), H = (e) => k.noncollapsible && e.stopPropagation();
27
- return (e, P) => typeof e.value == "object" && Object.keys(e.value).length ? (a(), i(r($), {
28
+ setup(E) {
29
+ const i = E, m = R(""), c = p(() => {
30
+ if (i.value)
31
+ return W(i.value);
32
+ }), F = p(() => c.value && Object.keys(c.value)[0] || ""), D = p(() => {
33
+ if (i.value)
34
+ return X(i.value);
35
+ }), a = p(() => {
36
+ if (i.value)
37
+ return !c.value || !m.value ? i.value : Y(
38
+ i.value,
39
+ m.value,
40
+ i.schemas
41
+ ) || i.value;
42
+ }), C = p(() => !(i.noncollapsible || i.level === 0)), I = p(() => {
43
+ var e;
44
+ return !(!((e = a.value) != null && e.description) || typeof a.value.description != "string" || a.value.allOf || a.value.oneOf || a.value.anyOf || a.value.enum || i.level === 0);
45
+ }), O = (e) => i.noncollapsible && e.stopPropagation();
46
+ return U(
47
+ c,
48
+ (e) => {
49
+ e && !m.value && (m.value = F.value);
50
+ },
51
+ { immediate: !0 }
52
+ ), (e, M) => typeof e.value == "object" && Object.keys(e.value).length ? (l(), o(n(J), {
28
53
  key: 0,
29
54
  defaultOpen: e.noncollapsible
30
55
  }, {
31
- default: d(({ open: n }) => {
32
- var S;
56
+ default: v(({ open: u }) => {
57
+ var B, w;
33
58
  return [
34
- j("div", {
35
- class: v(["schema-card", [
59
+ V("div", {
60
+ class: N(["schema-card", [
36
61
  `schema-card--level-${e.level}`,
37
- { "schema-card--compact": e.compact, "schema-card--open": n },
38
- { "border-t-1/2": e.additionalProperties && n }
62
+ { "schema-card--compact": e.compact, "schema-card--open": u },
63
+ { "border-t": e.additionalProperties && u }
39
64
  ]])
40
65
  }, [
41
- (S = e.value) != null && S.description && typeof e.value.description == "string" && !e.value.allOf && !e.value.oneOf && !e.value.anyOf && !e.compact ? (a(), s("div", M, [
42
- e.value.enum ? o("", !0) : (a(), i(r(I), {
66
+ I.value ? (l(), t("div", x, [
67
+ (B = a.value) != null && B.enum ? s("", !0) : (l(), o(n(Q), {
43
68
  key: 0,
44
- value: e.value.description
69
+ value: (w = a.value) == null ? void 0 : w.description
45
70
  }, null, 8, ["value"]))
46
- ])) : o("", !0),
47
- j("div", {
48
- class: v(["schema-properties", {
49
- "schema-properties-open": n
71
+ ])) : s("", !0),
72
+ V("div", {
73
+ class: N(["schema-properties", {
74
+ "schema-properties-open": u
50
75
  }])
51
76
  }, [
52
- e.additionalProperties ? w((a(), s("div", R, [
53
- u(r(D), {
77
+ e.additionalProperties ? z((l(), t("div", ee, [
78
+ h(n(T), {
54
79
  as: "button",
55
80
  class: "schema-card-title schema-card-title--compact",
56
- onClickCapture: H
81
+ onClickCapture: O
57
82
  }, {
58
- default: d(() => [
59
- u(r(g), {
83
+ default: v(() => [
84
+ h(n(S), {
60
85
  class: "schema-card-title-icon",
61
86
  icon: "Add",
62
87
  size: "sm"
63
88
  }),
64
- P[0] || (P[0] = h(" Show additional properties ")),
65
- e.name ? (a(), i(q, { key: 0 }, {
66
- default: d(() => [
67
- h("for " + f(e.name), 1)
89
+ M[1] || (M[1] = P(" Show additional properties ")),
90
+ e.name ? (l(), o($, { key: 0 }, {
91
+ default: v(() => [
92
+ P("for " + H(e.name), 1)
68
93
  ]),
69
94
  _: 1
70
- })) : o("", !0)
95
+ })) : s("", !0)
71
96
  ]),
72
97
  _: 1
73
98
  })
74
99
  ], 512)), [
75
- [z, !n]
76
- ]) : b.value ? w((a(), i(r(D), {
100
+ [A, !u]
101
+ ]) : C.value ? z((l(), o(n(T), {
77
102
  key: 1,
78
103
  as: e.noncollapsible ? "div" : "button",
79
- class: v(["schema-card-title", { "schema-card-title--compact": e.compact }]),
80
- style: T({
104
+ class: N(["schema-card-title", { "schema-card-title--compact": e.compact }]),
105
+ style: G({
81
106
  top: `calc(var(--refs-header-height) + calc(var(--schema-title-height) * ${e.level}))`
82
107
  }),
83
- onClickCapture: H
108
+ onClickCapture: O
84
109
  }, {
85
- default: d(() => {
86
- var m, c, l;
110
+ default: v(() => {
111
+ var f, y, g;
87
112
  return [
88
- e.compact ? (a(), s(t, { key: 0 }, [
89
- u(r(g), {
90
- class: v(["schema-card-title-icon", { "schema-card-title-icon--open": n }]),
113
+ e.compact ? (l(), t(d, { key: 0 }, [
114
+ h(n(S), {
115
+ class: N(["schema-card-title-icon", { "schema-card-title-icon--open": u }]),
91
116
  icon: "Add",
92
117
  size: "sm"
93
118
  }, null, 8, ["class"]),
94
- n ? (a(), s(t, { key: 0 }, [
95
- h(" Hide " + f(((m = e.value) == null ? void 0 : m.title) ?? "Child Attributes"), 1)
96
- ], 64)) : (a(), s(t, { key: 1 }, [
97
- h(" Show " + f(((c = e.value) == null ? void 0 : c.title) ?? "Child Attributes"), 1)
119
+ u ? (l(), t(d, { key: 0 }, [
120
+ P(" Hide " + H(((f = e.value) == null ? void 0 : f.title) ?? "Child Attributes"), 1)
121
+ ], 64)) : (l(), t(d, { key: 1 }, [
122
+ P(" Show " + H(((y = e.value) == null ? void 0 : y.title) ?? "Child Attributes"), 1)
98
123
  ], 64)),
99
- e.name ? (a(), i(q, { key: 2 }, {
100
- default: d(() => [
101
- h("for " + f(e.name), 1)
124
+ e.name ? (l(), o($, { key: 2 }, {
125
+ default: v(() => [
126
+ P("for " + H(e.name), 1)
102
127
  ]),
103
128
  _: 1
104
- })) : o("", !0)
105
- ], 64)) : (a(), s(t, { key: 1 }, [
106
- u(r(g), {
107
- class: v(["schema-card-title-icon", { "schema-card-title-icon--open": n }]),
129
+ })) : s("", !0)
130
+ ], 64)) : (l(), t(d, { key: 1 }, [
131
+ h(n(S), {
132
+ class: N(["schema-card-title-icon", { "schema-card-title-icon--open": u }]),
108
133
  icon: "Add",
109
134
  size: "sm"
110
135
  }, null, 8, ["class"]),
111
- u(L, {
112
- name: ((l = e.value) == null ? void 0 : l.title) ?? e.name,
136
+ h(_, {
137
+ name: ((g = e.value) == null ? void 0 : g.title) ?? e.name,
113
138
  value: e.value
114
139
  }, null, 8, ["name", "value"])
115
140
  ], 64))
@@ -117,44 +142,59 @@ const M = {
117
142
  }),
118
143
  _: 2
119
144
  }, 1032, ["as", "class", "style"])), [
120
- [z, !e.hideHeading && !(e.noncollapsible && e.compact)]
121
- ]) : o("", !0),
122
- u(r(F), {
145
+ [A, !e.hideHeading && !(e.noncollapsible && e.compact)]
146
+ ]) : s("", !0),
147
+ h(n(K), {
123
148
  as: "ul",
124
- static: !b.value
149
+ static: !C.value
125
150
  }, {
126
- default: d(() => {
127
- var m, c;
151
+ default: v(() => {
152
+ var f, y, g;
128
153
  return [
129
- e.value.properties || e.value.additionalProperties || e.value.patternProperties ? (a(), s(t, { key: 0 }, [
130
- e.value.properties ? (a(!0), s(t, { key: 0 }, A(Object.keys((m = e.value) == null ? void 0 : m.properties), (l) => {
131
- var p, C, O, B;
132
- return a(), i(y, {
133
- key: l,
154
+ c.value && ((f = a.value) != null && f.properties) ? (l(), o(Z, {
155
+ key: 0,
156
+ modelValue: m.value,
157
+ "onUpdate:modelValue": M[0] || (M[0] = (r) => m.value = r),
158
+ discriminatorMapping: c.value,
159
+ discriminatorPropertyName: D.value
160
+ }, null, 8, ["modelValue", "discriminatorMapping", "discriminatorPropertyName"])) : s("", !0),
161
+ a.value && ("properties" in a.value || "additionalProperties" in a.value || "patternProperties" in a.value) ? (l(), t(d, { key: 1 }, [
162
+ a.value.properties ? (l(!0), t(d, { key: 0 }, q(Object.keys(a.value.properties), (r) => {
163
+ var k, j;
164
+ return l(), o(b, {
165
+ key: r,
134
166
  compact: e.compact,
135
167
  hideHeading: e.hideHeading,
136
168
  level: e.level + 1,
137
- name: l,
138
- required: ((p = e.value.required) == null ? void 0 : p.includes(l)) || ((O = (C = e.value.properties) == null ? void 0 : C[l]) == null ? void 0 : O.required) === !0,
169
+ name: r,
170
+ required: ((k = a.value.required) == null ? void 0 : k.includes(r)) || ((j = a.value.properties[r]) == null ? void 0 : j.required) === !0,
139
171
  schemas: e.schemas,
140
- value: (B = e.value.properties) == null ? void 0 : B[l]
141
- }, null, 8, ["compact", "hideHeading", "level", "name", "required", "schemas", "value"]);
142
- }), 128)) : o("", !0),
143
- e.value.patternProperties ? (a(!0), s(t, { key: 1 }, A(Object.keys((c = e.value) == null ? void 0 : c.patternProperties), (l) => {
144
- var p;
145
- return a(), i(y, {
146
- key: l,
172
+ value: {
173
+ ...a.value.properties[r],
174
+ parent: a.value,
175
+ isDiscriminator: r === D.value
176
+ },
177
+ hideModelNames: e.hideModelNames
178
+ }, null, 8, ["compact", "hideHeading", "level", "name", "required", "schemas", "value", "hideModelNames"]);
179
+ }), 128)) : s("", !0),
180
+ a.value.patternProperties ? (l(!0), t(d, { key: 1 }, q(Object.keys(
181
+ a.value.patternProperties
182
+ ), (r) => {
183
+ var k;
184
+ return l(), o(b, {
185
+ key: r,
147
186
  compact: e.compact,
148
187
  hideHeading: e.hideHeading,
149
188
  level: e.level,
150
- name: l,
189
+ name: r,
151
190
  pattern: "",
152
191
  schemas: e.schemas,
153
- value: (p = e.value.patternProperties) == null ? void 0 : p[l]
154
- }, null, 8, ["compact", "hideHeading", "level", "name", "schemas", "value"]);
155
- }), 128)) : o("", !0),
156
- e.value.additionalProperties ? (a(), s(t, { key: 2 }, [
157
- e.value.additionalProperties === !0 || Object.keys(e.value.additionalProperties).length === 0 || !e.value.additionalProperties.type ? (a(), i(y, {
192
+ value: ((k = e.value.discriminator) == null ? void 0 : k.propertyName) === r ? e.value : a.value.patternProperties[r],
193
+ hideModelNames: e.hideModelNames
194
+ }, null, 8, ["compact", "hideHeading", "level", "name", "schemas", "value", "hideModelNames"]);
195
+ }), 128)) : s("", !0),
196
+ a.value.additionalProperties ? (l(), t(d, { key: 2 }, [
197
+ a.value.additionalProperties === !0 || Object.keys(a.value.additionalProperties).length === 0 || !("type" in a.value.additionalProperties) ? (l(), o(b, {
158
198
  key: 0,
159
199
  additional: "",
160
200
  compact: e.compact,
@@ -164,9 +204,10 @@ const M = {
164
204
  schemas: e.schemas,
165
205
  value: {
166
206
  type: "anything",
167
- ...typeof e.value.additionalProperties == "object" ? e.value.additionalProperties : {}
168
- }
169
- }, null, 8, ["compact", "hideHeading", "level", "schemas", "value"])) : (a(), i(y, {
207
+ ...typeof a.value.additionalProperties == "object" ? a.value.additionalProperties : {}
208
+ },
209
+ hideModelNames: e.hideModelNames
210
+ }, null, 8, ["compact", "hideHeading", "level", "schemas", "value", "hideModelNames"])) : (l(), o(b, {
170
211
  key: 1,
171
212
  additional: "",
172
213
  compact: e.compact,
@@ -174,18 +215,20 @@ const M = {
174
215
  level: e.level,
175
216
  noncollapsible: "",
176
217
  schemas: e.schemas,
177
- value: e.value.additionalProperties
178
- }, null, 8, ["compact", "hideHeading", "level", "schemas", "value"]))
179
- ], 64)) : o("", !0)
180
- ], 64)) : (a(), i(y, {
181
- key: 1,
218
+ value: ((y = e.value.discriminator) == null ? void 0 : y.propertyName) === e.name ? e.value : a.value.additionalProperties,
219
+ hideModelNames: e.hideModelNames
220
+ }, null, 8, ["compact", "hideHeading", "level", "schemas", "value", "hideModelNames"]))
221
+ ], 64)) : s("", !0)
222
+ ], 64)) : (l(), o(b, {
223
+ key: 2,
182
224
  compact: e.compact,
183
225
  hideHeading: e.hideHeading,
184
226
  level: e.level,
185
- name: e.value.name,
227
+ name: a.value.name,
186
228
  schemas: e.schemas,
187
- value: e.value
188
- }, null, 8, ["compact", "hideHeading", "level", "name", "schemas", "value"]))
229
+ value: ((g = e.value.discriminator) == null ? void 0 : g.propertyName) === e.name ? e.value : a.value,
230
+ hideModelNames: e.hideModelNames
231
+ }, null, 8, ["compact", "hideHeading", "level", "name", "schemas", "value", "hideModelNames"]))
189
232
  ];
190
233
  }),
191
234
  _: 1
@@ -195,9 +238,9 @@ const M = {
195
238
  ];
196
239
  }),
197
240
  _: 1
198
- }, 8, ["defaultOpen"])) : o("", !0);
241
+ }, 8, ["defaultOpen"])) : s("", !0);
199
242
  }
200
243
  });
201
244
  export {
202
- X as default
245
+ de as default
203
246
  };
@@ -1,8 +1,8 @@
1
- import type { OpenAPIV2, OpenAPIV3, OpenAPIV3_1 } from '@scalar/openapi-types';
1
+ import type { OpenAPIV3_1 } from '@scalar/openapi-types';
2
2
  import { type CompositionKeyword } from './helpers/schema-composition.js';
3
3
  type __VLS_Props = {
4
4
  composition: CompositionKeyword;
5
- schemas?: OpenAPIV2.DefinitionsObject | Record<string, OpenAPIV3.SchemaObject> | Record<string, OpenAPIV3_1.SchemaObject> | unknown;
5
+ schemas?: Record<string, OpenAPIV3_1.SchemaObject> | unknown;
6
6
  name?: string;
7
7
  value: Record<string, any>;
8
8
  level: number;
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaComposition.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Content/Schema/SchemaComposition.vue"],"names":[],"mappings":"AAwRA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAM9E,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,8BAA8B,CAAA;AAKrC,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,kBAAkB,CAAA;IAC/B,OAAO,CAAC,EACJ,SAAS,CAAC,iBAAiB,GAC3B,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,YAAY,CAAC,GACtC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,YAAY,CAAC,GACxC,OAAO,CAAA;IACX,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB,CAAC;;AA2UF,wBAOG"}
1
+ {"version":3,"file":"SchemaComposition.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Content/Schema/SchemaComposition.vue"],"names":[],"mappings":"AAuSA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAMxD,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,8BAA8B,CAAA;AAKrC,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,kBAAkB,CAAA;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,YAAY,CAAC,GAAG,OAAO,CAAA;IAC5D,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB,CAAC;;AAgWF,wBAOG"}
@@ -1,17 +1,17 @@
1
- import { defineComponent as E, ref as F, computed as m, resolveComponent as I, createElementBlock as u, openBlock as s, createCommentVNode as p, createBlock as f, Fragment as A, renderList as M, createVNode as b, createElementVNode as d, unref as v, withCtx as $, toDisplayString as B } from "vue";
2
- import { ScalarListbox as Z, ScalarMarkdown as G } from "@scalar/components";
3
- import { ScalarIconCaretDown as J } from "@scalar/icons";
4
- import { stringify as T } from "flatted";
5
- import { mergeAllOfSchemas as K } from "./helpers/merge-all-of-schemas.js";
1
+ import { defineComponent as U, ref as D, computed as s, resolveComponent as E, createElementBlock as u, openBlock as m, createCommentVNode as p, createBlock as f, Fragment as H, renderList as F, createVNode as b, createElementVNode as d, unref as v, withCtx as I, toDisplayString as w } from "vue";
2
+ import { ScalarListbox as M, ScalarMarkdown as $ } from "@scalar/components";
3
+ import { ScalarIconCaretDown as R } from "@scalar/icons";
4
+ import { stringify as j } from "flatted";
5
+ import { mergeAllOfSchemas as Z } from "./helpers/merge-all-of-schemas.js";
6
6
  import { hasComposition as g } from "./helpers/schema-composition.js";
7
7
  import S from "./Schema.vue.js";
8
- const P = { class: "property-rule" }, Q = {
9
- class: "composition-selector bg-b-1.5 hover:bg-b-2 py-1.25 flex w-full cursor-pointer items-center gap-1 rounded-t-lg border border-b-0 px-2 pr-3 text-left",
8
+ const G = { class: "property-rule" }, J = {
9
+ class: "composition-selector bg-b-1.5 hover:bg-b-2 flex w-full cursor-pointer items-center gap-1 rounded-t-lg border border-b-0 px-2 py-1.25 pr-3 text-left",
10
10
  type: "button"
11
- }, R = { class: "text-c-2" }, X = { class: "composition-selector-label text-c-1 relative" }, Y = { class: "composition-panel" }, W = {
11
+ }, K = { class: "text-c-2" }, P = { class: "composition-selector-label text-c-1 relative" }, Q = { class: "composition-panel" }, X = {
12
12
  key: 0,
13
13
  class: "property-description border-x border-t p-2"
14
- }, ae = /* @__PURE__ */ E({
14
+ }, te = /* @__PURE__ */ U({
15
15
  __name: "SchemaComposition",
16
16
  props: {
17
17
  composition: {},
@@ -23,21 +23,21 @@ const P = { class: "property-rule" }, Q = {
23
23
  hideHeading: { type: Boolean }
24
24
  },
25
25
  setup(l) {
26
- const y = F(0), C = m(
26
+ const y = D(0), C = s(
27
27
  () => N.value.map((e, o) => ({
28
28
  id: String(o),
29
- label: z(e) || "Schema"
29
+ label: A(e) || "Schema"
30
30
  }))
31
- ), O = m({
31
+ ), O = s({
32
32
  get: () => C.value.find(
33
33
  (e) => e.id === String(y.value)
34
34
  ),
35
35
  set: (e) => y.value = Number(e.id)
36
- }), q = m(() => {
36
+ }), q = s(() => {
37
37
  var t;
38
38
  const e = ["oneOf", "anyOf"].includes(l.composition), o = l.composition === "allOf" && ((t = l.value[l.composition]) == null ? void 0 : t.some((n) => g(n)));
39
39
  return e || o;
40
- }), z = (e) => {
40
+ }), A = (e) => {
41
41
  if (!e)
42
42
  return null;
43
43
  if (e.title)
@@ -46,7 +46,7 @@ const P = { class: "property-rule" }, Q = {
46
46
  return e.name;
47
47
  if (l.schemas && typeof l.schemas == "object") {
48
48
  for (const [o, t] of Object.entries(l.schemas))
49
- if (T(t) === T(e))
49
+ if (j(t) === j(e))
50
50
  return o;
51
51
  }
52
52
  if (e.type === "array" && e.items)
@@ -59,11 +59,11 @@ const P = { class: "property-rule" }, Q = {
59
59
  return o[0];
60
60
  }
61
61
  return null;
62
- }, k = (e) => e.find((o) => g(o)), N = m(() => {
62
+ }, k = (e) => e.find((o) => g(o)), N = s(() => {
63
63
  if (!k(l.value[l.composition]))
64
64
  return l.value[l.composition];
65
65
  const e = k(l.value[l.composition]);
66
- return (e.oneOf || e.anyOf).map((t) => {
66
+ return (e.oneOf || e.anyOf || e.allOf).map((t) => {
67
67
  if (t.allOf) {
68
68
  const n = t.allOf.find((c) => c.title), r = t.allOf.find((c) => !c.title);
69
69
  return n && r ? {
@@ -82,7 +82,7 @@ const P = { class: "property-rule" }, Q = {
82
82
  }
83
83
  return t;
84
84
  });
85
- }), L = (e) => {
85
+ }), B = (e) => {
86
86
  var o, t;
87
87
  if (e === "allOf") {
88
88
  const n = (t = (o = l.value) == null ? void 0 : o[e]) == null ? void 0 : t.find(
@@ -94,57 +94,60 @@ const P = { class: "property-rule" }, Q = {
94
94
  return "Any of";
95
95
  }
96
96
  return e.replace(/([A-Z])/g, " $1").replace(/^./, (n) => n.toUpperCase()).toLowerCase().replace(/^(\w)/, (n) => n.toUpperCase());
97
- }, a = m(
97
+ }, i = s(
98
98
  () => N.value[y.value]
99
- ), h = m(() => {
99
+ ), h = s(() => {
100
100
  var e;
101
- return (e = a.value) != null && e.oneOf ? "oneOf" : "anyOf";
102
- }), U = m(() => {
101
+ return (e = i.value) != null && e.oneOf ? "oneOf" : "anyOf";
102
+ }), T = s(() => {
103
103
  var o;
104
104
  const e = h.value;
105
- return (o = a.value) == null ? void 0 : o[e];
105
+ return (o = i.value) == null ? void 0 : o[e];
106
+ }), z = s(() => {
107
+ const e = i.value;
108
+ return e ? !!(e.properties || e.type || e.nullable || e.const !== void 0 || e.enum || e.allOf || e.oneOf || e.anyOf || e.items) : !1;
106
109
  });
107
110
  return (e, o) => {
108
- var n, r, c, V, H, w, j;
109
- const t = I("SchemaComposition", !0);
110
- return s(), u("div", P, [
111
- e.composition === "allOf" && e.value[e.composition].some((i) => i.oneOf || i.anyOf) ? (s(!0), u(A, { key: 0 }, M(e.value[e.composition].filter(
112
- (i) => !i.oneOf && !i.anyOf
113
- ), (i, D) => (s(), f(S, {
114
- key: D,
111
+ var n, r, c, V;
112
+ const t = E("SchemaComposition", !0);
113
+ return m(), u("div", G, [
114
+ e.composition === "allOf" && e.value[e.composition].some((a) => a.oneOf || a.anyOf) ? (m(!0), u(H, { key: 0 }, F(e.value[e.composition].filter(
115
+ (a) => !a.oneOf && !a.anyOf
116
+ ), (a, L) => (m(), f(S, {
117
+ key: L,
115
118
  compact: e.compact,
116
119
  level: e.level,
117
120
  name: e.name,
118
121
  noncollapsible: e.level == 0,
119
122
  schemas: e.schemas,
120
- value: i
123
+ value: a
121
124
  }, null, 8, ["compact", "level", "name", "noncollapsible", "schemas", "value"]))), 128)) : p("", !0),
122
- q.value ? (s(), u(A, { key: 1 }, [
123
- b(v(Z), {
125
+ q.value ? (m(), u(H, { key: 1 }, [
126
+ b(v(M), {
124
127
  modelValue: O.value,
125
- "onUpdate:modelValue": o[0] || (o[0] = (i) => O.value = i),
128
+ "onUpdate:modelValue": o[0] || (o[0] = (a) => O.value = a),
126
129
  options: C.value,
127
130
  resize: ""
128
131
  }, {
129
- default: $(() => {
130
- var i;
132
+ default: I(() => {
133
+ var a;
131
134
  return [
132
- d("button", Q, [
133
- d("span", R, B(L(e.composition)), 1),
134
- d("span", X, B(((i = O.value) == null ? void 0 : i.label) || "Schema"), 1),
135
- b(v(J), { class: "z-1" })
135
+ d("button", J, [
136
+ d("span", K, w(B(e.composition)), 1),
137
+ d("span", P, w(((a = O.value) == null ? void 0 : a.label) || "Schema"), 1),
138
+ b(v(R), { class: "z-1" })
136
139
  ])
137
140
  ];
138
141
  }),
139
142
  _: 1
140
143
  }, 8, ["modelValue", "options"]),
141
- d("div", Y, [
142
- (n = a.value) != null && n.description ? (s(), u("div", W, [
143
- b(v(G), {
144
- value: a.value.description
144
+ d("div", Q, [
145
+ (n = i.value) != null && n.description ? (m(), u("div", X, [
146
+ b(v($), {
147
+ value: i.value.description
145
148
  }, null, 8, ["value"])
146
149
  ])) : p("", !0),
147
- (r = a.value) != null && r.properties || (c = a.value) != null && c.type || (V = a.value) != null && V.nullable ? (s(), f(S, {
150
+ z.value ? (m(), f(S, {
148
151
  key: 1,
149
152
  compact: e.compact,
150
153
  level: e.level + 1,
@@ -152,12 +155,13 @@ const P = { class: "property-rule" }, Q = {
152
155
  name: e.name,
153
156
  noncollapsible: !0,
154
157
  schemas: e.schemas,
155
- value: (H = a.value) != null && H.properties ? {
158
+ value: (r = i.value) != null && r.properties ? {
156
159
  type: "object",
157
- properties: a.value.properties
158
- } : a.value
160
+ properties: i.value.properties,
161
+ required: i.value.required
162
+ } : i.value
159
163
  }, null, 8, ["compact", "level", "hideHeading", "name", "schemas", "value"])) : p("", !0),
160
- (w = a.value) != null && w.oneOf || (j = a.value) != null && j.anyOf ? (s(), f(t, {
164
+ (c = i.value) != null && c.oneOf || (V = i.value) != null && V.anyOf ? (m(), f(t, {
161
165
  key: 2,
162
166
  compact: e.compact,
163
167
  composition: h.value,
@@ -167,23 +171,23 @@ const P = { class: "property-rule" }, Q = {
167
171
  noncollapsible: !0,
168
172
  schemas: e.schemas,
169
173
  value: {
170
- [h.value]: U.value
174
+ [h.value]: T.value
171
175
  }
172
176
  }, null, 8, ["compact", "composition", "hideHeading", "level", "name", "schemas", "value"])) : p("", !0)
173
177
  ])
174
- ], 64)) : (s(), f(S, {
178
+ ], 64)) : (m(), f(S, {
175
179
  key: 2,
176
180
  compact: e.compact,
177
181
  level: e.level,
178
182
  name: e.name,
179
183
  noncollapsible: e.level == 0,
180
184
  schemas: e.schemas,
181
- value: v(K)(e.value[e.composition])
185
+ value: v(Z)(e.value[e.composition])
182
186
  }, null, 8, ["compact", "level", "name", "noncollapsible", "schemas", "value"]))
183
187
  ]);
184
188
  };
185
189
  }
186
190
  });
187
191
  export {
188
- ae as default
192
+ te as default
189
193
  };
@@ -0,0 +1,13 @@
1
+ import type { DiscriminatorMapping, DiscriminatorPropertyName } from './helpers/schema-discriminator.js';
2
+ type __VLS_Props = {
3
+ discriminatorMapping: DiscriminatorMapping;
4
+ modelValue: string;
5
+ discriminatorPropertyName?: DiscriminatorPropertyName;
6
+ };
7
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
8
+ "update:modelValue": (value: string) => any;
9
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
10
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
11
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
+ export default _default;
13
+ //# sourceMappingURL=SchemaDiscriminator.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaDiscriminator.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Content/Schema/SchemaDiscriminator.vue"],"names":[],"mappings":"AA2DA,OAAO,KAAK,EACV,oBAAoB,EACpB,yBAAyB,EAC1B,MAAM,gCAAgC,CAAA;AAIvC,KAAK,WAAW,GAAG;IACf,oBAAoB,EAAE,oBAAoB,CAAA;IAC1C,UAAU,EAAE,MAAM,CAAA;IAClB,yBAAyB,CAAC,EAAE,yBAAyB,CAAA;CACtD,CAAC;;;;;;AAiHJ,wBAQG"}