@scalar/openapi-to-markdown 0.4.9 → 0.4.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @scalar/openapi-to-markdown
2
2
 
3
+ ## 0.4.11
4
+
5
+ ## 0.4.10
6
+
7
+ ### Patch Changes
8
+
9
+ - [#8466](https://github.com/scalar/scalar/pull/8466): chore: new build pipeline
10
+
3
11
  ## 0.4.9
4
12
 
5
13
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { createHtmlFromOpenApi, createMarkdownFromOpenApi } from './create-markdown-from-openapi.js';
1
+ export { createHtmlFromOpenApi, createMarkdownFromOpenApi } from './create-markdown-from-openapi';
2
2
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,5 +1,279 @@
1
- import { createHtmlFromOpenApi as o, createMarkdownFromOpenApi as p } from "./create-markdown-from-openapi.js";
2
- export {
3
- o as createHtmlFromOpenApi,
4
- p as createMarkdownFromOpenApi
5
- };
1
+ import { dereference, normalize } from "@scalar/openapi-parser";
2
+ import { upgrade } from "@scalar/openapi-upgrader";
3
+ import { minify } from "html-minifier-terser";
4
+ import rehypeParse from "rehype-parse";
5
+ import rehypeRemark from "rehype-remark";
6
+ import rehypeSanitize from "rehype-sanitize";
7
+ import remarkGfm from "remark-gfm";
8
+ import remarkStringify from "remark-stringify";
9
+ import { unified } from "unified";
10
+ import { Fragment, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSSRApp, createTextVNode, createVNode, defineComponent, openBlock, renderList, resolveComponent, toDisplayString, unref } from "vue";
11
+ import { renderToString } from "vue/server-renderer";
12
+ import { ScalarMarkdown } from "@scalar/components";
13
+ import { getExampleFromSchema } from "@scalar/oas-utils/spec-getters";
14
+ import { json2xml } from "@scalar/helpers/file/json2xml";
15
+ //#region src/components/Schema.vue?vue&type=script&setup=true&lang.ts
16
+ var _hoisted_1$2 = { key: 0 };
17
+ var _hoisted_2$2 = { key: 0 };
18
+ var _hoisted_3$2 = { key: 1 };
19
+ var _hoisted_4$2 = { key: 2 };
20
+ var _hoisted_5$1 = { key: 3 };
21
+ var _hoisted_6$1 = { key: 4 };
22
+ var _hoisted_7$1 = { key: 0 };
23
+ var _hoisted_8$1 = { key: 0 };
24
+ var _hoisted_9$1 = { key: 1 };
25
+ var _hoisted_10$1 = { key: 2 };
26
+ var _hoisted_11$1 = { key: 3 };
27
+ var _hoisted_12$1 = { key: 1 };
28
+ var _hoisted_13$1 = { key: 5 };
29
+ var _hoisted_14$1 = { key: 0 };
30
+ var _hoisted_15 = { key: 0 };
31
+ var _hoisted_16 = { key: 1 };
32
+ var _hoisted_17 = { key: 2 };
33
+ var _hoisted_18 = { key: 6 };
34
+ var _hoisted_19 = { key: 0 };
35
+ var _hoisted_20 = { key: 1 };
36
+ var _hoisted_21 = { key: 2 };
37
+ var _hoisted_22 = { key: 3 };
38
+ //#endregion
39
+ //#region src/components/Schema.vue
40
+ var Schema_default = /* @__PURE__ */ defineComponent({
41
+ __name: "Schema",
42
+ props: { schema: { type: [Object, Boolean] } },
43
+ setup(__props) {
44
+ const sortProperties = (properties, required) => {
45
+ const sorted = Object.entries(properties).sort(([a], [b]) => {
46
+ const aRequired = required?.includes(a);
47
+ const bRequired = required?.includes(b);
48
+ if (aRequired && !bRequired) return -1;
49
+ if (!aRequired && bRequired) return 1;
50
+ return a.localeCompare(b);
51
+ });
52
+ return Object.fromEntries(sorted);
53
+ };
54
+ return (_ctx, _cache) => {
55
+ const _component_Schema = resolveComponent("Schema", true);
56
+ return __props.schema ? (openBlock(), createElementBlock("section", _hoisted_1$2, [__props.schema.allOf ? (openBlock(), createElementBlock("section", _hoisted_2$2, [_cache[0] || (_cache[0] = createElementVNode("header", null, [createElementVNode("strong", null, "All of:")], -1)), (openBlock(true), createElementBlock(Fragment, null, renderList(__props.schema.allOf, (subSchema, index) => {
57
+ return openBlock(), createElementBlock("section", { key: index }, [createVNode(_component_Schema, { schema: subSchema }, null, 8, ["schema"])]);
58
+ }), 128))])) : __props.schema.anyOf ? (openBlock(), createElementBlock("section", _hoisted_3$2, [_cache[1] || (_cache[1] = createElementVNode("header", null, [createElementVNode("strong", null, "Any of:")], -1)), (openBlock(true), createElementBlock(Fragment, null, renderList(__props.schema.anyOf, (subSchema, index) => {
59
+ return openBlock(), createElementBlock("section", { key: index }, [createVNode(_component_Schema, { schema: subSchema }, null, 8, ["schema"])]);
60
+ }), 128))])) : __props.schema.oneOf ? (openBlock(), createElementBlock("section", _hoisted_4$2, [_cache[2] || (_cache[2] = createElementVNode("header", null, [createElementVNode("strong", null, "One of:")], -1)), (openBlock(true), createElementBlock(Fragment, null, renderList(__props.schema.oneOf, (subSchema, index) => {
61
+ return openBlock(), createElementBlock("section", { key: index }, [createVNode(_component_Schema, { schema: subSchema }, null, 8, ["schema"])]);
62
+ }), 128))])) : __props.schema.not ? (openBlock(), createElementBlock("section", _hoisted_5$1, [_cache[3] || (_cache[3] = createElementVNode("header", null, [createElementVNode("strong", null, "Not:")], -1)), createElementVNode("section", null, [createVNode(_component_Schema, { schema: __props.schema.not }, null, 8, ["schema"])])])) : __props.schema.type === "object" || __props.schema.properties ? (openBlock(), createElementBlock("section", _hoisted_6$1, [createElementVNode("ul", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(sortProperties(__props.schema.properties || {}, __props.schema.required), (propSchema, propName) => {
63
+ return openBlock(), createElementBlock("li", { key: propName }, [
64
+ createElementVNode("strong", null, [createElementVNode("code", null, toDisplayString(propName), 1), __props.schema.required?.includes(propName) ? (openBlock(), createElementBlock("span", _hoisted_7$1, " (required) ")) : createCommentVNode("", true)]),
65
+ createElementVNode("p", null, [
66
+ createElementVNode("code", null, toDisplayString(Array.isArray(propSchema.type) ? propSchema.type.join(" | ") : propSchema.type || "object"), 1),
67
+ propSchema.format ? (openBlock(), createElementBlock("span", _hoisted_8$1, [_cache[4] || (_cache[4] = createTextVNode(", format: ", -1)), createElementVNode("code", null, toDisplayString(propSchema.format), 1)])) : createCommentVNode("", true),
68
+ propSchema.enum ? (openBlock(), createElementBlock("span", _hoisted_9$1, [_cache[5] || (_cache[5] = createTextVNode(", possible values: ", -1)), createElementVNode("code", null, toDisplayString(propSchema.enum.map((e) => JSON.stringify(e)).join(", ")), 1)])) : createCommentVNode("", true),
69
+ propSchema.default !== void 0 ? (openBlock(), createElementBlock("span", _hoisted_10$1, [_cache[6] || (_cache[6] = createTextVNode(", default: ", -1)), createElementVNode("code", null, toDisplayString(JSON.stringify(propSchema.default)), 1)])) : createCommentVNode("", true),
70
+ propSchema.description ? (openBlock(), createElementBlock("span", _hoisted_11$1, " — " + toDisplayString(propSchema.description), 1)) : createCommentVNode("", true)
71
+ ]),
72
+ propSchema.type === "object" || propSchema.properties ? (openBlock(), createBlock(_component_Schema, {
73
+ key: 0,
74
+ schema: propSchema
75
+ }, null, 8, ["schema"])) : createCommentVNode("", true),
76
+ propSchema.type === "array" && propSchema.items ? (openBlock(), createElementBlock("section", _hoisted_12$1, [_cache[7] || (_cache[7] = createElementVNode("header", null, [createElementVNode("strong", null, "Items:")], -1)), createVNode(_component_Schema, { schema: propSchema.items }, null, 8, ["schema"])])) : createCommentVNode("", true)
77
+ ]);
78
+ }), 128))])])) : __props.schema.type === "array" && __props.schema.items ? (openBlock(), createElementBlock("section", _hoisted_13$1, [
79
+ _cache[11] || (_cache[11] = createElementVNode("header", null, [createElementVNode("strong", null, "Array of:")], -1)),
80
+ createElementVNode("section", null, [createVNode(_component_Schema, { schema: __props.schema.items }, null, 8, ["schema"])]),
81
+ __props.schema.minItems !== void 0 || __props.schema.maxItems !== void 0 || __props.schema.uniqueItems ? (openBlock(), createElementBlock("ul", _hoisted_14$1, [
82
+ __props.schema.minItems !== void 0 ? (openBlock(), createElementBlock("li", _hoisted_15, [_cache[8] || (_cache[8] = createTextVNode(" Min items: ", -1)), createElementVNode("code", null, toDisplayString(__props.schema.minItems), 1)])) : createCommentVNode("", true),
83
+ __props.schema.maxItems !== void 0 ? (openBlock(), createElementBlock("li", _hoisted_16, [_cache[9] || (_cache[9] = createTextVNode(" Max items: ", -1)), createElementVNode("code", null, toDisplayString(__props.schema.maxItems), 1)])) : createCommentVNode("", true),
84
+ __props.schema.uniqueItems ? (openBlock(), createElementBlock("li", _hoisted_17, [..._cache[10] || (_cache[10] = [createTextVNode("Unique items: ", -1), createElementVNode("code", null, "true", -1)])])) : createCommentVNode("", true)
85
+ ])) : createCommentVNode("", true)
86
+ ])) : (openBlock(), createElementBlock("section", _hoisted_18, [createElementVNode("p", null, [
87
+ createElementVNode("code", null, toDisplayString(__props.schema.type), 1),
88
+ __props.schema.format ? (openBlock(), createElementBlock("span", _hoisted_19, [_cache[12] || (_cache[12] = createTextVNode(", format: ", -1)), createElementVNode("code", null, toDisplayString(__props.schema.format), 1)])) : createCommentVNode("", true),
89
+ __props.schema.enum ? (openBlock(), createElementBlock("span", _hoisted_20, [_cache[13] || (_cache[13] = createTextVNode(", possible values: ", -1)), createElementVNode("code", null, toDisplayString(__props.schema.enum.map((e) => JSON.stringify(e)).join(", ")), 1)])) : createCommentVNode("", true),
90
+ __props.schema.default !== void 0 ? (openBlock(), createElementBlock("span", _hoisted_21, [_cache[14] || (_cache[14] = createTextVNode(", default: ", -1)), createElementVNode("code", null, toDisplayString(JSON.stringify(__props.schema.default)), 1)])) : createCommentVNode("", true),
91
+ __props.schema.description ? (openBlock(), createElementBlock("span", _hoisted_22, " — " + toDisplayString(__props.schema.description), 1)) : createCommentVNode("", true)
92
+ ])]))])) : createCommentVNode("", true);
93
+ };
94
+ }
95
+ });
96
+ //#endregion
97
+ //#region src/components/XmlOrJson.vue?vue&type=script&setup=true&lang.ts
98
+ var _hoisted_1$1 = { key: 0 };
99
+ var _hoisted_2$1 = { class: "language-xml" };
100
+ var _hoisted_3$1 = { key: 1 };
101
+ var _hoisted_4$1 = { class: "language-json" };
102
+ //#endregion
103
+ //#region src/components/XmlOrJson.vue
104
+ var XmlOrJson_default = /* @__PURE__ */ defineComponent({
105
+ __name: "XmlOrJson",
106
+ props: {
107
+ xml: {
108
+ type: Boolean,
109
+ default: false
110
+ },
111
+ modelValue: { type: [Object, Boolean] }
112
+ },
113
+ setup(__props) {
114
+ return (_ctx, _cache) => {
115
+ return __props.xml ? (openBlock(), createElementBlock("pre", _hoisted_1$1, [createElementVNode("code", _hoisted_2$1, toDisplayString(unref(json2xml)(__props.modelValue)), 1)])) : (openBlock(), createElementBlock("pre", _hoisted_3$1, [createElementVNode("code", _hoisted_4$1, toDisplayString(JSON.stringify(__props.modelValue, null, 2)), 1)]));
116
+ };
117
+ }
118
+ });
119
+ //#endregion
120
+ //#region src/components/MarkdownReference.vue?vue&type=script&setup=true&lang.ts
121
+ var _hoisted_1 = { key: 1 };
122
+ var _hoisted_2 = { key: 0 };
123
+ var _hoisted_3 = { key: 1 };
124
+ var _hoisted_4 = { key: 2 };
125
+ var _hoisted_5 = { key: 0 };
126
+ var _hoisted_6 = { key: 1 };
127
+ var _hoisted_7 = { key: 0 };
128
+ var _hoisted_8 = { key: 1 };
129
+ var _hoisted_9 = { key: 3 };
130
+ var _hoisted_10 = { key: 2 };
131
+ var _hoisted_11 = { key: 3 };
132
+ var _hoisted_12 = { key: 0 };
133
+ var _hoisted_13 = { key: 1 };
134
+ var _hoisted_14 = { key: 4 };
135
+ //#endregion
136
+ //#region src/components/MarkdownReference.vue
137
+ var MarkdownReference_default = /* @__PURE__ */ defineComponent({
138
+ __name: "MarkdownReference",
139
+ props: { content: {} },
140
+ setup(__props) {
141
+ return (_ctx, _cache) => {
142
+ return openBlock(), createElementBlock("section", null, [
143
+ createElementVNode("header", null, [createElementVNode("h1", null, toDisplayString(__props.content?.info?.title), 1), createElementVNode("ul", null, [createElementVNode("li", null, [
144
+ _cache[0] || (_cache[0] = createElementVNode("strong", null, "OpenAPI Version:", -1)),
145
+ _cache[1] || (_cache[1] = createTextVNode("\xA0", -1)),
146
+ createElementVNode("code", null, toDisplayString(__props.content?.openapi), 1)
147
+ ]), createElementVNode("li", null, [
148
+ _cache[2] || (_cache[2] = createElementVNode("strong", null, "API Version:", -1)),
149
+ _cache[3] || (_cache[3] = createTextVNode("\xA0", -1)),
150
+ createElementVNode("code", null, toDisplayString(__props.content?.info?.version), 1)
151
+ ])])]),
152
+ __props.content?.info?.description ? (openBlock(), createBlock(unref(ScalarMarkdown), {
153
+ key: 0,
154
+ value: __props.content?.info?.description
155
+ }, null, 8, ["value"])) : createCommentVNode("", true),
156
+ __props.content?.servers?.length ? (openBlock(), createElementBlock("section", _hoisted_1, [_cache[10] || (_cache[10] = createElementVNode("h2", null, "Servers", -1)), createElementVNode("ul", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.content.servers, (server) => {
157
+ return openBlock(), createElementBlock("li", { key: server.url }, [
158
+ _cache[8] || (_cache[8] = createElementVNode("strong", null, "URL:", -1)),
159
+ _cache[9] || (_cache[9] = createTextVNode("\xA0", -1)),
160
+ createElementVNode("code", null, toDisplayString(server.url), 1),
161
+ createElementVNode("ul", null, [server.description ? (openBlock(), createElementBlock("li", _hoisted_2, [_cache[4] || (_cache[4] = createElementVNode("strong", null, "Description:", -1)), createTextVNode("\xA0" + toDisplayString(server.description), 1)])) : createCommentVNode("", true), server.variables && Object.keys(server.variables).length ? (openBlock(), createElementBlock("li", _hoisted_3, [_cache[7] || (_cache[7] = createElementVNode("strong", null, "Variables:", -1)), createElementVNode("ul", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(server.variables, (variable, name) => {
162
+ return openBlock(), createElementBlock("li", { key: name }, [
163
+ createElementVNode("code", null, toDisplayString(name), 1),
164
+ _cache[5] || (_cache[5] = createTextVNode(" (default: ", -1)),
165
+ createElementVNode("code", null, toDisplayString(variable.default), 1),
166
+ _cache[6] || (_cache[6] = createTextVNode(")", -1)),
167
+ variable.description ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createTextVNode(": " + toDisplayString(variable.description), 1)], 64)) : createCommentVNode("", true)
168
+ ]);
169
+ }), 128))])])) : createCommentVNode("", true)])
170
+ ]);
171
+ }), 128))])])) : createCommentVNode("", true),
172
+ Object.keys(__props.content?.paths ?? {}).length ? (openBlock(), createElementBlock("section", _hoisted_4, [_cache[21] || (_cache[21] = createElementVNode("h2", null, "Operations", -1)), (openBlock(true), createElementBlock(Fragment, null, renderList(Object.keys(__props.content?.paths ?? {}), (path) => {
173
+ return openBlock(), createElementBlock(Fragment, { key: path }, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.content?.paths?.[path], (operation, method) => {
174
+ return openBlock(), createElementBlock("section", { key: operation }, [
175
+ createElementVNode("header", null, [createElementVNode("h3", null, [operation.summary ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createTextVNode(toDisplayString(operation.summary), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(method.toString().toUpperCase()) + " " + toDisplayString(path), 1)], 64)), operation["x-scalar-stability"] ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [createTextVNode(" (" + toDisplayString(operation["x-scalar-stability"]) + ") ", 1)], 64)) : operation.deprecated ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [createTextVNode(" ⚠️ Deprecated ")], 64)) : createCommentVNode("", true)])]),
176
+ createElementVNode("ul", null, [
177
+ createElementVNode("li", null, [
178
+ _cache[11] || (_cache[11] = createElementVNode("strong", null, "Method:", -1)),
179
+ _cache[12] || (_cache[12] = createTextVNode("\xA0", -1)),
180
+ createElementVNode("code", null, toDisplayString(method.toString().toUpperCase()), 1)
181
+ ]),
182
+ createElementVNode("li", null, [
183
+ _cache[13] || (_cache[13] = createElementVNode("strong", null, "Path:", -1)),
184
+ _cache[14] || (_cache[14] = createTextVNode("\xA0", -1)),
185
+ createElementVNode("code", null, toDisplayString(path), 1)
186
+ ]),
187
+ operation.tags ? (openBlock(), createElementBlock("li", _hoisted_5, [_cache[15] || (_cache[15] = createElementVNode("strong", null, "Tags:", -1)), createTextVNode("\xA0" + toDisplayString(operation.tags.join(", ")), 1)])) : createCommentVNode("", true),
188
+ operation["x-scalar-stability"] ? (openBlock(), createElementBlock("li", _hoisted_6, [_cache[16] || (_cache[16] = createElementVNode("strong", null, "Stability:", -1)), createTextVNode("\xA0" + toDisplayString(operation["x-scalar-stability"]), 1)])) : createCommentVNode("", true)
189
+ ]),
190
+ createVNode(unref(ScalarMarkdown), { value: operation.description }, null, 8, ["value"]),
191
+ operation.requestBody?.content ? (openBlock(), createElementBlock("section", _hoisted_7, [_cache[18] || (_cache[18] = createElementVNode("h4", null, "Request Body", -1)), (openBlock(true), createElementBlock(Fragment, null, renderList(operation.requestBody.content, (content, mediaType) => {
192
+ return openBlock(), createElementBlock(Fragment, { key: mediaType }, [createElementVNode("h5", null, "Content-Type: " + toDisplayString(mediaType), 1), content.schema ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
193
+ createVNode(Schema_default, { schema: content.schema }, null, 8, ["schema"]),
194
+ _cache[17] || (_cache[17] = createElementVNode("p", null, [createElementVNode("strong", null, "Example:")], -1)),
195
+ createVNode(XmlOrJson_default, {
196
+ xml: mediaType?.toString().includes("xml"),
197
+ "model-value": unref(getExampleFromSchema)(content.schema, { xml: mediaType?.toString().includes("xml") })
198
+ }, null, 8, ["xml", "model-value"])
199
+ ], 64)) : createCommentVNode("", true)], 64);
200
+ }), 128))])) : createCommentVNode("", true),
201
+ operation.responses ? (openBlock(), createElementBlock("section", _hoisted_8, [_cache[20] || (_cache[20] = createElementVNode("h4", null, "Responses", -1)), (openBlock(true), createElementBlock(Fragment, null, renderList(operation.responses, (response, statusCode) => {
202
+ return openBlock(), createElementBlock("section", { key: statusCode }, [createElementVNode("header", null, [createElementVNode("h5", null, [createTextVNode(" Status: " + toDisplayString(statusCode) + " ", 1), response.description ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createTextVNode(toDisplayString(response.description), 1)], 64)) : createCommentVNode("", true)])]), (openBlock(true), createElementBlock(Fragment, null, renderList(response.content, (content, mediaType) => {
203
+ return openBlock(), createElementBlock("section", { key: mediaType }, [createElementVNode("h6", null, "Content-Type: " + toDisplayString(mediaType), 1), content.schema ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
204
+ createVNode(Schema_default, { schema: content.schema }, null, 8, ["schema"]),
205
+ _cache[19] || (_cache[19] = createElementVNode("p", null, [createElementVNode("strong", null, "Example:")], -1)),
206
+ createVNode(XmlOrJson_default, {
207
+ xml: mediaType?.toString().includes("xml"),
208
+ "model-value": unref(getExampleFromSchema)(content.schema, { xml: mediaType?.toString().includes("xml") })
209
+ }, null, 8, ["xml", "model-value"])
210
+ ], 64)) : createCommentVNode("", true)]);
211
+ }), 128))]);
212
+ }), 128))])) : createCommentVNode("", true)
213
+ ]);
214
+ }), 128))], 64);
215
+ }), 128))])) : createCommentVNode("", true),
216
+ Object.keys(__props.content?.webhooks ?? {}).length ? (openBlock(), createElementBlock("section", _hoisted_9, [_cache[26] || (_cache[26] = createElementVNode("h2", null, "Webhooks", -1)), (openBlock(true), createElementBlock(Fragment, null, renderList(__props.content?.webhooks, (webhook, name) => {
217
+ return openBlock(), createElementBlock(Fragment, { key: name }, [(openBlock(true), createElementBlock(Fragment, null, renderList(webhook, (operation, method) => {
218
+ return openBlock(), createElementBlock("section", { key: operation }, [
219
+ createElementVNode("header", null, [createElementVNode("h3", null, [operation.summary ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createTextVNode(toDisplayString(operation.summary), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(name), 1)], 64)), operation["x-scalar-stability"] ? (openBlock(), createElementBlock("span", _hoisted_10, "(" + toDisplayString(operation["x-scalar-stability"]) + ")", 1)) : operation.deprecated ? (openBlock(), createElementBlock("span", _hoisted_11, "⚠️ Deprecated")) : createCommentVNode("", true)])]),
220
+ createElementVNode("ul", null, [
221
+ createElementVNode("li", null, [_cache[22] || (_cache[22] = createElementVNode("strong", null, "Method:", -1)), createElementVNode("code", null, toDisplayString(method.toString().toUpperCase()), 1)]),
222
+ createElementVNode("li", null, [_cache[23] || (_cache[23] = createElementVNode("strong", null, "Path:", -1)), createElementVNode("code", null, "/webhooks/" + toDisplayString(name), 1)]),
223
+ operation.tags ? (openBlock(), createElementBlock("li", _hoisted_12, [_cache[24] || (_cache[24] = createElementVNode("strong", null, "Tags:", -1)), createTextVNode(" " + toDisplayString(operation.tags.join(", ")), 1)])) : createCommentVNode("", true),
224
+ operation.deprecated ? (openBlock(), createElementBlock("li", _hoisted_13, [..._cache[25] || (_cache[25] = [createElementVNode("strong", null, "Deprecated", -1)])])) : createCommentVNode("", true)
225
+ ]),
226
+ createVNode(unref(ScalarMarkdown), { value: operation.description }, null, 8, ["value"])
227
+ ]);
228
+ }), 128))], 64);
229
+ }), 128))])) : createCommentVNode("", true),
230
+ __props.content?.components?.schemas && Object.keys(__props.content.components.schemas).length ? (openBlock(), createElementBlock("section", _hoisted_14, [_cache[29] || (_cache[29] = createElementVNode("h2", null, "Schemas", -1)), (openBlock(true), createElementBlock(Fragment, null, renderList(__props.content.components.schemas, (schema, name) => {
231
+ return openBlock(), createElementBlock("section", { key: name }, [
232
+ createElementVNode("header", null, [createElementVNode("h3", null, toDisplayString(schema.title ?? name), 1)]),
233
+ createElementVNode("ul", null, [createElementVNode("li", null, [_cache[27] || (_cache[27] = createElementVNode("strong", null, "Type:", -1)), createElementVNode("code", null, toDisplayString(schema.type), 1)])]),
234
+ schema.description ? (openBlock(), createBlock(unref(ScalarMarkdown), {
235
+ key: 0,
236
+ value: schema.description
237
+ }, null, 8, ["value"])) : createCommentVNode("", true),
238
+ schema.type === "object" ? (openBlock(), createBlock(Schema_default, {
239
+ key: 1,
240
+ schema
241
+ }, null, 8, ["schema"])) : createCommentVNode("", true),
242
+ _cache[28] || (_cache[28] = createElementVNode("p", null, [createElementVNode("strong", null, "Example:")], -1)),
243
+ schema.type === "object" ? (openBlock(), createBlock(XmlOrJson_default, {
244
+ key: 2,
245
+ "model-value": unref(getExampleFromSchema)(schema)
246
+ }, null, 8, ["model-value"])) : createCommentVNode("", true)
247
+ ]);
248
+ }), 128))])) : createCommentVNode("", true)
249
+ ]);
250
+ };
251
+ }
252
+ });
253
+ //#endregion
254
+ //#region src/create-markdown-from-openapi.ts
255
+ async function createHtmlFromOpenApi(input) {
256
+ const { schema: content } = dereference(upgrade(normalize(input), "3.1"));
257
+ return minify(await renderToString(createSSRApp(MarkdownReference_default, { content })), {
258
+ removeComments: true,
259
+ removeEmptyElements: true,
260
+ collapseWhitespace: true,
261
+ continueOnParseError: true,
262
+ noNewlinesBeforeTagClose: true,
263
+ preserveLineBreaks: true,
264
+ removeEmptyAttributes: true,
265
+ decodeEntities: true,
266
+ useShortDoctype: true
267
+ });
268
+ }
269
+ async function createMarkdownFromOpenApi(content) {
270
+ return markdownFromHtml(await createHtmlFromOpenApi(content));
271
+ }
272
+ async function markdownFromHtml(html) {
273
+ const file = await unified().use(rehypeParse, { fragment: true }).use(remarkGfm).use(rehypeSanitize).use(rehypeRemark).use(remarkStringify, { bullet: "-" }).process(html);
274
+ return String(file);
275
+ }
276
+ //#endregion
277
+ export { createHtmlFromOpenApi, createMarkdownFromOpenApi };
278
+
279
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/components/Schema.vue","../src/components/Schema.vue","../src/components/XmlOrJson.vue","../src/components/XmlOrJson.vue","../src/components/MarkdownReference.vue","../src/components/MarkdownReference.vue","../src/create-markdown-from-openapi.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { OpenAPIV3_1 } from '@scalar/openapi-types'\n\ndefineProps<{\n schema: OpenAPIV3_1.SchemaObject\n}>()\n\n// Sort properties to show required fields first, then optional, then metadata\nconst sortProperties = (\n properties: Record<string, OpenAPIV3_1.SchemaObject>,\n required?: string[],\n) => {\n const sorted = Object.entries(properties).sort(([a], [b]) => {\n const aRequired = required?.includes(a)\n const bRequired = required?.includes(b)\n if (aRequired && !bRequired) return -1\n if (!aRequired && bRequired) return 1\n return a.localeCompare(b)\n })\n return Object.fromEntries(sorted)\n}\n</script>\n\n<template>\n <section v-if=\"schema\">\n <!-- Composition keywords -->\n <template v-if=\"schema.allOf\">\n <section>\n <header>\n <strong>All of:</strong>\n </header>\n <section\n v-for=\"(subSchema, index) in schema.allOf\"\n :key=\"index\">\n <Schema :schema=\"subSchema\" />\n </section>\n </section>\n </template>\n\n <template v-else-if=\"schema.anyOf\">\n <section>\n <header>\n <strong>Any of:</strong>\n </header>\n <section\n v-for=\"(subSchema, index) in schema.anyOf\"\n :key=\"index\">\n <Schema :schema=\"subSchema\" />\n </section>\n </section>\n </template>\n\n <template v-else-if=\"schema.oneOf\">\n <section>\n <header>\n <strong>One of:</strong>\n </header>\n <section\n v-for=\"(subSchema, index) in schema.oneOf\"\n :key=\"index\">\n <Schema :schema=\"subSchema\" />\n </section>\n </section>\n </template>\n\n <template v-else-if=\"schema.not\">\n <section>\n <header>\n <strong>Not:</strong>\n </header>\n <section>\n <Schema :schema=\"schema.not\" />\n </section>\n </section>\n </template>\n\n <!-- Object type -->\n <template v-else-if=\"schema.type === 'object' || schema.properties\">\n <section>\n <ul>\n <template\n v-for=\"(propSchema, propName) in sortProperties(\n schema.properties || {},\n schema.required,\n )\"\n :key=\"propName\">\n <li>\n <strong>\n <code>{{ propName }}</code>\n <span v-if=\"schema.required?.includes(propName)\">\n (required)\n </span>\n </strong>\n <p>\n <code>\n {{\n Array.isArray(propSchema.type)\n ? propSchema.type.join(' | ')\n : propSchema.type || 'object'\n }}\n </code>\n <template v-if=\"propSchema.format\">\n <span\n >, format: <code>{{ propSchema.format }}</code></span\n >\n </template>\n <template v-if=\"propSchema.enum\">\n <span\n >, possible values:\n <code>{{\n (propSchema.enum as unknown[])\n .map((e: unknown) => JSON.stringify(e))\n .join(', ')\n }}</code>\n </span>\n </template>\n <template v-if=\"propSchema.default !== undefined\">\n <span\n >, default:\n <code>{{ JSON.stringify(propSchema.default) }}</code></span\n >\n </template>\n <template v-if=\"propSchema.description\">\n <span> — {{ propSchema.description }}</span>\n </template>\n </p>\n <Schema\n v-if=\"propSchema.type === 'object' || propSchema.properties\"\n :schema=\"propSchema\" />\n <template v-if=\"propSchema.type === 'array' && propSchema.items\">\n <section>\n <header>\n <strong>Items:</strong>\n </header>\n <Schema :schema=\"propSchema.items\" />\n </section>\n </template>\n </li>\n </template>\n </ul>\n </section>\n </template>\n\n <!-- Array type -->\n <template v-else-if=\"schema.type === 'array' && schema.items\">\n <section>\n <header>\n <strong>Array of:</strong>\n </header>\n <section>\n <Schema :schema=\"schema.items\" />\n </section>\n <ul\n v-if=\"\n schema.minItems !== undefined ||\n schema.maxItems !== undefined ||\n schema.uniqueItems\n \">\n <li v-if=\"schema.minItems !== undefined\">\n Min items: <code>{{ schema.minItems }}</code>\n </li>\n <li v-if=\"schema.maxItems !== undefined\">\n Max items: <code>{{ schema.maxItems }}</code>\n </li>\n <li v-if=\"schema.uniqueItems\">Unique items: <code>true</code></li>\n </ul>\n </section>\n </template>\n\n <!-- Primitive types -->\n <template v-else>\n <section>\n <p>\n <code>{{ schema.type }}</code>\n <template v-if=\"schema.format\">\n <span\n >, format: <code>{{ schema.format }}</code></span\n >\n </template>\n <template v-if=\"schema.enum\">\n <span\n >, possible values:\n <code>{{\n (schema.enum as unknown[])\n .map((e: unknown) => JSON.stringify(e))\n .join(', ')\n }}</code>\n </span>\n </template>\n <template v-if=\"schema.default !== undefined\">\n <span\n >, default:\n <code>{{ JSON.stringify(schema.default) }}</code></span\n >\n </template>\n <template v-if=\"schema.description\">\n <span> — {{ schema.description }}</span>\n </template>\n </p>\n </section>\n </template>\n </section>\n</template>\n","<script setup lang=\"ts\">\nimport type { OpenAPIV3_1 } from '@scalar/openapi-types'\n\ndefineProps<{\n schema: OpenAPIV3_1.SchemaObject\n}>()\n\n// Sort properties to show required fields first, then optional, then metadata\nconst sortProperties = (\n properties: Record<string, OpenAPIV3_1.SchemaObject>,\n required?: string[],\n) => {\n const sorted = Object.entries(properties).sort(([a], [b]) => {\n const aRequired = required?.includes(a)\n const bRequired = required?.includes(b)\n if (aRequired && !bRequired) return -1\n if (!aRequired && bRequired) return 1\n return a.localeCompare(b)\n })\n return Object.fromEntries(sorted)\n}\n</script>\n\n<template>\n <section v-if=\"schema\">\n <!-- Composition keywords -->\n <template v-if=\"schema.allOf\">\n <section>\n <header>\n <strong>All of:</strong>\n </header>\n <section\n v-for=\"(subSchema, index) in schema.allOf\"\n :key=\"index\">\n <Schema :schema=\"subSchema\" />\n </section>\n </section>\n </template>\n\n <template v-else-if=\"schema.anyOf\">\n <section>\n <header>\n <strong>Any of:</strong>\n </header>\n <section\n v-for=\"(subSchema, index) in schema.anyOf\"\n :key=\"index\">\n <Schema :schema=\"subSchema\" />\n </section>\n </section>\n </template>\n\n <template v-else-if=\"schema.oneOf\">\n <section>\n <header>\n <strong>One of:</strong>\n </header>\n <section\n v-for=\"(subSchema, index) in schema.oneOf\"\n :key=\"index\">\n <Schema :schema=\"subSchema\" />\n </section>\n </section>\n </template>\n\n <template v-else-if=\"schema.not\">\n <section>\n <header>\n <strong>Not:</strong>\n </header>\n <section>\n <Schema :schema=\"schema.not\" />\n </section>\n </section>\n </template>\n\n <!-- Object type -->\n <template v-else-if=\"schema.type === 'object' || schema.properties\">\n <section>\n <ul>\n <template\n v-for=\"(propSchema, propName) in sortProperties(\n schema.properties || {},\n schema.required,\n )\"\n :key=\"propName\">\n <li>\n <strong>\n <code>{{ propName }}</code>\n <span v-if=\"schema.required?.includes(propName)\">\n (required)\n </span>\n </strong>\n <p>\n <code>\n {{\n Array.isArray(propSchema.type)\n ? propSchema.type.join(' | ')\n : propSchema.type || 'object'\n }}\n </code>\n <template v-if=\"propSchema.format\">\n <span\n >, format: <code>{{ propSchema.format }}</code></span\n >\n </template>\n <template v-if=\"propSchema.enum\">\n <span\n >, possible values:\n <code>{{\n (propSchema.enum as unknown[])\n .map((e: unknown) => JSON.stringify(e))\n .join(', ')\n }}</code>\n </span>\n </template>\n <template v-if=\"propSchema.default !== undefined\">\n <span\n >, default:\n <code>{{ JSON.stringify(propSchema.default) }}</code></span\n >\n </template>\n <template v-if=\"propSchema.description\">\n <span> — {{ propSchema.description }}</span>\n </template>\n </p>\n <Schema\n v-if=\"propSchema.type === 'object' || propSchema.properties\"\n :schema=\"propSchema\" />\n <template v-if=\"propSchema.type === 'array' && propSchema.items\">\n <section>\n <header>\n <strong>Items:</strong>\n </header>\n <Schema :schema=\"propSchema.items\" />\n </section>\n </template>\n </li>\n </template>\n </ul>\n </section>\n </template>\n\n <!-- Array type -->\n <template v-else-if=\"schema.type === 'array' && schema.items\">\n <section>\n <header>\n <strong>Array of:</strong>\n </header>\n <section>\n <Schema :schema=\"schema.items\" />\n </section>\n <ul\n v-if=\"\n schema.minItems !== undefined ||\n schema.maxItems !== undefined ||\n schema.uniqueItems\n \">\n <li v-if=\"schema.minItems !== undefined\">\n Min items: <code>{{ schema.minItems }}</code>\n </li>\n <li v-if=\"schema.maxItems !== undefined\">\n Max items: <code>{{ schema.maxItems }}</code>\n </li>\n <li v-if=\"schema.uniqueItems\">Unique items: <code>true</code></li>\n </ul>\n </section>\n </template>\n\n <!-- Primitive types -->\n <template v-else>\n <section>\n <p>\n <code>{{ schema.type }}</code>\n <template v-if=\"schema.format\">\n <span\n >, format: <code>{{ schema.format }}</code></span\n >\n </template>\n <template v-if=\"schema.enum\">\n <span\n >, possible values:\n <code>{{\n (schema.enum as unknown[])\n .map((e: unknown) => JSON.stringify(e))\n .join(', ')\n }}</code>\n </span>\n </template>\n <template v-if=\"schema.default !== undefined\">\n <span\n >, default:\n <code>{{ JSON.stringify(schema.default) }}</code></span\n >\n </template>\n <template v-if=\"schema.description\">\n <span> — {{ schema.description }}</span>\n </template>\n </p>\n </section>\n </template>\n </section>\n</template>\n","<script setup lang=\"ts\">\nimport { json2xml } from '@scalar/helpers/file/json2xml'\nimport type { OpenAPIV3_1 } from '@scalar/openapi-types'\n\nwithDefaults(\n defineProps<{\n xml?: boolean\n modelValue: OpenAPIV3_1.SchemaObject\n }>(),\n {\n xml: false,\n },\n)\n</script>\n<template>\n <template v-if=\"xml\">\n <pre><code class=\"language-xml\">{{ json2xml(modelValue) }}</code></pre>\n </template>\n <template v-else>\n <pre><code class=\"language-json\">{{ JSON.stringify(modelValue, null, 2) }}</code></pre>\n </template>\n</template>\n","<script setup lang=\"ts\">\nimport { json2xml } from '@scalar/helpers/file/json2xml'\nimport type { OpenAPIV3_1 } from '@scalar/openapi-types'\n\nwithDefaults(\n defineProps<{\n xml?: boolean\n modelValue: OpenAPIV3_1.SchemaObject\n }>(),\n {\n xml: false,\n },\n)\n</script>\n<template>\n <template v-if=\"xml\">\n <pre><code class=\"language-xml\">{{ json2xml(modelValue) }}</code></pre>\n </template>\n <template v-else>\n <pre><code class=\"language-json\">{{ JSON.stringify(modelValue, null, 2) }}</code></pre>\n </template>\n</template>\n","<script setup lang=\"ts\">\nimport { ScalarMarkdown } from '@scalar/components'\nimport { getExampleFromSchema } from '@scalar/oas-utils/spec-getters'\nimport type { OpenAPIV3_1 } from '@scalar/openapi-types'\n\n// import { snippetz, type HarRequest } from '@scalar/snippetz'\n\nimport Schema from './Schema.vue'\nimport XmlOrJson from './XmlOrJson.vue'\n\nconst { content } = defineProps<{\n content: OpenAPIV3_1.Document\n}>()\n\n// const getRequestExample = (harRequest: Partial<HarRequest>) => {\n// const snippet = snippetz().print('shell', 'curl', {\n// httpVersion: 'HTTP/1.1',\n// headers: [],\n// queryString: [],\n// cookies: [],\n// headersSize: -1,\n// bodySize: -1,\n// method: 'get',\n// ...harRequest,\n// })\n\n// return snippet\n// }\n</script>\n\n<template>\n <section>\n <header>\n <h1>{{ content?.info?.title }}</h1>\n <ul>\n <li>\n <strong>OpenAPI Version:</strong>&nbsp;<code>{{\n content?.openapi\n }}</code>\n </li>\n <li>\n <strong>API Version:</strong>&nbsp;<code>{{\n content?.info?.version\n }}</code>\n </li>\n </ul>\n </header>\n\n <ScalarMarkdown\n :value=\"content?.info?.description\"\n v-if=\"content?.info?.description\" />\n\n <section v-if=\"content?.servers?.length\">\n <h2>Servers</h2>\n <ul>\n <template\n v-for=\"server in content.servers\"\n :key=\"server.url\">\n <li>\n <strong>URL:</strong>&nbsp;<code>{{ server.url }}</code>\n <ul>\n <template v-if=\"server.description\">\n <li>\n <strong>Description:</strong>&nbsp;{{ server.description }}\n </li>\n </template>\n <template\n v-if=\"server.variables && Object.keys(server.variables).length\">\n <li>\n <strong>Variables:</strong>\n <ul>\n <template\n v-for=\"(variable, name) in server.variables\"\n :key=\"name\">\n <li>\n <code>{{ name }}</code> (default:\n <code>{{ variable.default }}</code\n >)<template v-if=\"variable.description\"\n >: {{ variable.description }}\n </template>\n </li>\n </template>\n </ul>\n </li>\n </template>\n </ul>\n </li>\n </template>\n </ul>\n </section>\n\n <section v-if=\"Object.keys(content?.paths ?? {}).length\">\n <h2>Operations</h2>\n\n <template\n v-for=\"path in Object.keys(content?.paths ?? {})\"\n :key=\"path\">\n <template\n v-for=\"(operation, method) in content?.paths?.[path]\"\n :key=\"operation\">\n <section>\n <header>\n <h3>\n <template v-if=\"operation.summary\">\n {{ operation.summary }}\n </template>\n <template v-else>\n {{ method.toString().toUpperCase() }} {{ path }}\n </template>\n <template v-if=\"operation['x-scalar-stability']\">\n ({{ operation['x-scalar-stability'] }})\n </template>\n <template v-else-if=\"operation.deprecated\">\n ⚠️ Deprecated\n </template>\n </h3>\n </header>\n\n <ul>\n <li>\n <strong>Method:</strong>&nbsp;<code>{{\n method.toString().toUpperCase()\n }}</code>\n </li>\n <li>\n <strong>Path:</strong>&nbsp;<code>{{ path }}</code>\n </li>\n <template v-if=\"operation.tags\">\n <li>\n <strong>Tags:</strong>&nbsp;{{ operation.tags.join(', ') }}\n </li>\n </template>\n <template v-if=\"operation['x-scalar-stability']\">\n <li>\n <strong>Stability:</strong>&nbsp;{{\n operation['x-scalar-stability']\n }}\n </li>\n </template>\n </ul>\n\n <ScalarMarkdown :value=\"operation.description\" />\n\n <!-- TODO: We need way more context to generate proper request examples -->\n <!-- <section>\n <h4>Request Example</h4>\n <pre><code>{{ getRequestExample({\n method: method.toString(),\n url: content.servers?.[0]?.url + path,\n }) }}</code></pre>\n </section> -->\n\n <template v-if=\"operation.requestBody?.content\">\n <section>\n <h4>Request Body</h4>\n <template\n v-for=\"(content, mediaType) in operation.requestBody.content\"\n :key=\"mediaType\">\n <h5>Content-Type: {{ mediaType }}</h5>\n <template v-if=\"content.schema\">\n <Schema :schema=\"content.schema\" />\n <p><strong>Example:</strong></p>\n <XmlOrJson\n :xml=\"mediaType?.toString().includes('xml')\"\n :model-value=\"\n getExampleFromSchema(content.schema, {\n xml: mediaType?.toString().includes('xml'),\n })\n \" />\n </template>\n </template>\n </section>\n </template>\n\n <template v-if=\"operation.responses\">\n <section>\n <h4>Responses</h4>\n\n <template\n v-for=\"(response, statusCode) in operation.responses\"\n :key=\"statusCode\">\n <section>\n <header>\n <h5>\n Status: {{ statusCode }}\n <template v-if=\"response.description\">\n {{ response.description }}\n </template>\n </h5>\n </header>\n <template\n v-for=\"(content, mediaType) in response.content\"\n :key=\"mediaType\">\n <section>\n <h6>Content-Type: {{ mediaType }}</h6>\n <template v-if=\"content.schema\">\n <Schema :schema=\"content.schema\" />\n <p><strong>Example:</strong></p>\n <XmlOrJson\n :xml=\"mediaType?.toString().includes('xml')\"\n :model-value=\"\n getExampleFromSchema(content.schema, {\n xml: mediaType?.toString().includes('xml'),\n })\n \" />\n </template>\n </section>\n </template>\n </section>\n </template>\n </section>\n </template>\n </section>\n </template>\n </template>\n </section>\n\n <section v-if=\"Object.keys(content?.webhooks ?? {}).length\">\n <h2>Webhooks</h2>\n\n <template\n v-for=\"(webhook, name) in content?.webhooks\"\n :key=\"name\">\n <template\n v-for=\"(operation, method) in webhook\"\n :key=\"operation\">\n <section>\n <header>\n <h3>\n <template v-if=\"operation.summary\">\n {{ operation.summary }}\n </template>\n <template v-else>\n {{ name }}\n </template>\n <template v-if=\"operation['x-scalar-stability']\">\n <span>({{ operation['x-scalar-stability'] }})</span>\n </template>\n <template v-else-if=\"operation.deprecated\">\n <span>⚠️ Deprecated</span>\n </template>\n </h3>\n </header>\n\n <ul>\n <li>\n <strong>Method:</strong>\n <code>{{ method.toString().toUpperCase() }}</code>\n </li>\n <li>\n <strong>Path:</strong>\n <code>/webhooks/{{ name }}</code>\n </li>\n <template v-if=\"operation.tags\">\n <li>\n <strong>Tags:</strong>\n {{ operation.tags.join(', ') }}\n </li>\n </template>\n <template v-if=\"operation.deprecated\">\n <li><strong>Deprecated</strong></li>\n </template>\n </ul>\n\n <ScalarMarkdown :value=\"operation.description\" />\n\n <!-- TODO: We need way more context to generate proper request examples -->\n <!-- <section>\n <h4>Request Example</h4>\n <pre><code>{{ getRequestExample({\n method: method.toString(),\n url: content.servers?.[0]?.url + '/webhooks/' + name,\n }) }}</code></pre>\n </section> -->\n </section>\n </template>\n </template>\n </section>\n\n <section\n v-if=\"\n content?.components?.schemas &&\n Object.keys(content.components.schemas).length\n \">\n <h2>Schemas</h2>\n <template\n v-for=\"(schema, name) in content.components.schemas\"\n :key=\"name\">\n <section>\n <header>\n <h3>{{ schema.title ?? name }}</h3>\n </header>\n <ul>\n <li>\n <strong>Type:</strong>\n <code>{{ schema.type }}</code>\n </li>\n </ul>\n <template v-if=\"schema.description\">\n <ScalarMarkdown :value=\"schema.description\" />\n </template>\n <Schema\n v-if=\"schema.type === 'object'\"\n :schema=\"schema\" />\n <p><strong>Example:</strong></p>\n <template v-if=\"schema.type === 'object'\">\n <XmlOrJson :model-value=\"getExampleFromSchema(schema)\" />\n </template>\n </section>\n </template>\n </section>\n </section>\n</template>\n","<script setup lang=\"ts\">\nimport { ScalarMarkdown } from '@scalar/components'\nimport { getExampleFromSchema } from '@scalar/oas-utils/spec-getters'\nimport type { OpenAPIV3_1 } from '@scalar/openapi-types'\n\n// import { snippetz, type HarRequest } from '@scalar/snippetz'\n\nimport Schema from './Schema.vue'\nimport XmlOrJson from './XmlOrJson.vue'\n\nconst { content } = defineProps<{\n content: OpenAPIV3_1.Document\n}>()\n\n// const getRequestExample = (harRequest: Partial<HarRequest>) => {\n// const snippet = snippetz().print('shell', 'curl', {\n// httpVersion: 'HTTP/1.1',\n// headers: [],\n// queryString: [],\n// cookies: [],\n// headersSize: -1,\n// bodySize: -1,\n// method: 'get',\n// ...harRequest,\n// })\n\n// return snippet\n// }\n</script>\n\n<template>\n <section>\n <header>\n <h1>{{ content?.info?.title }}</h1>\n <ul>\n <li>\n <strong>OpenAPI Version:</strong>&nbsp;<code>{{\n content?.openapi\n }}</code>\n </li>\n <li>\n <strong>API Version:</strong>&nbsp;<code>{{\n content?.info?.version\n }}</code>\n </li>\n </ul>\n </header>\n\n <ScalarMarkdown\n :value=\"content?.info?.description\"\n v-if=\"content?.info?.description\" />\n\n <section v-if=\"content?.servers?.length\">\n <h2>Servers</h2>\n <ul>\n <template\n v-for=\"server in content.servers\"\n :key=\"server.url\">\n <li>\n <strong>URL:</strong>&nbsp;<code>{{ server.url }}</code>\n <ul>\n <template v-if=\"server.description\">\n <li>\n <strong>Description:</strong>&nbsp;{{ server.description }}\n </li>\n </template>\n <template\n v-if=\"server.variables && Object.keys(server.variables).length\">\n <li>\n <strong>Variables:</strong>\n <ul>\n <template\n v-for=\"(variable, name) in server.variables\"\n :key=\"name\">\n <li>\n <code>{{ name }}</code> (default:\n <code>{{ variable.default }}</code\n >)<template v-if=\"variable.description\"\n >: {{ variable.description }}\n </template>\n </li>\n </template>\n </ul>\n </li>\n </template>\n </ul>\n </li>\n </template>\n </ul>\n </section>\n\n <section v-if=\"Object.keys(content?.paths ?? {}).length\">\n <h2>Operations</h2>\n\n <template\n v-for=\"path in Object.keys(content?.paths ?? {})\"\n :key=\"path\">\n <template\n v-for=\"(operation, method) in content?.paths?.[path]\"\n :key=\"operation\">\n <section>\n <header>\n <h3>\n <template v-if=\"operation.summary\">\n {{ operation.summary }}\n </template>\n <template v-else>\n {{ method.toString().toUpperCase() }} {{ path }}\n </template>\n <template v-if=\"operation['x-scalar-stability']\">\n ({{ operation['x-scalar-stability'] }})\n </template>\n <template v-else-if=\"operation.deprecated\">\n ⚠️ Deprecated\n </template>\n </h3>\n </header>\n\n <ul>\n <li>\n <strong>Method:</strong>&nbsp;<code>{{\n method.toString().toUpperCase()\n }}</code>\n </li>\n <li>\n <strong>Path:</strong>&nbsp;<code>{{ path }}</code>\n </li>\n <template v-if=\"operation.tags\">\n <li>\n <strong>Tags:</strong>&nbsp;{{ operation.tags.join(', ') }}\n </li>\n </template>\n <template v-if=\"operation['x-scalar-stability']\">\n <li>\n <strong>Stability:</strong>&nbsp;{{\n operation['x-scalar-stability']\n }}\n </li>\n </template>\n </ul>\n\n <ScalarMarkdown :value=\"operation.description\" />\n\n <!-- TODO: We need way more context to generate proper request examples -->\n <!-- <section>\n <h4>Request Example</h4>\n <pre><code>{{ getRequestExample({\n method: method.toString(),\n url: content.servers?.[0]?.url + path,\n }) }}</code></pre>\n </section> -->\n\n <template v-if=\"operation.requestBody?.content\">\n <section>\n <h4>Request Body</h4>\n <template\n v-for=\"(content, mediaType) in operation.requestBody.content\"\n :key=\"mediaType\">\n <h5>Content-Type: {{ mediaType }}</h5>\n <template v-if=\"content.schema\">\n <Schema :schema=\"content.schema\" />\n <p><strong>Example:</strong></p>\n <XmlOrJson\n :xml=\"mediaType?.toString().includes('xml')\"\n :model-value=\"\n getExampleFromSchema(content.schema, {\n xml: mediaType?.toString().includes('xml'),\n })\n \" />\n </template>\n </template>\n </section>\n </template>\n\n <template v-if=\"operation.responses\">\n <section>\n <h4>Responses</h4>\n\n <template\n v-for=\"(response, statusCode) in operation.responses\"\n :key=\"statusCode\">\n <section>\n <header>\n <h5>\n Status: {{ statusCode }}\n <template v-if=\"response.description\">\n {{ response.description }}\n </template>\n </h5>\n </header>\n <template\n v-for=\"(content, mediaType) in response.content\"\n :key=\"mediaType\">\n <section>\n <h6>Content-Type: {{ mediaType }}</h6>\n <template v-if=\"content.schema\">\n <Schema :schema=\"content.schema\" />\n <p><strong>Example:</strong></p>\n <XmlOrJson\n :xml=\"mediaType?.toString().includes('xml')\"\n :model-value=\"\n getExampleFromSchema(content.schema, {\n xml: mediaType?.toString().includes('xml'),\n })\n \" />\n </template>\n </section>\n </template>\n </section>\n </template>\n </section>\n </template>\n </section>\n </template>\n </template>\n </section>\n\n <section v-if=\"Object.keys(content?.webhooks ?? {}).length\">\n <h2>Webhooks</h2>\n\n <template\n v-for=\"(webhook, name) in content?.webhooks\"\n :key=\"name\">\n <template\n v-for=\"(operation, method) in webhook\"\n :key=\"operation\">\n <section>\n <header>\n <h3>\n <template v-if=\"operation.summary\">\n {{ operation.summary }}\n </template>\n <template v-else>\n {{ name }}\n </template>\n <template v-if=\"operation['x-scalar-stability']\">\n <span>({{ operation['x-scalar-stability'] }})</span>\n </template>\n <template v-else-if=\"operation.deprecated\">\n <span>⚠️ Deprecated</span>\n </template>\n </h3>\n </header>\n\n <ul>\n <li>\n <strong>Method:</strong>\n <code>{{ method.toString().toUpperCase() }}</code>\n </li>\n <li>\n <strong>Path:</strong>\n <code>/webhooks/{{ name }}</code>\n </li>\n <template v-if=\"operation.tags\">\n <li>\n <strong>Tags:</strong>\n {{ operation.tags.join(', ') }}\n </li>\n </template>\n <template v-if=\"operation.deprecated\">\n <li><strong>Deprecated</strong></li>\n </template>\n </ul>\n\n <ScalarMarkdown :value=\"operation.description\" />\n\n <!-- TODO: We need way more context to generate proper request examples -->\n <!-- <section>\n <h4>Request Example</h4>\n <pre><code>{{ getRequestExample({\n method: method.toString(),\n url: content.servers?.[0]?.url + '/webhooks/' + name,\n }) }}</code></pre>\n </section> -->\n </section>\n </template>\n </template>\n </section>\n\n <section\n v-if=\"\n content?.components?.schemas &&\n Object.keys(content.components.schemas).length\n \">\n <h2>Schemas</h2>\n <template\n v-for=\"(schema, name) in content.components.schemas\"\n :key=\"name\">\n <section>\n <header>\n <h3>{{ schema.title ?? name }}</h3>\n </header>\n <ul>\n <li>\n <strong>Type:</strong>\n <code>{{ schema.type }}</code>\n </li>\n </ul>\n <template v-if=\"schema.description\">\n <ScalarMarkdown :value=\"schema.description\" />\n </template>\n <Schema\n v-if=\"schema.type === 'object'\"\n :schema=\"schema\" />\n <p><strong>Example:</strong></p>\n <template v-if=\"schema.type === 'object'\">\n <XmlOrJson :model-value=\"getExampleFromSchema(schema)\" />\n </template>\n </section>\n </template>\n </section>\n </section>\n</template>\n","import { dereference, normalize } from '@scalar/openapi-parser'\nimport type { OpenAPI } from '@scalar/openapi-types'\nimport { upgrade } from '@scalar/openapi-upgrader'\nimport type { UnknownObject } from '@scalar/types/utils'\nimport { minify } from 'html-minifier-terser'\nimport rehypeParse from 'rehype-parse'\nimport rehypeRemark from 'rehype-remark'\nimport rehypeSanitize from 'rehype-sanitize'\nimport remarkGfm from 'remark-gfm'\nimport remarkStringify from 'remark-stringify'\nimport { unified } from 'unified'\nimport { createSSRApp } from 'vue'\nimport { renderToString } from 'vue/server-renderer'\n\nimport MarkdownReference from './components/MarkdownReference.vue'\n\ntype AnyDocument = OpenAPI.Document | Record<string, unknown> | string\n\nexport async function createHtmlFromOpenApi(input: AnyDocument) {\n // TODO: Use the new store here.\n const upgraded = upgrade(normalize(input) as UnknownObject, '3.1')\n const { schema: content } = dereference(upgraded)\n\n // Create and configure a server-side rendered Vue app\n const app = createSSRApp(MarkdownReference, {\n content,\n })\n\n // Get static HTML\n const html = await renderToString(app)\n\n // Clean the output\n return minify(html, {\n removeComments: true,\n removeEmptyElements: true,\n collapseWhitespace: true,\n continueOnParseError: true,\n noNewlinesBeforeTagClose: true,\n preserveLineBreaks: true,\n removeEmptyAttributes: true,\n decodeEntities: true,\n useShortDoctype: true,\n })\n}\n\nexport async function createMarkdownFromOpenApi(content: AnyDocument) {\n return markdownFromHtml(await createHtmlFromOpenApi(content))\n}\n\nasync function markdownFromHtml(html: string): Promise<string> {\n const file = await unified()\n .use(rehypeParse, { fragment: true })\n .use(remarkGfm)\n .use(rehypeSanitize)\n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I,UAAU,CACd,IAAI,eAAe,CACnB,IAAI,aAAa,CACjB,IAAI,iBAAiB,EACpB,QAAQ,KACT,CAAC,CACD,QAAQ,KAAK;AAEhB,QAAO,OAAO,KAAK"}
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  "llm",
17
17
  "swagger"
