@scalar/api-reference 1.28.26 → 1.28.28

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.
@@ -1,31 +1,32 @@
1
- import { defineComponent as F, openBlock as r, createElementBlock as i, normalizeClass as O, renderSlot as V, Fragment as d, createTextVNode as a, createCommentVNode as u, toDisplayString as n, createVNode as s, unref as y, withCtx as t, createBlock as m } from "vue";
2
- import { discriminators as z } from "./helpers/optimizeValueForDisplay.js";
3
- import H from "./SchemaPropertyExamples.vue.js";
4
- import v from "../../ScreenReader.vue.js";
5
- import o from "./SchemaPropertyDetail.vue.js";
6
- import $ from "../../Badge/Badge.vue.js";
7
- const R = { class: "property-heading" }, G = {
1
+ import { defineComponent as j, openBlock as i, createElementBlock as s, normalizeClass as I, renderSlot as B, Fragment as a, createTextVNode as r, createCommentVNode as m, toDisplayString as d, createVNode as u, unref as k, withCtx as n, createBlock as l } from "vue";
2
+ import { stringify as b } from "flatted";
3
+ import { discriminators as M } from "./helpers/optimizeValueForDisplay.js";
4
+ import V from "./SchemaPropertyExamples.vue.js";
5
+ import x from "../../ScreenReader.vue.js";
6
+ import p from "./SchemaPropertyDetail.vue.js";
7
+ import N from "../../Badge/Badge.vue.js";
8
+ const A = { class: "property-heading" }, C = {
8
9
  key: 1,
9
10
  class: "property-additional"
10
- }, J = {
11
+ }, E = {
11
12
  key: 2,
12
13
  class: "property-pattern"
13
- }, K = {
14
+ }, L = {
14
15
  key: 3,
15
16
  class: "property-deprecated"
16
- }, Q = {
17
+ }, $ = {
17
18
  key: 4,
18
19
  class: "property-const"
19
- }, U = {
20
+ }, D = {
20
21
  key: 7,
21
22
  class: "property-write-only"
22
- }, W = {
23
+ }, F = {
23
24
  key: 8,
24
25
  class: "property-read-only"
25
- }, X = {
26
+ }, O = {
26
27
  key: 9,
27
28
  class: "property-required"
28
- }, ee = /* @__PURE__ */ F({
29
+ }, Q = /* @__PURE__ */ j({
29
30
  __name: "SchemaPropertyHeading",
30
31
  props: {
31
32
  value: {},
@@ -33,205 +34,217 @@ const R = { class: "property-heading" }, G = {
33
34
  required: { type: Boolean, default: !1 },
34
35
  additional: { type: Boolean },
35
36
  pattern: { type: Boolean },
36
- withExamples: { type: Boolean, default: !0 }
37
+ withExamples: { type: Boolean, default: !0 },
38
+ schemas: {}
37
39
  },
38
- setup(j) {
39
- const p = j, D = z.find((e) => !p.value || typeof p.value != "object" ? !1 : e in p.value || p.value.items && typeof p.value.items == "object" && e in p.value.items), T = (e) => Array.isArray(e == null ? void 0 : e.default) && e.default.length === 1 ? e.default[0] : e == null ? void 0 : e.default;
40
- return (e, l) => {
41
- var f, k, g, B, b, q, w, P, S, I, N, A, C;
42
- return r(), i("div", R, [
43
- e.$slots.name ? (r(), i("div", {
40
+ setup(S) {
41
+ const { value: e, schemas: f } = S, q = M.find((o) => !e || typeof e != "object" ? !1 : o in e || e.items && typeof e.items == "object" && o in e.items), w = (o) => Array.isArray(o == null ? void 0 : o.default) && o.default.length === 1 ? o.default[0] : o == null ? void 0 : o.default, P = (o) => {
42
+ if (!o)
43
+ return null;
44
+ if (o.name)
45
+ return o.name;
46
+ if (f && typeof f == "object") {
47
+ for (const [t, y] of Object.entries(f))
48
+ if (b(y) === b(o))
49
+ return t;
50
+ }
51
+ return null;
52
+ };
53
+ return (o, t) => {
54
+ var y;
55
+ return i(), s("div", A, [
56
+ o.$slots.name ? (i(), s("div", {
44
57
  key: 0,
45
- class: O(["property-name", { deprecated: (f = e.value) == null ? void 0 : f.deprecated }])
58
+ class: I(["property-name", { deprecated: e == null ? void 0 : e.deprecated }])
46
59
  }, [
47
- e.pattern ? (r(), i(d, { key: 1 }, [
48
- l[0] || (l[0] = a("/")),
49
- V(e.$slots, "name", {}, void 0, !0),
50
- l[1] || (l[1] = a("/"))
51
- ], 64)) : V(e.$slots, "name", { key: 0 }, void 0, !0)
52
- ], 2)) : u("", !0),
53
- e.additional ? (r(), i("div", G, [
54
- (k = e.value) != null && k["x-additionalPropertiesName"] ? (r(), i(d, { key: 0 }, [
55
- a(n(e.value["x-additionalPropertiesName"]), 1)
56
- ], 64)) : (r(), i(d, { key: 1 }, [
57
- a("additional properties")
60
+ o.pattern ? (i(), s(a, { key: 1 }, [
61
+ t[0] || (t[0] = r("/")),
62
+ B(o.$slots, "name", {}, void 0, !0),
63
+ t[1] || (t[1] = r("/"))
64
+ ], 64)) : B(o.$slots, "name", { key: 0 }, void 0, !0)
65
+ ], 2)) : m("", !0),
66
+ o.additional ? (i(), s("div", C, [
67
+ e != null && e["x-additionalPropertiesName"] ? (i(), s(a, { key: 0 }, [
68
+ r(d(e["x-additionalPropertiesName"]), 1)
69
+ ], 64)) : (i(), s(a, { key: 1 }, [
70
+ r("additional properties")
58
71
  ], 64))
59
- ])) : u("", !0),
60
- e.pattern ? (r(), i("div", J, [
61
- s(y($), null, {
62
- default: t(() => l[2] || (l[2] = [
63
- a("pattern")
72
+ ])) : m("", !0),
73
+ o.pattern ? (i(), s("div", E, [
74
+ u(k(N), null, {
75
+ default: n(() => t[2] || (t[2] = [
76
+ r("pattern")
64
77
  ])),
65
78
  _: 1
66
79
  })
67
- ])) : u("", !0),
68
- (g = e.value) != null && g.deprecated ? (r(), i("div", K, [
69
- s(y($), null, {
70
- default: t(() => l[3] || (l[3] = [
71
- a("deprecated")
80
+ ])) : m("", !0),
81
+ e != null && e.deprecated ? (i(), s("div", L, [
82
+ u(k(N), null, {
83
+ default: n(() => t[3] || (t[3] = [
84
+ r("deprecated")
72
85
  ])),
73
86
  _: 1
74
87
  })
75
- ])) : u("", !0),
76
- (B = e.value) != null && B.const || (b = e.value) != null && b.enum && e.value.enum.length === 1 ? (r(), i("div", Q, [
77
- s(o, { truncate: "" }, {
78
- prefix: t(() => l[4] || (l[4] = [
79
- a("const:")
88
+ ])) : m("", !0),
89
+ e != null && e.const || e != null && e.enum && e.enum.length === 1 ? (i(), s("div", $, [
90
+ u(p, { truncate: "" }, {
91
+ prefix: n(() => t[4] || (t[4] = [
92
+ r("const:")
80
93
  ])),
81
- default: t(() => [
82
- a(" " + n(e.value.const ?? e.value.enum[0]), 1)
94
+ default: n(() => [
95
+ r(" " + d(e.const ?? e.enum[0]), 1)
83
96
  ]),
84
97
  _: 1
85
98
  })
86
- ])) : (q = e.value) != null && q.type ? (r(), i(d, { key: 5 }, [
87
- s(o, null, {
88
- default: t(() => {
89
- var E, L, M;
99
+ ])) : e != null && e.type ? (i(), s(a, { key: 5 }, [
100
+ u(p, null, {
101
+ default: n(() => {
102
+ var g;
90
103
  return [
91
- s(v, null, {
92
- default: t(() => l[5] || (l[5] = [
93
- a("Type:")
104
+ u(x, null, {
105
+ default: n(() => t[5] || (t[5] = [
106
+ r("Type:")
94
107
  ])),
95
108
  _: 1
96
109
  }),
97
- (L = (E = e.value) == null ? void 0 : E.items) != null && L.type ? (r(), i(d, { key: 0 }, [
98
- a(n(e.value.type) + " " + n(e.value.items.type) + "[] ", 1)
99
- ], 64)) : (r(), i(d, { key: 1 }, [
100
- a(n(Array.isArray(e.value.type) ? e.value.type.join(" | ") : e.value.type) + " " + n((M = e.value) != null && M.nullable ? " | nullable" : ""), 1)
110
+ (g = e == null ? void 0 : e.items) != null && g.type ? (i(), s(a, { key: 0 }, [
111
+ r(d(e.type) + " " + d(P(e.items) || e.items.type) + "[] ", 1)
112
+ ], 64)) : (i(), s(a, { key: 1 }, [
113
+ r(d(Array.isArray(e.type) ? e.type.join(" | ") : e.type) + " " + d(e != null && e.nullable ? " | nullable" : ""), 1)
101
114
  ], 64)),
102
- e.value.minItems || e.value.maxItems ? (r(), i(d, { key: 2 }, [
103
- a(n(e.value.minItems) + "…" + n(e.value.maxItems), 1)
104
- ], 64)) : u("", !0)
115
+ e.minItems || e.maxItems ? (i(), s(a, { key: 2 }, [
116
+ r(d(e.minItems) + "…" + d(e.maxItems), 1)
117
+ ], 64)) : m("", !0)
105
118
  ];
106
119
  }),
107
120
  _: 1
108
121
  }),
109
- e.value.minLength ? (r(), m(o, { key: 0 }, {
110
- prefix: t(() => l[6] || (l[6] = [
111
- a("min:")
122
+ e.minLength ? (i(), l(p, { key: 0 }, {
123
+ prefix: n(() => t[6] || (t[6] = [
124
+ r("min:")
112
125
  ])),
113
- default: t(() => [
114
- a(" " + n(e.value.minLength), 1)
126
+ default: n(() => [
127
+ r(" " + d(e.minLength), 1)
115
128
  ]),
116
129
  _: 1
117
- })) : u("", !0),
118
- e.value.maxLength ? (r(), m(o, { key: 1 }, {
119
- prefix: t(() => l[7] || (l[7] = [
120
- a("max:")
130
+ })) : m("", !0),
131
+ e.maxLength ? (i(), l(p, { key: 1 }, {
132
+ prefix: n(() => t[7] || (t[7] = [
133
+ r("max:")
121
134
  ])),
122
- default: t(() => [
123
- a(" " + n(e.value.maxLength), 1)
135
+ default: n(() => [
136
+ r(" " + d(e.maxLength), 1)
124
137
  ]),
125
138
  _: 1
126
- })) : u("", !0),
127
- e.value.uniqueItems ? (r(), m(o, { key: 2 }, {
128
- default: t(() => l[8] || (l[8] = [
129
- a(" unique! ")
139
+ })) : m("", !0),
140
+ e.uniqueItems ? (i(), l(p, { key: 2 }, {
141
+ default: n(() => t[8] || (t[8] = [
142
+ r(" unique! ")
130
143
  ])),
131
144
  _: 1
132
- })) : u("", !0),
133
- e.value.format ? (r(), m(o, { key: 3 }, {
134
- default: t(() => [
135
- s(v, null, {
136
- default: t(() => l[9] || (l[9] = [
137
- a("Format:")
145
+ })) : m("", !0),
146
+ e.format ? (i(), l(p, { key: 3 }, {
147
+ default: n(() => [
148
+ u(x, null, {
149
+ default: n(() => t[9] || (t[9] = [
150
+ r("Format:")
138
151
  ])),
139
152
  _: 1
140
153
  }),
141
- a(" " + n(e.value.format), 1)
154
+ r(" " + d(e.format), 1)
142
155
  ]),
143
156
  _: 1
144
- })) : u("", !0),
145
- e.value.minimum !== void 0 && e.value.exclusiveMinimum ? (r(), m(o, { key: 4 }, {
146
- prefix: t(() => l[10] || (l[10] = [
147
- a("greater than:")
157
+ })) : m("", !0),
158
+ e.minimum !== void 0 && e.exclusiveMinimum ? (i(), l(p, { key: 4 }, {
159
+ prefix: n(() => t[10] || (t[10] = [
160
+ r("greater than:")
148
161
  ])),
149
- default: t(() => [
150
- a(" " + n(e.value.minimum), 1)
162
+ default: n(() => [
163
+ r(" " + d(e.minimum), 1)
151
164
  ]),
152
165
  _: 1
153
- })) : u("", !0),
154
- e.value.minimum !== void 0 && !e.value.exclusiveMinimum ? (r(), m(o, { key: 5 }, {
155
- prefix: t(() => l[11] || (l[11] = [
156
- a("min:")
166
+ })) : m("", !0),
167
+ e.minimum !== void 0 && !e.exclusiveMinimum ? (i(), l(p, { key: 5 }, {
168
+ prefix: n(() => t[11] || (t[11] = [
169
+ r("min:")
157
170
  ])),
158
- default: t(() => [
159
- a(" " + n(e.value.minimum), 1)
171
+ default: n(() => [
172
+ r(" " + d(e.minimum), 1)
160
173
  ]),
161
174
  _: 1
162
- })) : u("", !0),
163
- e.value.maximum !== void 0 && e.value.exclusiveMaximum ? (r(), m(o, { key: 6 }, {
164
- prefix: t(() => l[12] || (l[12] = [
165
- a("less than:")
175
+ })) : m("", !0),
176
+ e.maximum !== void 0 && e.exclusiveMaximum ? (i(), l(p, { key: 6 }, {
177
+ prefix: n(() => t[12] || (t[12] = [
178
+ r("less than:")
166
179
  ])),
167
- default: t(() => [
168
- a(" " + n(e.value.maximum), 1)
180
+ default: n(() => [
181
+ r(" " + d(e.maximum), 1)
169
182
  ]),
170
183
  _: 1
171
- })) : u("", !0),
172
- e.value.maximum !== void 0 && !e.value.exclusiveMaximum ? (r(), m(o, { key: 7 }, {
173
- prefix: t(() => l[13] || (l[13] = [
174
- a("max:")
184
+ })) : m("", !0),
185
+ e.maximum !== void 0 && !e.exclusiveMaximum ? (i(), l(p, { key: 7 }, {
186
+ prefix: n(() => t[13] || (t[13] = [
187
+ r("max:")
175
188
  ])),
176
- default: t(() => [
177
- a(" " + n(e.value.maximum), 1)
189
+ default: n(() => [
190
+ r(" " + d(e.maximum), 1)
178
191
  ]),
179
192
  _: 1
180
- })) : u("", !0),
181
- e.value.pattern ? (r(), m(o, {
193
+ })) : m("", !0),
194
+ e.pattern ? (i(), l(p, {
182
195
  key: 8,
183
196
  code: "",
184
197
  truncate: ""
185
198
  }, {
186
- default: t(() => [
187
- s(v, null, {
188
- default: t(() => l[14] || (l[14] = [
189
- a("Pattern:")
199
+ default: n(() => [
200
+ u(x, null, {
201
+ default: n(() => t[14] || (t[14] = [
202
+ r("Pattern:")
190
203
  ])),
191
204
  _: 1
192
205
  }),
193
- a(" " + n(e.value.pattern), 1)
206
+ r(" " + d(e.pattern), 1)
194
207
  ]),
195
208
  _: 1
196
- })) : u("", !0),
197
- e.$props.enum ? (r(), m(o, { key: 9 }, {
198
- default: t(() => l[15] || (l[15] = [
199
- a("enum")
209
+ })) : m("", !0),
210
+ o.$props.enum ? (i(), l(p, { key: 9 }, {
211
+ default: n(() => t[15] || (t[15] = [
212
+ r("enum")
200
213
  ])),
201
214
  _: 1
202
- })) : u("", !0),
203
- e.value.default !== void 0 ? (r(), m(o, {
215
+ })) : m("", !0),
216
+ e.default !== void 0 ? (i(), l(p, {
204
217
  key: 10,
205
218
  truncate: ""
206
219
  }, {
207
- prefix: t(() => l[16] || (l[16] = [
208
- a("default:")
220
+ prefix: n(() => t[16] || (t[16] = [
221
+ r("default:")
209
222
  ])),
210
- default: t(() => [
211
- a(" " + n(T(e.value)), 1)
223
+ default: n(() => [
224
+ r(" " + d(w(e)), 1)
212
225
  ]),
213
226
  _: 1
214
- })) : u("", !0)
215
- ], 64)) : (r(), i(d, { key: 6 }, [
216
- ((w = e.value) == null ? void 0 : w.nullable) === !0 ? (r(), m(o, { key: 0 }, {
217
- default: t(() => l[17] || (l[17] = [
218
- a(" nullable ")
227
+ })) : m("", !0)
228
+ ], 64)) : (i(), s(a, { key: 6 }, [
229
+ (e == null ? void 0 : e.nullable) === !0 ? (i(), l(p, { key: 0 }, {
230
+ default: n(() => t[17] || (t[17] = [
231
+ r(" nullable ")
219
232
  ])),
220
233
  _: 1
221
- })) : u("", !0)
234
+ })) : m("", !0)
222
235
  ], 64)),
223
- (P = e.value) != null && P.writeOnly ? (r(), i("div", U, " write-only ")) : (S = e.value) != null && S.readOnly ? (r(), i("div", W, " read-only ")) : u("", !0),
224
- e.required ? (r(), i("div", X, " required ")) : u("", !0),
225
- e.withExamples ? (r(), m(H, {
236
+ e != null && e.writeOnly ? (i(), s("div", D, " write-only ")) : e != null && e.readOnly ? (i(), s("div", F, " read-only ")) : m("", !0),
237
+ o.required ? (i(), s("div", O, " required ")) : m("", !0),
238
+ o.withExamples ? (i(), l(V, {
226
239
  key: 10,
227
- examples: (I = e.value) == null ? void 0 : I.examples,
228
- example: ((N = e.value) == null ? void 0 : N.example) || ((C = (A = e.value) == null ? void 0 : A.items) == null ? void 0 : C.example),
229
- "discriminator-type": y(D)
230
- }, null, 8, ["examples", "example", "discriminator-type"])) : u("", !0)
240
+ examples: e == null ? void 0 : e.examples,
241
+ example: (e == null ? void 0 : e.example) || ((y = e == null ? void 0 : e.items) == null ? void 0 : y.example),
242
+ "discriminator-type": k(q)
243
+ }, null, 8, ["examples", "example", "discriminator-type"])) : m("", !0)
231
244
  ]);
232
245
  };
233
246
  }
234
247
  });
235
248
  export {
236
- ee as default
249
+ Q as default
237
250
  };
@@ -1,33 +1,33 @@
1
- function f(p) {
2
- return !Array.isArray(p) || p.length === 0 ? {} : p.reduce((i, r) => {
1
+ function f(i) {
2
+ return !Array.isArray(i) || i.length === 0 ? {} : i.reduce((p, r) => {
3
3
  if (!r || typeof r != "object")
4
- return i;
4
+ return p;
5
5
  if (r.allOf) {
6
6
  const t = f(r.allOf);
7
- return f([i, t]);
7
+ return f([p, t]);
8
8
  }
9
- const e = typeof i == "object" ? { ...i } : {};
10
- if (r.properties && (e.properties = o(e.properties || {}, r.properties)), r.items) {
9
+ const e = typeof p == "object" ? { ...p } : {};
10
+ if (r.properties && (e.properties = s(e.properties || {}, r.properties)), r.items) {
11
11
  if (r.type === "array")
12
- e.items = l(e.items || {}, r.items);
12
+ e.items = d(e.items || {}, r.items);
13
13
  else if (r.type === "object" && r.items.allOf) {
14
14
  const t = f(r.items.allOf);
15
- e.properties = o(e.properties || {}, t.properties || {});
15
+ e.properties = s(e.properties || {}, t.properties || {});
16
16
  }
17
17
  }
18
- return n(e, r);
18
+ return l(e, r);
19
19
  }, {});
20
20
  }
21
- function o(p, i) {
22
- const r = typeof p == "object" ? { ...p } : {};
23
- return Object.entries(i).forEach(([e, t]) => {
24
- var s;
21
+ function s(i, p) {
22
+ const r = typeof i == "object" ? { ...i } : {};
23
+ return Object.entries(p).forEach(([e, t]) => {
24
+ var o;
25
25
  if (!t || typeof t != "object") {
26
26
  r[e] = t;
27
27
  return;
28
28
  }
29
29
  if (!r[e]) {
30
- t.type === "array" && ((s = t.items) != null && s.allOf) ? r[e] = {
30
+ t.type === "array" && ((o = t.items) != null && o.allOf) ? r[e] = {
31
31
  ...t,
32
32
  items: f(t.items.allOf)
33
33
  } : t.allOf ? r[e] = f(t.allOf) : r[e] = t;
@@ -39,31 +39,36 @@ function o(p, i) {
39
39
  r[e] = {
40
40
  ...r[e],
41
41
  type: "array",
42
- items: l(r[e].items || {}, t.items)
42
+ items: d(r[e].items || {}, t.items)
43
43
  };
44
44
  else {
45
- const d = r[e].properties || t.properties ? o(r[e].properties || {}, t.properties || {}) : void 0;
45
+ const n = r[e].properties || t.properties ? s(r[e].properties || {}, t.properties || {}) : void 0;
46
46
  r[e] = {
47
47
  ...r[e],
48
48
  ...t
49
- }, d && (r[e].properties = d);
49
+ }, n && (r[e].properties = n);
50
50
  }
51
51
  }), r;
52
52
  }
53
- function l(p, i) {
54
- if (p.allOf || i.allOf) {
55
- const e = [...p.allOf || [p], ...i.allOf || [i]];
53
+ function d(i, p) {
54
+ if (i.allOf || p.allOf) {
55
+ const e = [...i.allOf || [i], ...p.allOf || [p]];
56
56
  return f(e);
57
57
  }
58
58
  const r = {
59
- ...p,
60
- ...i
59
+ ...i,
60
+ ...p
61
61
  };
62
- return (r.properties || i.properties) && (r.properties = o(r.properties || {}, i.properties || {})), r;
62
+ return (r.properties || p.properties) && (r.properties = s(r.properties || {}, p.properties || {})), r;
63
63
  }
64
- const n = (p, i) => {
65
- const r = typeof p == "object" ? { ...p } : {};
66
- return i.required && Array.isArray(i.required) && (r.required = [...p.required || [], ...i.required]), i.type && !p.type && (r.type = i.type), i.description && !p.description && (r.description = i.description), r;
64
+ const l = (i, p) => {
65
+ const r = typeof i == "object" ? { ...i } : {};
66
+ return p.required && Array.isArray(p.required) && (r.required = [...i.required || [], ...p.required]), p.type && !i.type && (r.type = p.type), p.description && !i.description && (r.description = p.description), ["oneOf", "anyOf"].forEach((e) => {
67
+ const t = p[e];
68
+ t && t.forEach((o) => {
69
+ o.properties && (r.properties = s(r.properties || {}, o.properties));
70
+ });
71
+ }), r;
67
72
  };
68
73
  export {
69
74
  f as mergeAllOfSchemas