@scalar/api-reference 1.43.4 → 1.43.7

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 (128) hide show
  1. package/CHANGELOG.md +85 -0
  2. package/dist/blocks/scalar-client-selector-block/components/ClientDropdown.vue2.js +7 -7
  3. package/dist/blocks/scalar-client-selector-block/components/ClientSelector.vue2.js +5 -5
  4. package/dist/blocks/scalar-info-block/components/DownloadLink.vue.js +1 -1
  5. package/dist/blocks/scalar-info-block/components/DownloadLink.vue2.js +5 -5
  6. package/dist/blocks/scalar-info-block/components/InfoBlock.vue.js +11 -11
  7. package/dist/blocks/scalar-info-block/components/InfoDescription.vue2.js +2 -2
  8. package/dist/blocks/scalar-info-block/components/InfoLinks.vue.js +7 -7
  9. package/dist/blocks/scalar-info-block/components/InfoMarkdownSection.vue.js +2 -2
  10. package/dist/blocks/scalar-info-block/components/IntroductionCard.vue2.js +1 -1
  11. package/dist/blocks/scalar-info-block/components/IntroductionLayout.vue2.js +16 -16
  12. package/dist/blocks/scalar-info-block/components/OpenApiVersion.vue.js +2 -2
  13. package/dist/blocks/scalar-server-selector-block/components/Selector.vue.js +1 -1
  14. package/dist/blocks/scalar-server-selector-block/components/ServerSelector.vue.js +7 -7
  15. package/dist/browser/standalone.js +18486 -18113
  16. package/dist/browser/webpack-stats.json +1 -1
  17. package/dist/components/Anchor/WithBreadcrumb.vue.js +3 -3
  18. package/dist/components/ApiReference.vue.d.ts.map +1 -1
  19. package/dist/components/ApiReference.vue.js +1 -1
  20. package/dist/components/ApiReference.vue2.js +16 -11
  21. package/dist/components/Content/Auth/Auth.vue.js +7 -7
  22. package/dist/components/Content/Content.vue.js +28 -28
  23. package/dist/components/Content/Models/Model.vue.js +14 -14
  24. package/dist/components/Content/Models/ModelTag.vue.js +8 -8
  25. package/dist/components/Content/Models/components/ClassicLayout.vue2.js +15 -15
  26. package/dist/components/Content/Models/components/ModernLayout.vue.js +11 -11
  27. package/dist/components/Content/Operations/TraversedEntry.vue.js +51 -51
  28. package/dist/components/Content/Schema/Schema.vue2.js +40 -40
  29. package/dist/components/Content/Schema/SchemaComposition.vue.js +17 -17
  30. package/dist/components/Content/Schema/SchemaEnumPropertyItem.vue2.js +3 -3
  31. package/dist/components/Content/Schema/SchemaHeading.vue2.js +7 -7
  32. package/dist/components/Content/Schema/SchemaObjectProperties.vue.js +31 -31
  33. package/dist/components/Content/Schema/SchemaProperty.vue.d.ts +2 -2
  34. package/dist/components/Content/Schema/SchemaProperty.vue.d.ts.map +1 -1
  35. package/dist/components/Content/Schema/SchemaProperty.vue.js +1 -1
  36. package/dist/components/Content/Schema/SchemaProperty.vue2.js +88 -147
  37. package/dist/components/Content/Schema/SchemaPropertyDetail.vue2.js +2 -2
  38. package/dist/components/Content/Schema/SchemaPropertyExamples.vue2.js +6 -6
  39. package/dist/components/Content/Schema/helpers/get-compositions-to-render.d.ts +14 -0
  40. package/dist/components/Content/Schema/helpers/get-compositions-to-render.d.ts.map +1 -0
  41. package/dist/components/Content/Schema/helpers/get-compositions-to-render.js +31 -0
  42. package/dist/components/Content/Schema/helpers/get-enum-values.d.ts +9 -0
  43. package/dist/components/Content/Schema/helpers/get-enum-values.d.ts.map +1 -0
  44. package/dist/components/Content/Schema/helpers/get-enum-values.js +20 -0
  45. package/dist/components/Content/Schema/helpers/get-property-description.d.ts +9 -0
  46. package/dist/components/Content/Schema/helpers/get-property-description.d.ts.map +1 -0
  47. package/dist/components/Content/Schema/helpers/get-property-description.js +34 -0
  48. package/dist/components/Content/Schema/helpers/has-complex-array-items.d.ts +10 -0
  49. package/dist/components/Content/Schema/helpers/has-complex-array-items.d.ts.map +1 -0
  50. package/dist/components/Content/Schema/helpers/has-complex-array-items.js +48 -0
  51. package/dist/components/Content/Schema/helpers/should-display-description.d.ts +10 -0
  52. package/dist/components/Content/Schema/helpers/should-display-description.d.ts.map +1 -0
  53. package/dist/components/Content/Schema/helpers/should-display-description.js +12 -0
  54. package/dist/components/Content/Schema/helpers/should-display-heading.d.ts +11 -0
  55. package/dist/components/Content/Schema/helpers/should-display-heading.d.ts.map +1 -0
  56. package/dist/components/Content/Schema/helpers/should-display-heading.js +12 -0
  57. package/dist/components/Content/Schema/helpers/should-render-array-item-composition.d.ts +10 -0
  58. package/dist/components/Content/Schema/helpers/should-render-array-item-composition.d.ts.map +1 -0
  59. package/dist/components/Content/Schema/helpers/should-render-array-item-composition.js +15 -0
  60. package/dist/components/Content/Tags/Tag.vue.js +11 -11
  61. package/dist/components/Content/Tags/components/ClassicLayout.vue2.js +6 -6
  62. package/dist/components/Content/Tags/components/ModernLayout.vue2.js +10 -10
  63. package/dist/components/Content/Tags/components/TagSection.vue.js +14 -14
  64. package/dist/components/Content/index.d.ts +1 -0
  65. package/dist/components/Content/index.d.ts.map +1 -1
  66. package/dist/components/GettingStarted.vue2.js +1 -1
  67. package/dist/components/HttpMethod/HttpMethod.vue.js +3 -3
  68. package/dist/components/IntersectionObserver.vue.js +2 -2
  69. package/dist/components/LoadingSkeleton.vue2.js +2 -2
  70. package/dist/components/MobileHeader.vue.js +6 -6
  71. package/dist/components/OperationPath.vue2.js +1 -1
  72. package/dist/components/OperationsList/OperationsList.vue2.js +5 -5
  73. package/dist/components/OperationsList/OperationsListItem.vue2.js +8 -8
  74. package/dist/components/RenderPlugins/RenderPlugins.vue.js +2 -2
  75. package/dist/components/Section/CompactSection.vue2.js +9 -9
  76. package/dist/components/Section/SectionAccordion.vue2.js +5 -5
  77. package/dist/components/Section/SectionContainer.vue2.js +1 -1
  78. package/dist/components/Section/SectionContainerAccordion.vue2.js +3 -3
  79. package/dist/components/Section/SectionContent.vue2.js +1 -1
  80. package/dist/components/Section/SectionHeader.vue2.js +2 -2
  81. package/dist/components/Section/SectionHeaderTag.vue2.js +1 -1
  82. package/dist/components/index.d.ts +1 -0
  83. package/dist/components/index.d.ts.map +1 -1
  84. package/dist/components/index.js +18 -16
  85. package/dist/features/Operation/Operation.vue.js +18 -18
  86. package/dist/features/Operation/components/Header.vue.js +8 -8
  87. package/dist/features/Operation/components/Headers.vue2.js +5 -5
  88. package/dist/features/Operation/components/OperationParameters.vue.js +17 -17
  89. package/dist/features/Operation/components/OperationResponses.vue.js +6 -6
  90. package/dist/features/Operation/components/ParameterList.vue.js +6 -6
  91. package/dist/features/Operation/components/ParameterListItem.vue2.js +16 -16
  92. package/dist/features/Operation/components/RequestBody.vue2.js +17 -17
  93. package/dist/features/Operation/components/callbacks/Callback.vue2.js +10 -10
  94. package/dist/features/Operation/components/callbacks/Callbacks.vue.js +3 -3
  95. package/dist/features/Operation/layouts/ClassicLayout.vue2.js +49 -49
  96. package/dist/features/Operation/layouts/ModernLayout.vue2.js +50 -50
  97. package/dist/features/Search/components/SearchButton.vue.js +5 -5
  98. package/dist/features/Search/components/SearchModal.vue2.js +1 -1
  99. package/dist/features/Search/components/SearchResult.vue.js +14 -14
  100. package/dist/features/example-responses/ExampleResponse.vue2.js +3 -3
  101. package/dist/features/external-docs/ExternalDocs.vue.js +3 -3
  102. package/dist/features/info-object/Contact.vue.js +6 -6
  103. package/dist/features/info-object/License.vue.js +4 -4
  104. package/dist/features/info-object/TermsOfService.vue.js +2 -2
  105. package/dist/features/multiple-documents/DocumentSelector.vue.js +1 -1
  106. package/dist/features/specification-extension/SpecificationExtension.vue2.js +3 -3
  107. package/dist/features/test-request-button/TestRequestButton.vue2.js +2 -2
  108. package/dist/features/toolbar/ApiReferenceToolbar.vue.js +4 -4
  109. package/dist/features/toolbar/ApiReferenceToolbarConfig.vue.js +1 -1
  110. package/dist/features/toolbar/ApiReferenceToolbarSdks.vue.js +1 -1
  111. package/dist/features/toolbar/ApiReferenceToolbarShare.vue.js +2 -2
  112. package/dist/features/toolbar/ApiReferenceToolbarShareRegister.vue.js +1 -1
  113. package/dist/helpers/id-routing.d.ts.map +1 -1
  114. package/dist/helpers/id-routing.js +7 -1
  115. package/dist/helpers/load-from-perssistance.d.ts +32 -0
  116. package/dist/helpers/load-from-perssistance.d.ts.map +1 -0
  117. package/dist/helpers/load-from-perssistance.js +74 -0
  118. package/dist/helpers/map-config-plugins.d.ts +17 -2
  119. package/dist/helpers/map-config-plugins.d.ts.map +1 -1
  120. package/dist/helpers/map-config-plugins.js +20 -22
  121. package/dist/helpers/map-config-to-workspace-store.d.ts.map +1 -1
  122. package/dist/helpers/map-config-to-workspace-store.js +1 -8
  123. package/dist/helpers/storage.d.ts +6 -6
  124. package/dist/helpers/storage.d.ts.map +1 -1
  125. package/dist/helpers/storage.js +15 -10
  126. package/dist/plugins/hooks/usePluginManager.js +1 -1
  127. package/dist/style.css +133 -116
  128. package/package.json +31 -31