18
18
  ],
19
- "version": "0.4.9",
19
+ "version": "0.4.11",
20
20
  "engines": {
21
21
  "node": ">=22"
22
22
  },
@@ -53,13 +53,13 @@
53
53
  "remark-stringify": "^11.0.0",
54
54
  "unified": "^11.0.5",
55
55
  "vue": "^3.5.26",
56
- "@scalar/components": "0.20.9",
57
- "@scalar/helpers": "0.4.1",
58
- "@scalar/oas-utils": "0.10.8",
59
- "@scalar/openapi-parser": "0.25.4",
60
- "@scalar/openapi-types": "0.6.0",
61
- "@scalar/openapi-upgrader": "0.2.0",
62
- "@scalar/types": "0.7.3"
56
+ "@scalar/components": "0.20.11",
57
+ "@scalar/helpers": "0.4.2",
58
+ "@scalar/oas-utils": "0.10.10",
59
+ "@scalar/openapi-parser": "0.25.6",
60
+ "@scalar/openapi-types": "0.6.1",
61
+ "@scalar/types": "0.7.4",
62
+ "@scalar/openapi-upgrader": "0.2.2"
63
63
  },
64
64
  "devDependencies": {
65
65
  "@hono/node-server": "^1.19.7",
@@ -67,19 +67,15 @@
67
67
  "@vitejs/plugin-vue": "^6.0.3",
68
68
  "@vue/test-utils": "2.4.6",
69
69
  "hono": "4.12.4",
70
- "vite": "^7.3.1",
71
- "vitest": "4.0.16",
70
+ "vite": "8.0.0",
71
+ "vitest": "4.1.0",
72
72
  "vue": "^3.5.26",
73
- "@scalar/build-tooling": "0.5.0",
74
- "@scalar/galaxy": "0.6.0"
73
+ "@scalar/galaxy": "0.6.1"
75
74
  },