@@ -1,11 +1,15 @@
1
1
  import { defineComponent, computed, createBlock, openBlock, resolveDynamicComponent, normalizeClass, withCtx, createCommentVNode, createElementBlock, createVNode, createSlots, unref, createTextVNode, toDisplayString, Fragment, renderList } from "vue";
2
2
  import { ScalarWrappingText, ScalarMarkdown } from "@scalar/components";
3
- import { isDefined } from "@scalar/helpers/array/is-defined";
4
3
  import { getResolvedRef } from "@scalar/workspace-store/helpers/get-resolved-ref";
5
4
  import { isArraySchema } from "@scalar/workspace-store/schemas/v3.1/strict/type-guards";
6
5
  import { isTypeObject } from "./helpers/is-type-object.js";
6
+ import { getCompositionsToRender } from "./helpers/get-compositions-to-render.js";
7
+ import { getEnumValues } from "./helpers/get-enum-values.js";
8
+ import { getPropertyDescription } from "./helpers/get-property-description.js";
9
+ import { hasComplexArrayItems } from "./helpers/has-complex-array-items.js";
7
10
  import { optimizeValueForDisplay } from "./helpers/optimize-value-for-display.js";
8
- import { compositions } from "./helpers/schema-composition.js";
11
+ import { shouldDisplayDescription } from "./helpers/should-display-description.js";
12
+ import { shouldDisplayHeading } from "./helpers/should-display-heading.js";
9
13
  import Schema from "./Schema.vue.js";