76
75
  "scripts": {
77
- "build": "scalar-build-vite",
78
- "dev": "nodemon --exec \"vite-node playground/index.ts\" --ext ts,vue --quiet --watch ./",
79
- "format": "scalar-format",
80
- "format:check": "scalar-format-check",
76
+ "build": "vite build && vue-tsc -p tsconfig.build.json",
77
+ "dev": "tsx watch playground/index.ts",
81
78
  "test": "vitest",
82
- "types:build": "scalar-types-build-vue",
83
- "types:check": "scalar-types-check-vue"
79
+ "types:check": "vue-tsc --noEmit"
84
80
  }
85
81
  }
@@ -1,229 +0,0 @@
1
- import { defineComponent as C, createElementBlock as e, openBlock as n, createElementVNode as l, createBlock as v, createCommentVNode as i, toDisplayString as u, createTextVNode as d, unref as b, Fragment as r, renderList as m, createVNode as f } from "vue";
2
- import { ScalarMarkdown as j } from "@scalar/components";
3
- import { getExampleFromSchema as O } from "@scalar/oas-utils/spec-getters";
4
- import V from "./Schema.vue.js";
5
- import B from "./XmlOrJson.vue.js";
6
- const E = { key: 1 }, w = { key: 0 }, D = { key: 1 }, M = { key: 2 }, N = { key: 0 }, P = { key: 1 }, R = { key: 0 }, U = { key: 1 }, p = { key: 3 }, q = { key: 2 }, A = { key: 3 }, F = { key: 0 }, I = { key: 1 }, L = { key: 4 }, K = /* @__PURE__ */ C({
7
- __name: "MarkdownReference",
8
- props: {
9
- content: {}
10
- },
11
- setup(k) {
12
- return ($, t) => (n(), e("section", null, [
13
- l("header", null, [
14
- l("h1", null, u(k.content?.info?.title), 1),
15
- l("ul", null, [
16
- l("li", null, [
17
- t[0] || (t[0] = l("strong", null, "OpenAPI Version:", -1)),
18
- t[1] || (t[1] = d(" ", -1)),
19
- l("code", null, u(k.content?.openapi), 1)
20
- ]),
21
- l("li", null, [
22
- t[2] || (t[2] = l("strong", null, "API Version:", -1)),
23
- t[3] || (t[3] = d(" ", -1)),
24
- l("code", null, u(k.content?.info?.version), 1)
25
- ])
26
- ])
27
- ]),
28
- k.content?.info?.description ? (n(), v(b(j), {
29
- key: 0,
30
- value: k.content?.info?.description
31
- }, null, 8, ["value"])) : i("", !0),
32
- k.content?.servers?.length ? (n(), e("section", E, [
33
- t[10] || (t[10] = l("h2", null, "Servers", -1)),
34
- l("ul", null, [
35
- (n(!0), e(r, null, m(k.content.servers, (o) => (n(), e("li", {
36
- key: o.url
37
- }, [
38
- t[8] || (t[8] = l("strong", null, "URL:", -1)),
39
- t[9] || (t[9] = d(" ", -1)),
40
- l("code", null, u(o.url), 1),
41
- l("ul", null, [
42
- o.description ? (n(), e("li", w, [
43
- t[4] || (t[4] = l("strong", null, "Description:", -1)),
44
- d(" " + u(o.description), 1)
45
- ])) : i("", !0),
46
- o.variables && Object.keys(o.variables).length ? (n(), e("li", D, [
47
- t[7] || (t[7] = l("strong", null, "Variables:", -1)),
48
- l("ul", null, [
49
- (n(!0), e(r, null, m(o.variables, (s, y) => (n(), e("li", { key: y }, [
50
- l("code", null, u(y), 1),
51
- t[5] || (t[5] = d(" (default: ", -1)),
52
- l("code", null, u(s.default), 1),
53
- t[6] || (t[6] = d(")", -1)),
54
- s.description ? (n(), e(r, { key: 0 }, [
55
- d(": " + u(s.description), 1)
56
- ], 64)) : i("", !0)
57
- ]))), 128))
58
- ])
59
- ])) : i("", !0)
60
- ])
61
- ]))), 128))
62
- ])
63
- ])) : i("", !0),
64
- Object.keys(k.content?.paths ?? {}).length ? (n(), e("section", M, [
65
- t[21] || (t[21] = l("h2", null, "Operations", -1)),
66
- (n(!0), e(r, null, m(Object.keys(k.content?.paths ?? {}), (o) => (n(), e(r, { key: o }, [
67
- (n(!0), e(r, null, m(k.content?.paths?.[o], (s, y) => (n(), e("section", { key: s }, [
68
- l("header", null, [
69
- l("h3", null, [
70
- s.summary ? (n(), e(r, { key: 0 }, [
71
- d(u(s.summary), 1)
72
- ], 64)) : (n(), e(r, { key: 1 }, [
73
- d(u(y.toString().toUpperCase()) + " " + u(o), 1)
74
- ], 64)),
75
- s["x-scalar-stability"] ? (n(), e(r, { key: 2 }, [
76
- d(" (" + u(s["x-scalar-stability"]) + ") ", 1)
77
- ], 64)) : s.deprecated ? (n(), e(r, { key: 3 }, [
78
- d(" ⚠️ Deprecated ")
79
- ], 64)) : i("", !0)
80
- ])
81
- ]),
82
- l("ul", null, [
83
- l("li", null, [
84
- t[11] || (t[11] = l("strong", null, "Method:", -1)),
85
- t[12] || (t[12] = d(" ", -1)),
86
- l("code", null, u(y.toString().toUpperCase()), 1)
87
- ]),
88
- l("li", null, [
89
- t[13] || (t[13] = l("strong", null, "Path:", -1)),
90
- t[14] || (t[14] = d(" ", -1)),
91
- l("code", null, u(o), 1)
92
- ]),
93
- s.tags ? (n(), e("li", N, [
94
- t[15] || (t[15] = l("strong", null, "Tags:", -1)),
95
- d(" " + u(s.tags.join(", ")), 1)
96
- ])) : i("", !0),
97
- s["x-scalar-stability"] ? (n(), e("li", P, [
98
- t[16] || (t[16] = l("strong", null, "Stability:", -1)),
99
- d(" " + u(s["x-scalar-stability"]), 1)
100
- ])) : i("", !0)
101
- ]),
102
- f(b(j), {
103
- value: s.description
104
- }, null, 8, ["value"]),
105
- s.requestBody?.content ? (n(), e("section", R, [
106
- t[18] || (t[18] = l("h4", null, "Request Body", -1)),
107
- (n(!0), e(r, null, m(s.requestBody.content, (g, x) => (n(), e(r, { key: x }, [
108
- l("h5", null, "Content-Type: " + u(x), 1),
109
- g.schema ? (n(), e(r, { key: 0 }, [
110
- f(V, {
111
- schema: g.schema
112
- }, null, 8, ["schema"]),
113
- t[17] || (t[17] = l("p", null, [
114
- l("strong", null, "Example:")
115
- ], -1)),
116
- f(B, {
117
- xml: x?.toString().includes("xml"),
118
- "model-value": b(O)(g.schema, {
119
- xml: x?.toString().includes("xml")
120
- })
121
- }, null, 8, ["xml", "model-value"])
122
- ], 64)) : i("", !0)
123
- ], 64))), 128))
124
- ])) : i("", !0),
125
- s.responses ? (n(), e("section", U, [
126
- t[20] || (t[20] = l("h4", null, "Responses", -1)),
127
- (n(!0), e(r, null, m(s.responses, (g, x) => (n(), e("section", { key: x }, [
128
- l("header", null, [
129
- l("h5", null, [
130
- d(" Status: " + u(x) + " ", 1),
131
- g.description ? (n(), e(r, { key: 0 }, [
132
- d(u(g.description), 1)
133
- ], 64)) : i("", !0)
134
- ])
135
- ]),
136
- (n(!0), e(r, null, m(g.content, (a, S) => (n(), e("section", { key: S }, [
137
- l("h6", null, "Content-Type: " + u(S), 1),
138
- a.schema ? (n(), e(r, { key: 0 }, [
139
- f(V, {
140
- schema: a.schema
141
- }, null, 8, ["schema"]),
142
- t[19] || (t[19] = l("p", null, [
143
- l("strong", null, "Example:")
144
- ], -1)),
145
- f(B, {
146
- xml: S?.toString().includes("xml"),
147
- "model-value": b(O)(a.schema, {
148
- xml: S?.toString().includes("xml")
149
- })
150
- }, null, 8, ["xml", "model-value"])
151
- ], 64)) : i("", !0)
152
- ]))), 128))
153
- ]))), 128))
154
- ])) : i("", !0)
155
- ]))), 128))
156
- ], 64))), 128))
157
- ])) : i("", !0),
158
- Object.keys(k.content?.webhooks ?? {}).length ? (n(), e("section", p, [
159
- t[26] || (t[26] = l("h2", null, "Webhooks", -1)),
160
- (n(!0), e(r, null, m(k.content?.webhooks, (o, s) => (n(), e(r, { key: s }, [
161
- (n(!0), e(r, null, m(o, (y, g) => (n(), e("section", { key: y }, [
162
- l("header", null, [
163
- l("h3", null, [
164
- y.summary ? (n(), e(r, { key: 0 }, [
165
- d(u(y.summary), 1)
166
- ], 64)) : (n(), e(r, { key: 1 }, [
167
- d(u(s), 1)
168
- ], 64)),
169
- y["x-scalar-stability"] ? (n(), e("span", q, "(" + u(y["x-scalar-stability"]) + ")", 1)) : y.deprecated ? (n(), e("span", A, "⚠️ Deprecated")) : i("", !0)
170
- ])
171
- ]),
172
- l("ul", null, [
173
- l("li", null, [
174
- t[22] || (t[22] = l("strong", null, "Method:", -1)),
175
- l("code", null, u(g.toString().toUpperCase()), 1)
176
- ]),
177
- l("li", null, [
178
- t[23] || (t[23] = l("strong", null, "Path:", -1)),
179
- l("code", null, "/webhooks/" + u(s), 1)
180
- ]),
181
- y.tags ? (n(), e("li", F, [
182
- t[24] || (t[24] = l("strong", null, "Tags:", -1)),
183
- d(" " + u(y.tags.join(", ")), 1)
184
- ])) : i("", !0),
185
- y.deprecated ? (n(), e("li", I, [...t[25] || (t[25] = [
186
- l("strong", null, "Deprecated", -1)
187
- ])])) : i("", !0)
188
- ]),
189
- f(b(j), {
190
- value: y.description
191
- }, null, 8, ["value"])
192
- ]))), 128))
193
- ], 64))), 128))
194
- ])) : i("", !0),
195
- k.content?.components?.schemas && Object.keys(k.content.components.schemas).length ? (n(), e("section", L, [
196
- t[29] || (t[29] = l("h2", null, "Schemas", -1)),
197
- (n(!0), e(r, null, m(k.content.components.schemas, (o, s) => (n(), e("section", { key: s }, [
198
- l("header", null, [
199
- l("h3", null, u(o.title ?? s), 1)
200
- ]),
201
- l("ul", null, [
202
- l("li", null, [
203
- t[27] || (t[27] = l("strong", null, "Type:", -1)),
204
- l("code", null, u(o.type), 1)
205
- ])
206
- ]),
207
- o.description ? (n(), v(b(j), {
208
- key: 0,
209
- value: o.description
210
- }, null, 8, ["value"])) : i("", !0),
211
- o.type === "object" ? (n(), v(V, {
212
- key: 1,
213
- schema: o
214
- }, null, 8, ["schema"])) : i("", !0),
215
- t[28] || (t[28] = l("p", null, [
216
- l("strong", null, "Example:")
217
- ], -1)),
218
- o.type === "object" ? (n(), v(B, {
219
- key: 2,
220
- "model-value": b(O)(o)
221
- }, null, 8, ["model-value"])) : i("", !0)
222
- ]))), 128))
223
- ])) : i("", !0)
224
- ]));
225
- }
226
- });
227
- export {
228
- K as default
229
- };
@@ -1,4 +0,0 @@
1
- import f from "./MarkdownReference.vue.js";
2
- export {
3
- f as default
4
- };
@@ -1,135 +0,0 @@
1
- import { defineComponent as g, resolveComponent as j, createElementBlock as s, createCommentVNode as u, openBlock as n, createElementVNode as l, Fragment as y, renderList as h, createVNode as r, createBlock as v, toDisplayString as o, createTextVNode as a } from "vue";
2
- const I = { key: 0 }, b = { key: 0 }, q = { key: 1 }, x = { key: 2 }, N = { key: 3 }, A = { key: 4 }, B = { key: 0 }, C = { key: 0 }, J = { key: 1 }, V = { key: 2 }, E = { key: 3 }, M = { key: 1 }, R = { key: 5 }, D = { key: 0 }, F = { key: 0 }, L = { key: 1 }, P = { key: 2 }, T = { key: 6 }, U = { key: 0 }, w = { key: 1 }, z = { key: 2 }, G = { key: 3 }, K = /* @__PURE__ */ g({
3
- __name: "Schema",
4
- props: {
5
- schema: { type: [Object, Boolean] }
6
- },
7
- setup(e) {
8
- const O = (f, t) => {
9
- const d = Object.entries(f).sort(([i], [m]) => {
10
- const c = t?.includes(i), k = t?.includes(m);
11
- return c && !k ? -1 : !c && k ? 1 : i.localeCompare(m);
12
- });
13
- return Object.fromEntries(d);
14
- };
15
- return (f, t) => {
16
- const d = j("Schema", !0);
17
- return e.schema ? (n(), s("section", I, [
18
- e.schema.allOf ? (n(), s("section", b, [
19
- t[0] || (t[0] = l("header", null, [
20
- l("strong", null, "All of:")
21
- ], -1)),
22
- (n(!0), s(y, null, h(e.schema.allOf, (i, m) => (n(), s("section", { key: m }, [
23
- r(d, { schema: i }, null, 8, ["schema"])
24
- ]))), 128))
25
- ])) : e.schema.anyOf ? (n(), s("section", q, [
26
- t[1] || (t[1] = l("header", null, [
27
- l("strong", null, "Any of:")
28
- ], -1)),
29
- (n(!0), s(y, null, h(e.schema.anyOf, (i, m) => (n(), s("section", { key: m }, [
30
- r(d, { schema: i }, null, 8, ["schema"])
31
- ]))), 128))
32
- ])) : e.schema.oneOf ? (n(), s("section", x, [
33
- t[2] || (t[2] = l("header", null, [
34
- l("strong", null, "One of:")
35
- ], -1)),
36
- (n(!0), s(y, null, h(e.schema.oneOf, (i, m) => (n(), s("section", { key: m }, [
37
- r(d, { schema: i }, null, 8, ["schema"])
38
- ]))), 128))
39
- ])) : e.schema.not ? (n(), s("section", N, [
40
- t[3] || (t[3] = l("header", null, [
41
- l("strong", null, "Not:")
42
- ], -1)),
43
- l("section", null, [
44
- r(d, {
45
- schema: e.schema.not
46
- }, null, 8, ["schema"])
47
- ])
48
- ])) : e.schema.type === "object" || e.schema.properties ? (n(), s("section", A, [
49
- l("ul", null, [
50
- (n(!0), s(y, null, h(O(
51
- e.schema.properties || {},
52
- e.schema.required
53
- ), (i, m) => (n(), s("li", { key: m }, [
54
- l("strong", null, [
55
- l("code", null, o(m), 1),
56
- e.schema.required?.includes(m) ? (n(), s("span", B, " (required) ")) : u("", !0)
57
- ]),
58
- l("p", null, [
59
- l("code", null, o(Array.isArray(i.type) ? i.type.join(" | ") : i.type || "object"), 1),
60
- i.format ? (n(), s("span", C, [
61
- t[4] || (t[4] = a(", format: ", -1)),
62
- l("code", null, o(i.format), 1)
63
- ])) : u("", !0),
64
- i.enum ? (n(), s("span", J, [
65
- t[5] || (t[5] = a(", possible values: ", -1)),
66
- l("code", null, o(i.enum.map((c) => JSON.stringify(c)).join(", ")), 1)
67
- ])) : u("", !0),
68
- i.default !== void 0 ? (n(), s("span", V, [
69
- t[6] || (t[6] = a(", default: ", -1)),
70
- l("code", null, o(JSON.stringify(i.default)), 1)
71
- ])) : u("", !0),
72
- i.description ? (n(), s("span", E, " — " + o(i.description), 1)) : u("", !0)
73
- ]),
74
- i.type === "object" || i.properties ? (n(), v(d, {
75
- key: 0,
76
- schema: i
77
- }, null, 8, ["schema"])) : u("", !0),
78
- i.type === "array" && i.items ? (n(), s("section", M, [
79
- t[7] || (t[7] = l("header", null, [
80
- l("strong", null, "Items:")
81
- ], -1)),
82
- r(d, {
83
- schema: i.items
84
- }, null, 8, ["schema"])
85
- ])) : u("", !0)
86
- ]))), 128))
87
- ])
88
- ])) : e.schema.type === "array" && e.schema.items ? (n(), s("section", R, [
89
- t[11] || (t[11] = l("header", null, [
90
- l("strong", null, "Array of:")
91
- ], -1)),
92
- l("section", null, [
93
- r(d, {
94
- schema: e.schema.items
95
- }, null, 8, ["schema"])
96
- ]),
97
- e.schema.minItems !== void 0 || e.schema.maxItems !== void 0 || e.schema.uniqueItems ? (n(), s("ul", D, [
98
- e.schema.minItems !== void 0 ? (n(), s("li", F, [
99
- t[8] || (t[8] = a(" Min items: ", -1)),
100
- l("code", null, o(e.schema.minItems), 1)
101
- ])) : u("", !0),
102
- e.schema.maxItems !== void 0 ? (n(), s("li", L, [
103
- t[9] || (t[9] = a(" Max items: ", -1)),
104
- l("code", null, o(e.schema.maxItems), 1)
105
- ])) : u("", !0),
106
- e.schema.uniqueItems ? (n(), s("li", P, [...t[10] || (t[10] = [
107
- a("Unique items: ", -1),
108
- l("code", null, "true", -1)
109
- ])])) : u("", !0)
110
- ])) : u("", !0)
111
- ])) : (n(), s("section", T, [
112
- l("p", null, [
113
- l("code", null, o(e.schema.type), 1),
114
- e.schema.format ? (n(), s("span", U, [
115
- t[12] || (t[12] = a(", format: ", -1)),
116
- l("code", null, o(e.schema.format), 1)
117
- ])) : u("", !0),
118
- e.schema.enum ? (n(), s("span", w, [
119
- t[13] || (t[13] = a(", possible values: ", -1)),
120
- l("code", null, o(e.schema.enum.map((i) => JSON.stringify(i)).join(", ")), 1)
121
- ])) : u("", !0),
122
- e.schema.default !== void 0 ? (n(), s("span", z, [
123
- t[14] || (t[14] = a(", default: ", -1)),
124
- l("code", null, o(JSON.stringify(e.schema.default)), 1)
125
- ])) : u("", !0),
126
- e.schema.description ? (n(), s("span", G, " — " + o(e.schema.description), 1)) : u("", !0)
127
- ])
128
- ]))
129
- ])) : u("", !0);
130
- };
131
- }
132
- });
133
- export {
134
- K as default
135
- };
@@ -1,4 +0,0 @@
1
- import f from "./Schema.vue.js";
2
- export {
3
- f as default
4
- };
@@ -1,19 +0,0 @@
1
- import { defineComponent as a, createElementBlock as o, openBlock as t, createElementVNode as l, toDisplayString as n, unref as s } from "vue";
2
- import { json2xml as c } from "@scalar/helpers/file/json2xml";
3
- const m = { key: 0 }, r = { class: "language-xml" }, d = { key: 1 }, i = { class: "language-json" }, g = /* @__PURE__ */ a({
4
- __name: "XmlOrJson",
5
- props: {
6
- xml: { type: Boolean, default: !1 },
7
- modelValue: { type: [Object, Boolean] }
8
- },
9
- setup(e) {
10
- return (u, _) => e.xml ? (t(), o("pre", m, [
11
- l("code", r, n(s(c)(e.modelValue)), 1)
12
- ])) : (t(), o("pre", d, [
13
- l("code", i, n(JSON.stringify(e.modelValue, null, 2)), 1)
14
- ]));
15
- }
16
- });
17
- export {
18
- g as default
19
- };
@@ -1,4 +0,0 @@
1
- import f from "./XmlOrJson.vue.js";
2
- export {
3
- f as default
4
- };
@@ -1,41 +0,0 @@
1
- import { normalize as n, dereference as i } from "@scalar/openapi-parser";
2
- import { upgrade as p } from "@scalar/openapi-upgrader";
3
- import { minify as a } from "html-minifier-terser";
4
- import s from "rehype-parse";
5
- import u from "rehype-remark";
6
- import c from "rehype-sanitize";
7
- import f from "remark-gfm";
8
- import l from "remark-stringify";
9
- import { unified as y } from "unified";
10
- import { createSSRApp as d } from "vue";
11
- import { renderToString as g } from "vue/server-renderer";
12
- import h from "./components/MarkdownReference.vue.js";
13
- async function S(e) {
14
- const r = p(n(e), "3.1"), { schema: t } = i(r), o = d(h, {
15
- content: t
16
- }), m = await g(o);
17
- return a(m, {
18
- removeComments: !0,
19
- removeEmptyElements: !0,
20
- collapseWhitespace: !0,
21
- continueOnParseError: !0,
22
- noNewlinesBeforeTagClose: !0,
23
- preserveLineBreaks: !0,
24
- removeEmptyAttributes: !0,
25
- decodeEntities: !0,
26
- useShortDoctype: !0
27
- });
28
- }
29
- async function R(e) {
30
- return k(await S(e));
31
- }
32
- async function k(e) {
33
- const r = await y().use(s, { fragment: !0 }).use(f).use(c).use(u).use(l, {
34
- bullet: "-"
35
- }).process(e);
36
- return String(r);
37
- }
38
- export {
39
- S as createHtmlFromOpenApi,
40
- R as createMarkdownFromOpenApi
41
- };