10
14
  import _sfc_main$2 from "./SchemaComposition.vue.js";
11
15
  import SchemaEnumValues from "./SchemaEnumValues.vue.js";
@@ -25,17 +29,13 @@ const _hoisted_3 = {
25
29
  class: "property-description"
26
30
  };
27
31
  const _hoisted_4 = {
28
- key: 2,
29
- class: "property-description"
32
+ key: 3,
33
+ class: "children"
30
34
  };
31
35
  const _hoisted_5 = {
32
36
  key: 4,
33
37
  class: "children"
34
38
  };
35
- const _hoisted_6 = {
36
- key: 0,
37
- class: "children"
38
- };
39
39
  const _sfc_main = /* @__PURE__ */ defineComponent({
40
40
  __name: "SchemaProperty",
41
41
  props: {
@@ -57,149 +57,94 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
57
57
  },
58
58
  setup(__props) {
59
59
  const props = __props;
60
+ const optimizedValue = computed(() => optimizeValueForDisplay(props.schema));
60
61
  const childBreadcrumb = computed(
61
62
  () => props.breadcrumb && props.name ? [...props.breadcrumb, props.name] : void 0
62
63
  );
63
- const descriptions = {
64
- integer: {
65
- _default: "Integer numbers.",
66
- int32: "Signed 32-bit integers (commonly used integer type).",
67
- int64: "Signed 64-bit integers (long type)."
68
- },
69
- string: {
70
- "date": "full-date notation as defined by RFC 3339, section 5.6, for example, 2017-07-21",
71
- "date-time": "the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z",
72
- "password": "a hint to UIs to mask the input",
73
- "base64": "base64-encoded characters, for example, U3dhZ2dlciByb2Nrcw==",
74
- "byte": "base64-encoded characters, for example, U3dhZ2dlciByb2Nrcw==",
75
- "binary": "binary data, used to describe files"
76
- }
77
- };
78
- const generatePropertyDescription = (property) => {
79
- if (!property) {
80
- return null;
81
- }
82
- if (!descriptions[property.type]) {
83
- return null;
84
- }
85
- return descriptions[property.type]?.[property.format || property.contentEncoding || "_default"] || null;
86
- };
87
- const getEnumFromValue = (value) => value?.enum || value?.items?.enum || [];
88
- const optimizedValue = computed(() => optimizeValueForDisplay(props.schema));
89
- const displayDescription = computed(() => {
64
+ const shouldHaveLink = computed(() => props.level <= 1);
65
+ const hasComplexArrayItemsComputed = computed(
66
+ () => hasComplexArrayItems(optimizedValue.value)
67
+ );
68
+ const hasEnum = computed(() => enumValues.value.length > 0);
69
+ const shouldRenderObjectProperties = computed(() => {
90
70
  const value = optimizedValue.value;
91
71
  if (!value) {
92
- return null;
93
- }
94
- if ("properties" in value) {
95
- return null;
96
- }
97
- if ("additionalProperties" in value) {
98
- return null;
99
- }
100
- if ("patternProperties" in value) {
101
- return null;
102
- }
103
- if (value?.allOf) {
104
- return null;
105
- }
106
- if (value?.allOf) {
107
- return null;
72
+ return false;
108
73
  }
109
- return props.description || value?.description || null;
74
+ return isTypeObject(value) && ("properties" in value || "additionalProperties" in value);
110
75
  });
111
- const displayPropertyHeading = (value, name, required) => {
112
- return name || value?.deprecated || value?.const !== void 0 || value?.enum && value.enum.length === 1 || value?.type || value?.nullable === true || value?.writeOnly || value?.readOnly || required;
113
- };
114
- const hasComplexArrayItems = computed(() => {
76
+ const shouldRenderArrayOfObjects = computed(() => {
115
77
  const value = optimizedValue.value;
116
78
  if (!value || !isArraySchema(value) || typeof value.items !== "object") {
117
79
  return false;
118
80
  }
119
- const items = value.items;
120
- return "type" in items && items.type && (Array.isArray(items.type) ? items.type.includes("object") : ["object"].includes(items.type)) || "properties" in items || "$ref" in items || "discriminator" in items || "allOf" in items || "oneOf" in items || "anyOf" in items;
81
+ return hasComplexArrayItemsComputed.value;
121
82
  });
122
- const shouldRenderArrayItemComposition = (composition) => {
123
- const value = optimizedValue.value;
124
- if (value && isArraySchema(value) === false || !value?.items || typeof value.items !== "object" || !(composition in value.items)) {
125
- return false;
126
- }
127
- return !hasComplexArrayItems.value;
128
- };
129
- const shouldRenderArrayOfObjects = computed(() => hasComplexArrayItems.value);
130
- const shouldRenderObjectProperties = computed(() => {
131
- if (!optimizedValue.value) {
132
- return false;
133
- }
83
+ const enumValues = computed(() => getEnumValues(optimizedValue.value));
84
+ const propertyDescription = computed(
85
+ () => getPropertyDescription(optimizedValue.value)
86
+ );
87
+ const displayDescription = computed(
88
+ () => shouldDisplayDescription(optimizedValue.value, props.description)
89
+ );
90
+ const shouldDisplayHeadingComputed = computed(
91
+ () => shouldDisplayHeading(optimizedValue.value, props.name, props.required)
92
+ );
93
+ const compositionsToRender = computed(
94
+ () => getCompositionsToRender(optimizedValue.value)
95
+ );
96
+ const resolvedArrayItems = computed(() => {
134
97
  const value = optimizedValue.value;
135
- const isObjectType = isTypeObject(value);
136
- const hasPropertiesToRender = "properties" in value || "additionalProperties" in value;
137
- return isObjectType && hasPropertiesToRender;
138
- });
139
- const shouldHaveLink = computed(() => props.level <= 1);
140
- const compositionsToRender = computed(() => {
141
- if (!optimizedValue.value) {
142
- return [];
98
+ if (!value || !isArraySchema(value) || typeof value.items !== "object") {
99
+ return void 0;
143
100
  }
144
- return compositions.map((composition) => {
145
- const hasPropertyComposition = optimizedValue.value?.[composition] && !(isArraySchema(optimizedValue.value) && optimizedValue.value?.items && typeof composition === "string" && typeof optimizedValue.value.items === "object" && composition in optimizedValue.value.items);
146
- if (hasPropertyComposition) {
147
- return {
148
- composition,
149
- value: optimizedValue.value
150
- };
151
- }
152
- if (shouldRenderArrayItemComposition(composition) && optimizedValue.value && isArraySchema(optimizedValue.value) && optimizedValue.value.items) {
153
- return {
154
- composition,
155
- value: optimizedValue.value.items
156
- };
157
- }
158
- return null;
159
- }).filter(isDefined);
101
+ return getResolvedRef(value.items);
160
102
  });
103
+ const isDiscriminatorProperty = computed(
104
+ () => Boolean(props.name && props.discriminator?.propertyName === props.name)
105
+ );
161
106
  return (_ctx, _cache) => {
162
- return openBlock(), createBlock(resolveDynamicComponent(_ctx.is ?? "li"), {
107
+ return openBlock(), createBlock(resolveDynamicComponent(__props.is ?? "li"), {
163
108
  class: normalizeClass(["property", [
164
- `property--level-${_ctx.level}`,
109
+ `property--level-${__props.level}`,
165
110
  {
166
- "property--compact": _ctx.compact,
111
+ "property--compact": __props.compact,
167
112
  "property--deprecated": optimizedValue.value?.deprecated
168
113
  }
169
114
  ]])
170
115
  }, {
171
116
  default: withCtx(() => [
172
- displayPropertyHeading(optimizedValue.value, _ctx.name, _ctx.required) ? (openBlock(), createBlock(SchemaPropertyHeading, {
117
+ shouldDisplayHeadingComputed.value ? (openBlock(), createBlock(SchemaPropertyHeading, {
173
118
  key: 0,
174
119
  class: "group",
175
- enum: getEnumFromValue(optimizedValue.value).length > 0,
176
- hideModelNames: _ctx.hideModelNames,
177
- isDiscriminator: _ctx.discriminator && _ctx.discriminator.propertyName === _ctx.name,
178
- required: _ctx.required,
120
+ enum: hasEnum.value,
121
+ hideModelNames: __props.hideModelNames,
122
+ isDiscriminator: isDiscriminatorProperty.value,
123
+ required: __props.required,
179
124
  value: optimizedValue.value
180
125
  }, createSlots({ _: 2 }, [
181
- _ctx.name ? {
126
+ __props.name ? {
182
127
  name: "name",
183
128
  fn: withCtx(() => [
184
129
  createVNode(unref(_sfc_main$1), {
185
130
  breadcrumb: shouldHaveLink.value ? childBreadcrumb.value : void 0,
186
- eventBus: _ctx.eventBus
131
+ eventBus: __props.eventBus
187
132
  }, {
188
133
  default: withCtx(() => [
189
- _ctx.variant === "patternProperties" ? (openBlock(), createElementBlock("span", _hoisted_1, [
134
+ __props.variant === "patternProperties" ? (openBlock(), createElementBlock("span", _hoisted_1, [
190
135
  createVNode(unref(ScalarWrappingText), {
191
- text: _ctx.name,
192
- preset: "property"
136
+ preset: "property",
137
+ text: __props.name
193
138
  }, null, 8, ["text"])
194
- ])) : _ctx.variant === "additionalProperties" ? (openBlock(), createElementBlock("span", _hoisted_2, [
139
+ ])) : __props.variant === "additionalProperties" ? (openBlock(), createElementBlock("span", _hoisted_2, [
195
140
  createVNode(unref(ScalarWrappingText), {
196
- text: _ctx.name,
197
- preset: "property"
141
+ preset: "property",
142
+ text: __props.name
198
143
  }, null, 8, ["text"])
199
144
  ])) : (openBlock(), createBlock(unref(ScalarWrappingText), {
200
145
  key: 2,
201
- text: _ctx.name,
202
- preset: "property"
146
+ preset: "property",
147
+ text: __props.name
203
148
  }, null, 8, ["text"]))
204
149
  ]),
205
150
  _: 1
@@ -215,55 +160,51 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
215
160
  key: "1"
216
161
  } : void 0
217
162
  ]), 1032, ["enum", "hideModelNames", "isDiscriminator", "required", "value"])) : createCommentVNode("", true),
218
- displayDescription.value ? (openBlock(), createElementBlock("div", _hoisted_3, [
219
- createVNode(unref(ScalarMarkdown), { value: displayDescription.value }, null, 8, ["value"])
220
- ])) : generatePropertyDescription(optimizedValue.value) ? (openBlock(), createElementBlock("div", _hoisted_4, [
163
+ displayDescription.value || propertyDescription.value ? (openBlock(), createElementBlock("div", _hoisted_3, [
221
164
  createVNode(unref(ScalarMarkdown), {
222
- value: generatePropertyDescription(optimizedValue.value) || ""
165
+ value: displayDescription.value || propertyDescription.value || ""
223
166
  }, null, 8, ["value"])
224
167
  ])) : createCommentVNode("", true),
225
- (optimizedValue.value?.enum || optimizedValue.value && unref(isArraySchema)(optimizedValue.value) && unref(getResolvedRef)(optimizedValue.value?.items)?.enum || []).length ? (openBlock(), createBlock(SchemaEnumValues, {
226
- key: 3,
168
+ hasEnum.value ? (openBlock(), createBlock(SchemaEnumValues, {
169
+ key: 2,
227
170
  value: optimizedValue.value
228
171
  }, null, 8, ["value"])) : createCommentVNode("", true),
229
- shouldRenderObjectProperties.value ? (openBlock(), createElementBlock("div", _hoisted_5, [
172
+ shouldRenderObjectProperties.value ? (openBlock(), createElementBlock("div", _hoisted_4, [
230
173
  createVNode(Schema, {
231
174
  breadcrumb: childBreadcrumb.value,
232
- compact: _ctx.compact,
233
- eventBus: _ctx.eventBus,
234
- level: _ctx.level + 1,
235
- name: _ctx.name,
236
- noncollapsible: _ctx.noncollapsible,
237
- options: _ctx.options,
175
+ compact: __props.compact,
176
+ eventBus: __props.eventBus,
177
+ level: __props.level + 1,
178
+ name: __props.name,
179
+ noncollapsible: __props.noncollapsible,
180
+ options: __props.options,
238
181
  schema: optimizedValue.value
239
182
  }, null, 8, ["breadcrumb", "compact", "eventBus", "level", "name", "noncollapsible", "options", "schema"])
240
183
  ])) : createCommentVNode("", true),
241
- optimizedValue.value && unref(isArraySchema)(optimizedValue.value) && typeof optimizedValue.value.items === "object" ? (openBlock(), createElementBlock(Fragment, { key: 5 }, [
242
- shouldRenderArrayOfObjects.value ? (openBlock(), createElementBlock("div", _hoisted_6, [
243
- createVNode(Schema, {
244
- compact: _ctx.compact,
245
- eventBus: _ctx.eventBus,
246
- level: _ctx.level + 1,
247
- name: _ctx.name,
248
- noncollapsible: _ctx.noncollapsible,
249
- options: _ctx.options,
250
- schema: unref(getResolvedRef)(optimizedValue.value.items)
251
- }, null, 8, ["compact", "eventBus", "level", "name", "noncollapsible", "options", "schema"])
252
- ])) : createCommentVNode("", true)
253
- ], 64)) : createCommentVNode("", true),
184
+ shouldRenderArrayOfObjects.value && resolvedArrayItems.value ? (openBlock(), createElementBlock("div", _hoisted_5, [
185
+ createVNode(Schema, {
186
+ compact: __props.compact,
187
+ eventBus: __props.eventBus,
188
+ level: __props.level + 1,
189
+ name: __props.name,
190
+ noncollapsible: __props.noncollapsible,
191
+ options: __props.options,
192
+ schema: resolvedArrayItems.value
193
+ }, null, 8, ["compact", "eventBus", "level", "name", "noncollapsible", "options", "schema"])
194
+ ])) : createCommentVNode("", true),
254
195
  (openBlock(true), createElementBlock(Fragment, null, renderList(compositionsToRender.value, (compositionData) => {
255
196
  return openBlock(), createBlock(_sfc_main$2, {
256
197
  key: compositionData.composition,
257
- breadcrumb: _ctx.breadcrumb,
258
- compact: _ctx.compact,
198
+ breadcrumb: __props.breadcrumb,
199
+ compact: __props.compact,
259
200
  composition: compositionData.composition,
260
- discriminator: _ctx.schema?.discriminator,
261
- eventBus: _ctx.eventBus,
262
- hideHeading: _ctx.hideHeading,
263
- level: _ctx.level,
264
- name: _ctx.name,
265
- noncollapsible: _ctx.noncollapsible,
266
- options: _ctx.options,
201
+ discriminator: __props.schema?.discriminator,
202
+ eventBus: __props.eventBus,
203
+ hideHeading: __props.hideHeading,
204
+ level: __props.level,
205
+ name: __props.name,
206
+ noncollapsible: __props.noncollapsible,
207
+ options: __props.options,
267
208
  schema: unref(getResolvedRef)(props.schema)
268
209
  }, null, 8, ["breadcrumb", "compact", "composition", "discriminator", "eventBus", "hideHeading", "level", "name", "noncollapsible", "options", "schema"]);
269
210
  }), 128)),
@@ -20,13 +20,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
20
20
  setup(__props) {
21
21
  return (_ctx, _cache) => {
22
22
  return openBlock(), createElementBlock("span", {
23
- class: normalizeClass(["property-detail", { "property-detail-truncate": _ctx.truncate }])
23
+ class: normalizeClass(["property-detail", { "property-detail-truncate": __props.truncate }])
24
24
  }, [
25
25
  _ctx.$slots.prefix ? (openBlock(), createElementBlock("div", _hoisted_1, [
26
26
  renderSlot(_ctx.$slots, "prefix", {}, void 0, true),
27
27
  _cache[0] || (_cache[0] = createTextVNode("  ", -1))
28
28
  ])) : createCommentVNode("", true),
29
- _ctx.code ? (openBlock(), createElementBlock("code", _hoisted_2, [
29
+ __props.code ? (openBlock(), createElementBlock("code", _hoisted_2, [
30
30
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
31
31
  ])) : (openBlock(), createElementBlock("span", _hoisted_3, [
32
32
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
@@ -27,7 +27,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
27
27
  const { copyToClipboard } = useClipboard();
28
28
  return (_ctx, _cache) => {
29
29
  return openBlock(), createElementBlock(Fragment, null, [
30
- _ctx.example ? (openBlock(), createElementBlock("div", _hoisted_1, [
30
+ __props.example ? (openBlock(), createElementBlock("div", _hoisted_1, [
31
31
  _cache[1] || (_cache[1] = createElementVNode("button", {
32
32
  class: "property-example-label",
33
33
  type: "button"
@@ -38,9 +38,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
38
38
  createElementVNode("button", {
39
39
  class: "property-example-value group",
40
40
  type: "button",
41
- onClick: _cache[0] || (_cache[0] = ($event) => unref(copyToClipboard)(unref(formatExample)(_ctx.example)))
41
+ onClick: _cache[0] || (_cache[0] = ($event) => unref(copyToClipboard)(unref(formatExample)(__props.example)))
42
42
  }, [
43
- createElementVNode("span", null, toDisplayString(unref(formatExample)(_ctx.example)), 1),
43
+ createElementVNode("span", null, toDisplayString(unref(formatExample)(__props.example)), 1),
44
44
  createVNode(unref(ScalarIcon), {
45
45
  class: "group-hover:text-c-1 text-c-3 ml-auto min-h-3 min-w-3",
46
46
  icon: "Clipboard",
@@ -49,12 +49,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
49
49
  ])
50
50
  ])
51
51
  ])) : createCommentVNode("", true),
52
- _ctx.examples && typeof _ctx.examples === "object" && Object.keys(_ctx.examples).length > 0 ? (openBlock(), createElementBlock("div", _hoisted_3, [
52
+ __props.examples && typeof __props.examples === "object" && Object.keys(__props.examples).length > 0 ? (openBlock(), createElementBlock("div", _hoisted_3, [
53
53
  createElementVNode("button", _hoisted_4, [
54
- createElementVNode("span", null, toDisplayString(Object.keys(_ctx.examples).length === 1 ? "Example" : "Examples"), 1)
54
+ createElementVNode("span", null, toDisplayString(Object.keys(__props.examples).length === 1 ? "Example" : "Examples"), 1)
55
55
  ]),
56
56
  createElementVNode("div", _hoisted_5, [
57
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.examples, (ex, key) => {
57
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.examples, (ex, key) => {
58
58
  return openBlock(), createElementBlock("button", {
59
59
  key,
60
60
  class: "property-example-value group",
@@ -0,0 +1,14 @@
1
+ import type { SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
2
+ import { type CompositionKeyword } from './schema-composition.js';
3
+ export type CompositionToRender = {
4
+ composition: CompositionKeyword;
5
+ value: SchemaObject;
6
+ };
7
+ /**
8
+ * Computes which compositions should be rendered and with which values
9
+ *
10
+ * @param value - The schema object to check for compositions
11
+ * @returns Array of compositions to render with their values
12
+ */
13
+ export declare const getCompositionsToRender: (value: SchemaObject | undefined) => CompositionToRender[];
14
+ //# sourceMappingURL=get-compositions-to-render.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-compositions-to-render.d.ts","sourceRoot":"","sources":["../../../../../src/components/Content/Schema/helpers/get-compositions-to-render.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAGhG,OAAO,EAAE,KAAK,kBAAkB,EAAgB,MAAM,sBAAsB,CAAA;AAG5E,MAAM,MAAM,mBAAmB,GAAG;IAChC,WAAW,EAAE,kBAAkB,CAAA;IAC/B,KAAK,EAAE,YAAY,CAAA;CACpB,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAAI,OAAO,YAAY,GAAG,SAAS,KAAG,mBAAmB,EAgC5F,CAAA"}
@@ -0,0 +1,31 @@
1
+ import { isDefined } from "@scalar/helpers/array/is-defined";
2
+ import { getResolvedRef } from "@scalar/workspace-store/helpers/get-resolved-ref";
3
+ import { isArraySchema } from "@scalar/workspace-store/schemas/v3.1/strict/type-guards";
4
+ import { compositions } from "./schema-composition.js";
5
+ import { shouldRenderArrayItemComposition } from "./should-render-array-item-composition.js";
6
+ const getCompositionsToRender = (value) => {
7
+ if (!value) {
8
+ return [];
9
+ }
10
+ return compositions.map((composition) => {
11
+ if (shouldRenderArrayItemComposition(value, composition) && isArraySchema(value) && value.items) {
12
+ return {
13
+ composition,
14
+ value: getResolvedRef(value.items)
15
+ };
16
+ }
17
+ if (value[composition]) {
18
+ const hasArrayItemComposition = isArraySchema(value) && value.items && typeof value.items === "object" && composition in value.items;
19
+ if (!hasArrayItemComposition) {
20
+ return {
21
+ composition,
22
+ value: getResolvedRef(value)
23
+ };
24
+ }
25
+ }
26
+ return null;
27
+ }).filter(isDefined);
28
+ };
29
+ export {
30
+ getCompositionsToRender
31
+ };
@@ -0,0 +1,9 @@
1
+ import type { SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
2
+ /**
3
+ * Extract enum values from schema or array items
4
+ *
5
+ * @param value - The schema object to extract enum values from
6
+ * @returns Array of enum values, or empty array if no enum found
7
+ */
8
+ export declare const getEnumValues: (value: SchemaObject | undefined) => unknown[];
9
+ //# sourceMappingURL=get-enum-values.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-enum-values.d.ts","sourceRoot":"","sources":["../../../../../src/components/Content/Schema/helpers/get-enum-values.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAGhG;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,YAAY,GAAG,SAAS,KAAG,OAAO,EAmBtE,CAAA"}
@@ -0,0 +1,20 @@
1
+ import { getResolvedRef } from "@scalar/workspace-store/helpers/get-resolved-ref";
2
+ import { isArraySchema } from "@scalar/workspace-store/schemas/v3.1/strict/type-guards";
3
+ const getEnumValues = (value) => {
4
+ if (!value) {
5
+ return [];
6
+ }
7
+ if (value.enum) {
8
+ return value.enum;
9
+ }
10
+ if (isArraySchema(value) && typeof value.items === "object") {
11
+ const resolvedItems = getResolvedRef(value.items);
12
+ if (resolvedItems && "enum" in resolvedItems && resolvedItems.enum) {
13
+ return resolvedItems.enum;
14
+ }
15
+ }
16
+ return [];
17
+ };
18
+ export {
19
+ getEnumValues
20
+ };
@@ -0,0 +1,9 @@
1
+ import type { SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
2
+ /**
3
+ * Generate property description from type/format
4
+ *
5
+ * @param value - The schema object to generate description from
6
+ * @returns Description string or null if no description available
7
+ */
8
+ export declare const getPropertyDescription: (value: SchemaObject | undefined) => string | null;
9
+ //# sourceMappingURL=get-property-description.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-property-description.d.ts","sourceRoot":"","sources":["../../../../../src/components/Content/Schema/helpers/get-property-description.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAoBhG;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GAAI,OAAO,YAAY,GAAG,SAAS,KAAG,MAAM,GAAG,IAkBjF,CAAA"}
@@ -0,0 +1,34 @@
1
+ import { isSchema } from "@scalar/workspace-store/schemas/v3.1/strict/type-guards";
2
+ const TYPE_DESCRIPTIONS = {
3
+ integer: {
4
+ _default: "Integer numbers.",
5
+ int32: "Signed 32-bit integers (commonly used integer type).",
6
+ int64: "Signed 64-bit integers (long type)."
7
+ },
8
+ string: {
9
+ "date": "full-date notation as defined by RFC 3339, section 5.6, for example, 2017-07-21",
10
+ "date-time": "the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z",
11
+ "password": "a hint to UIs to mask the input",
12
+ "base64": "base64-encoded characters, for example, U3dhZ2dlciByb2Nrcw==",
13
+ "byte": "base64-encoded characters, for example, U3dhZ2dlciByb2Nrcw==",
14
+ "binary": "binary data, used to describe files"
15
+ }
16
+ };
17
+ const getPropertyDescription = (value) => {
18
+ if (!isSchema(value)) {
19
+ return null;
20
+ }
21
+ const type = Array.isArray(value.type) ? value.type[0] : value.type;
22
+ if (!type) {
23
+ return null;
24
+ }
25
+ const typeDescriptions = TYPE_DESCRIPTIONS[type];
26
+ if (!typeDescriptions) {
27
+ return null;
28
+ }
29
+ const format = "format" in value && value.format || "contentEncoding" in value && value.contentEncoding || "_default";
30
+ return typeDescriptions[format] ?? null;
31
+ };
32
+ export {
33
+ getPropertyDescription
34
+ };
@@ -0,0 +1,10 @@
1
+ import type { SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
2
+ /**
3
+ * Checks if array items have complex structure
4
+ * like: objects, references, discriminators, compositions, or nested arrays with complex items
5
+ *
6
+ * @param value - The schema object to check
7
+ * @returns true if the array has complex items, false otherwise
8
+ */
9
+ export declare const hasComplexArrayItems: (value: SchemaObject | undefined) => boolean;
10
+ //# sourceMappingURL=has-complex-array-items.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"has-complex-array-items.d.ts","sourceRoot":"","sources":["../../../../../src/components/Content/Schema/helpers/has-complex-array-items.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAkDhG;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAAI,OAAO,YAAY,GAAG,SAAS,KAAG,OA4BtE,CAAA"}
@@ -0,0 +1,48 @@
1
+ import { getResolvedRef } from "@scalar/workspace-store/helpers/get-resolved-ref";
2
+ import { isArraySchema } from "@scalar/workspace-store/schemas/v3.1/strict/type-guards";
3
+ const COMPOSITION_KEYWORDS = ["allOf", "oneOf", "anyOf"];
4
+ const isObjectType = (schema) => {
5
+ if ("type" in schema && schema.type) {
6
+ if (Array.isArray(schema.type)) {
7
+ return schema.type.includes("object");
8
+ }
9
+ return schema.type === "object";
10
+ }
11
+ return "properties" in schema;
12
+ };
13
+ const hasComplexFeatures = (schema) => "$ref" in schema || "discriminator" in schema || COMPOSITION_KEYWORDS.some((keyword) => keyword in schema);
14
+ const hasComplexNestedArrayItems = (items) => {
15
+ if (!isArraySchema(items) || typeof items.items !== "object") {
16
+ return false;
17
+ }
18
+ if ("$ref" in items.items) {
19
+ return true;
20
+ }
21
+ const nestedItems = getResolvedRef(items.items);
22
+ if (!nestedItems) {
23
+ return false;
24
+ }
25
+ return isObjectType(nestedItems) || hasComplexFeatures(nestedItems) || isArraySchema(nestedItems);
26
+ };
27
+ const hasComplexArrayItems = (value) => {
28
+ if (!value || !isArraySchema(value) || typeof value.items !== "object") {
29
+ return false;
30
+ }
31
+ if ("$ref" in value.items) {
32
+ return true;
33
+ }
34
+ const items = getResolvedRef(value.items);
35
+ if (!items) {
36
+ return false;
37
+ }
38
+ if (hasComplexFeatures(items)) {
39
+ return true;
40
+ }
41
+ if (isObjectType(items)) {
42
+ return true;
43
+ }
44
+ return hasComplexNestedArrayItems(items);
45
+ };
46
+ export {
47
+ hasComplexArrayItems
48
+ };
@@ -0,0 +1,10 @@
1
+ import type { SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
2
+ /**
3
+ * Determine if description should be displayed
4
+ *
5
+ * @param schema - The schema object to check
6
+ * @param propDescription - Optional description from props
7
+ * @returns Description string to display, or null if should not be displayed
8
+ */
9
+ export declare const shouldDisplayDescription: (schema: SchemaObject | undefined, propDescription?: string) => string | null;
10
+ //# sourceMappingURL=should-display-description.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"should-display-description.d.ts","sourceRoot":"","sources":["../../../../../src/components/Content/Schema/helpers/should-display-description.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAEhG;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,GAAI,QAAQ,YAAY,GAAG,SAAS,EAAE,kBAAkB,MAAM,KAAG,MAAM,GAAG,IAW9G,CAAA"}
@@ -0,0 +1,12 @@
1
+ const shouldDisplayDescription = (schema, propDescription) => {
2
+ if (!schema) {
3
+ return null;
4
+ }
5
+ if ("properties" in schema || "additionalProperties" in schema || "patternProperties" in schema || schema.allOf) {
6
+ return null;
7
+ }
8
+ return propDescription || schema.description || null;
9
+ };
10
+ export {
11
+ shouldDisplayDescription
12
+ };
@@ -0,0 +1,11 @@
1
+ import type { SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
2
+ /**
3
+ * Determine if property heading should be displayed
4
+ *
5
+ * @param schema - The schema object to check
6
+ * @param name - Optional property name
7
+ * @param required - Whether the property is required
8
+ * @returns true if heading should be displayed, false otherwise
9
+ */
10
+ export declare const shouldDisplayHeading: (schema: SchemaObject | undefined, name?: string, required?: boolean) => boolean;
11
+ //# sourceMappingURL=should-display-heading.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"should-display-heading.d.ts","sourceRoot":"","sources":["../../../../../src/components/Content/Schema/helpers/should-display-heading.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAEhG;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,GAAI,QAAQ,YAAY,GAAG,SAAS,EAAE,OAAO,MAAM,EAAE,kBAAgB,KAAG,OAqBxG,CAAA"}