@barodoc/plugin-openapi 7.0.0 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +18 -0
- package/dist/index.js +397 -0
- package/package.json +3 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as _barodoc_core from '@barodoc/core';
|
|
2
|
+
|
|
3
|
+
interface OpenApiSpecEntry {
|
|
4
|
+
file: string;
|
|
5
|
+
basePath?: string;
|
|
6
|
+
groupBy?: "tags" | "paths";
|
|
7
|
+
baseUrl?: string;
|
|
8
|
+
}
|
|
9
|
+
interface OpenApiPluginOptions {
|
|
10
|
+
specFile: string | OpenApiSpecEntry[];
|
|
11
|
+
basePath?: string;
|
|
12
|
+
groupBy?: "tags" | "paths";
|
|
13
|
+
baseUrl?: string;
|
|
14
|
+
playground?: boolean;
|
|
15
|
+
}
|
|
16
|
+
declare const _default: (options: OpenApiPluginOptions) => _barodoc_core.BarodocPlugin;
|
|
17
|
+
|
|
18
|
+
export { type OpenApiPluginOptions, type OpenApiSpecEntry, _default as default };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import { definePlugin } from "@barodoc/core";
|
|
3
|
+
import fs from "fs";
|
|
4
|
+
import path from "path";
|
|
5
|
+
import { parse as parseYaml } from "yaml";
|
|
6
|
+
function resolveRef(ref, spec) {
|
|
7
|
+
const parts = ref.replace("#/", "").split("/");
|
|
8
|
+
let current = spec;
|
|
9
|
+
for (const part of parts) {
|
|
10
|
+
current = current?.[part];
|
|
11
|
+
}
|
|
12
|
+
return current || {};
|
|
13
|
+
}
|
|
14
|
+
function schemaToType(schema, spec) {
|
|
15
|
+
if (!schema) return "any";
|
|
16
|
+
if (schema.$ref) return schemaToType(resolveRef(schema.$ref, spec), spec);
|
|
17
|
+
if (schema.enum) return schema.enum.map((e) => `"${e}"`).join(" \\| ");
|
|
18
|
+
if (schema.type === "array") return `${schemaToType(schema.items, spec)}[]`;
|
|
19
|
+
if (schema.type === "object" && schema.properties) return "object";
|
|
20
|
+
return schema.type || "any";
|
|
21
|
+
}
|
|
22
|
+
function generateExampleFromSchema(schema, spec, depth = 0) {
|
|
23
|
+
if (!schema || depth > 5) return null;
|
|
24
|
+
if (schema.$ref) return generateExampleFromSchema(resolveRef(schema.$ref, spec), spec, depth + 1);
|
|
25
|
+
if (schema.enum) return schema.enum[0];
|
|
26
|
+
switch (schema.type) {
|
|
27
|
+
case "string":
|
|
28
|
+
if (schema.format === "date-time") return "2024-01-15T09:30:00.000Z";
|
|
29
|
+
if (schema.format === "date") return "2024-01-15";
|
|
30
|
+
if (schema.format === "email") return "user@example.com";
|
|
31
|
+
return "string";
|
|
32
|
+
case "integer":
|
|
33
|
+
case "number":
|
|
34
|
+
return schema.format === "int64" ? 10 : 0;
|
|
35
|
+
case "boolean":
|
|
36
|
+
return true;
|
|
37
|
+
case "array":
|
|
38
|
+
return [generateExampleFromSchema(schema.items, spec, depth + 1)];
|
|
39
|
+
case "object": {
|
|
40
|
+
if (!schema.properties) return {};
|
|
41
|
+
const obj = {};
|
|
42
|
+
for (const [key, prop] of Object.entries(schema.properties)) {
|
|
43
|
+
obj[key] = generateExampleFromSchema(prop, spec, depth + 1);
|
|
44
|
+
}
|
|
45
|
+
return obj;
|
|
46
|
+
}
|
|
47
|
+
default:
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function escapeMdx(text) {
|
|
52
|
+
return text.replace(/\{/g, "\\{").replace(/\}/g, "\\}");
|
|
53
|
+
}
|
|
54
|
+
function buildPlaygroundParams(op, spec) {
|
|
55
|
+
const params = op.parameters || [];
|
|
56
|
+
if (params.length === 0) return "[]";
|
|
57
|
+
const items = params.map((p) => {
|
|
58
|
+
const type = schemaToType(p.schema, spec).replace(/"/g, "'").replace(/\\\|/g, "|");
|
|
59
|
+
const desc = (p.description || "").replace(/"/g, '\\"');
|
|
60
|
+
const resolved = p.schema?.$ref ? resolveRef(p.schema.$ref, spec) : p.schema;
|
|
61
|
+
const enumVals = resolved?.enum;
|
|
62
|
+
const enumProp = enumVals ? `, enum: ${JSON.stringify(enumVals)}` : "";
|
|
63
|
+
return `{ name: "${p.name}", in: "${p.in}", type: "${type}", required: ${!!p.required}, description: "${desc}"${enumProp} }`;
|
|
64
|
+
});
|
|
65
|
+
return `[${items.join(", ")}]`;
|
|
66
|
+
}
|
|
67
|
+
function buildInitialBody(op, spec) {
|
|
68
|
+
const content = op.requestBody?.content;
|
|
69
|
+
if (!content) return null;
|
|
70
|
+
for (const [, mediaObj] of Object.entries(content)) {
|
|
71
|
+
if (!mediaObj.schema) continue;
|
|
72
|
+
const resolved = mediaObj.schema.$ref ? resolveRef(mediaObj.schema.$ref, spec) : mediaObj.schema;
|
|
73
|
+
const example = generateExampleFromSchema(resolved, spec);
|
|
74
|
+
if (example && typeof example === "object") {
|
|
75
|
+
return JSON.stringify(example, null, 2);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
function buildCurlExample(method, fullUrl, op, spec) {
|
|
81
|
+
const parts = [`curl -X ${method} '${fullUrl}'`];
|
|
82
|
+
if (op.requestBody?.content?.["application/json"]) {
|
|
83
|
+
parts.push(` -H 'Content-Type: application/json'`);
|
|
84
|
+
const schema = op.requestBody.content["application/json"].schema;
|
|
85
|
+
if (schema) {
|
|
86
|
+
const resolved = schema.$ref ? resolveRef(schema.$ref, spec) : schema;
|
|
87
|
+
const example = generateExampleFromSchema(resolved, spec);
|
|
88
|
+
if (example) {
|
|
89
|
+
parts.push(` -d '${JSON.stringify(example)}'`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return parts.join(" \\\n");
|
|
94
|
+
}
|
|
95
|
+
function statusCodeClass(code) {
|
|
96
|
+
const n = parseInt(code, 10);
|
|
97
|
+
if (n < 300) return "bd-status-2xx";
|
|
98
|
+
if (n < 400) return "bd-status-3xx";
|
|
99
|
+
if (n < 500) return "bd-status-4xx";
|
|
100
|
+
return "bd-status-5xx";
|
|
101
|
+
}
|
|
102
|
+
function generateMdxForOperation(httpMethod, urlPath, op, spec, opts) {
|
|
103
|
+
const lines = [];
|
|
104
|
+
const method = httpMethod.toUpperCase();
|
|
105
|
+
const summary = op.summary || "";
|
|
106
|
+
const description = op.description || "";
|
|
107
|
+
lines.push(`<ApiEndpoint method="${method}" path={\`${urlPath}\`} summary="${summary.replace(/"/g, '\\"')}" />
|
|
108
|
+
`);
|
|
109
|
+
if (description && description !== summary) {
|
|
110
|
+
lines.push(`${description}
|
|
111
|
+
`);
|
|
112
|
+
}
|
|
113
|
+
const params = op.parameters || [];
|
|
114
|
+
if (params.length > 0) {
|
|
115
|
+
lines.push(`<div className="bd-api-section">
|
|
116
|
+
`);
|
|
117
|
+
lines.push(`#### Parameters
|
|
118
|
+
`);
|
|
119
|
+
lines.push(`<div className="bd-api-param-list">
|
|
120
|
+
`);
|
|
121
|
+
for (const p of params) {
|
|
122
|
+
const type = schemaToType(p.schema, spec);
|
|
123
|
+
const required = p.required ? ' <span className="bd-param-required">required</span>' : ' <span className="bd-param-optional">optional</span>';
|
|
124
|
+
lines.push(`<div className="bd-api-param-item">`);
|
|
125
|
+
lines.push(` <div className="bd-api-param-name">`);
|
|
126
|
+
lines.push(` <code>${p.name}</code>${required}`);
|
|
127
|
+
lines.push(` <span className="bd-api-param-type">${escapeMdx(type)}</span>`);
|
|
128
|
+
lines.push(` </div>`);
|
|
129
|
+
if (p.description) {
|
|
130
|
+
lines.push(` <div className="bd-api-param-desc">${p.description}</div>`);
|
|
131
|
+
}
|
|
132
|
+
if (p.schema?.enum) {
|
|
133
|
+
const vals = p.schema.enum.map((e) => `\`${e}\``).join(" ");
|
|
134
|
+
lines.push(` <div className="bd-api-param-enum">Values: ${vals}</div>`);
|
|
135
|
+
}
|
|
136
|
+
lines.push(`</div>
|
|
137
|
+
`);
|
|
138
|
+
}
|
|
139
|
+
lines.push(`</div>
|
|
140
|
+
`);
|
|
141
|
+
lines.push(`</div>
|
|
142
|
+
`);
|
|
143
|
+
}
|
|
144
|
+
if (op.requestBody) {
|
|
145
|
+
lines.push(`<div className="bd-api-section">
|
|
146
|
+
`);
|
|
147
|
+
lines.push(`#### Request Body
|
|
148
|
+
`);
|
|
149
|
+
const content = op.requestBody.content;
|
|
150
|
+
if (content) {
|
|
151
|
+
for (const [mediaType, mediaObj] of Object.entries(content)) {
|
|
152
|
+
lines.push(`<span className="bd-api-content-type">\`${mediaType}\`</span>
|
|
153
|
+
`);
|
|
154
|
+
if (mediaObj.schema) {
|
|
155
|
+
const resolved = mediaObj.schema.$ref ? resolveRef(mediaObj.schema.$ref, spec) : mediaObj.schema;
|
|
156
|
+
if (resolved.properties) {
|
|
157
|
+
lines.push(`<div className="bd-api-param-list">
|
|
158
|
+
`);
|
|
159
|
+
for (const [name, prop] of Object.entries(resolved.properties)) {
|
|
160
|
+
const req = resolved.required?.includes(name);
|
|
161
|
+
const reqBadge = req ? ' <span className="bd-param-required">required</span>' : ' <span className="bd-param-optional">optional</span>';
|
|
162
|
+
const type = schemaToType(prop, spec);
|
|
163
|
+
lines.push(`<div className="bd-api-param-item">`);
|
|
164
|
+
lines.push(` <div className="bd-api-param-name">`);
|
|
165
|
+
lines.push(` <code>${name}</code>${reqBadge}`);
|
|
166
|
+
lines.push(` <span className="bd-api-param-type">${escapeMdx(type)}</span>`);
|
|
167
|
+
lines.push(` </div>`);
|
|
168
|
+
if (prop.description) {
|
|
169
|
+
lines.push(` <div className="bd-api-param-desc">${prop.description}</div>`);
|
|
170
|
+
}
|
|
171
|
+
if (prop.enum) {
|
|
172
|
+
const vals = prop.enum.map((e) => `\`${e}\``).join(" ");
|
|
173
|
+
lines.push(` <div className="bd-api-param-enum">Values: ${vals}</div>`);
|
|
174
|
+
}
|
|
175
|
+
lines.push(`</div>
|
|
176
|
+
`);
|
|
177
|
+
}
|
|
178
|
+
lines.push(`</div>
|
|
179
|
+
`);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
lines.push(`</div>
|
|
185
|
+
`);
|
|
186
|
+
}
|
|
187
|
+
if (op.responses) {
|
|
188
|
+
lines.push(`<div className="bd-api-section">
|
|
189
|
+
`);
|
|
190
|
+
lines.push(`#### Responses
|
|
191
|
+
`);
|
|
192
|
+
lines.push(`<div className="bd-api-responses">
|
|
193
|
+
`);
|
|
194
|
+
for (const [status, resp] of Object.entries(op.responses)) {
|
|
195
|
+
const cls = statusCodeClass(status);
|
|
196
|
+
lines.push(`<div className="bd-api-response-item">`);
|
|
197
|
+
lines.push(` <span className="bd-api-status-badge ${cls}">${status}</span>`);
|
|
198
|
+
lines.push(` <span className="bd-api-response-desc">${resp.description || ""}</span>`);
|
|
199
|
+
lines.push(`</div>
|
|
200
|
+
`);
|
|
201
|
+
const respContent = resp.content?.["application/json"]?.schema;
|
|
202
|
+
if (respContent) {
|
|
203
|
+
const resolved = respContent.$ref ? resolveRef(respContent.$ref, spec) : respContent;
|
|
204
|
+
const example = generateExampleFromSchema(resolved, spec);
|
|
205
|
+
if (example) {
|
|
206
|
+
const jsonStr = JSON.stringify(example, null, 2);
|
|
207
|
+
lines.push(`<details className="bd-api-example-details">`);
|
|
208
|
+
lines.push(`<summary>Example Response</summary>
|
|
209
|
+
`);
|
|
210
|
+
lines.push("```json");
|
|
211
|
+
lines.push(jsonStr);
|
|
212
|
+
lines.push("```\n");
|
|
213
|
+
lines.push(`</details>
|
|
214
|
+
`);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
lines.push(`</div>
|
|
219
|
+
`);
|
|
220
|
+
lines.push(`</div>
|
|
221
|
+
`);
|
|
222
|
+
}
|
|
223
|
+
const fullUrl = `${opts.baseUrl}${urlPath}`;
|
|
224
|
+
const curlExample = buildCurlExample(method, fullUrl, op, spec);
|
|
225
|
+
lines.push(`<details className="bd-api-example-details">`);
|
|
226
|
+
lines.push(`<summary>Request Example</summary>
|
|
227
|
+
`);
|
|
228
|
+
lines.push("```bash");
|
|
229
|
+
lines.push(curlExample);
|
|
230
|
+
lines.push("```\n");
|
|
231
|
+
lines.push(`</details>
|
|
232
|
+
`);
|
|
233
|
+
if (opts.playground) {
|
|
234
|
+
const paramsStr = buildPlaygroundParams(op, spec);
|
|
235
|
+
const bodyStr = buildInitialBody(op, spec);
|
|
236
|
+
const bodyProp = bodyStr ? ` body={${JSON.stringify(bodyStr)}}` : "";
|
|
237
|
+
lines.push(`<ApiPlayground client:load method="${method}" url="${fullUrl}" params={${paramsStr}}${bodyProp} />
|
|
238
|
+
`);
|
|
239
|
+
}
|
|
240
|
+
lines.push(`<hr className="bd-api-divider" />
|
|
241
|
+
`);
|
|
242
|
+
return lines.join("\n");
|
|
243
|
+
}
|
|
244
|
+
function processSpec(root, entry, playground, importBlock) {
|
|
245
|
+
const specPath = path.resolve(root, entry.file);
|
|
246
|
+
if (!fs.existsSync(specPath)) {
|
|
247
|
+
console.warn(`[plugin-openapi] Spec file not found: ${specPath}`);
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
const raw = fs.readFileSync(specPath, "utf-8");
|
|
251
|
+
const spec = specPath.endsWith(".yaml") || specPath.endsWith(".yml") ? parseYaml(raw) : JSON.parse(raw);
|
|
252
|
+
if (!spec.paths) return;
|
|
253
|
+
const genOpts = { playground, baseUrl: entry.baseUrl };
|
|
254
|
+
const pagesDir = path.join(root, "src/content/docs");
|
|
255
|
+
const apiDir = path.join(pagesDir, entry.basePath.replace(/^\//, ""));
|
|
256
|
+
fs.mkdirSync(apiDir, { recursive: true });
|
|
257
|
+
const apiOverview = buildApiOverview(spec, entry.baseUrl);
|
|
258
|
+
if (entry.groupBy === "tags") {
|
|
259
|
+
const tagMap = /* @__PURE__ */ new Map();
|
|
260
|
+
const tagOps = /* @__PURE__ */ new Map();
|
|
261
|
+
for (const [urlPath, methods] of Object.entries(spec.paths)) {
|
|
262
|
+
for (const [method, op] of Object.entries(methods)) {
|
|
263
|
+
const tags = op.tags?.length ? op.tags : ["default"];
|
|
264
|
+
const mdx = generateMdxForOperation(method, urlPath, op, spec, genOpts);
|
|
265
|
+
for (const tag of tags) {
|
|
266
|
+
if (!tagMap.has(tag)) tagMap.set(tag, []);
|
|
267
|
+
if (!tagOps.has(tag)) tagOps.set(tag, []);
|
|
268
|
+
tagMap.get(tag).push({ method: method.toUpperCase(), path: urlPath, summary: op.summary || "" });
|
|
269
|
+
tagOps.get(tag).push(mdx);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
for (const [tag, endpoints] of tagMap) {
|
|
274
|
+
const slug = tag.toLowerCase().replace(/[^a-z0-9]+/g, "-");
|
|
275
|
+
const toc = buildEndpointToc(endpoints);
|
|
276
|
+
const content = [
|
|
277
|
+
"---",
|
|
278
|
+
`title: "${tag}"`,
|
|
279
|
+
`description: "API endpoints for ${tag}"`,
|
|
280
|
+
"api_reference: true",
|
|
281
|
+
"---",
|
|
282
|
+
importBlock,
|
|
283
|
+
apiOverview,
|
|
284
|
+
toc,
|
|
285
|
+
...tagOps.get(tag)
|
|
286
|
+
].join("\n");
|
|
287
|
+
fs.writeFileSync(path.join(apiDir, `${slug}.mdx`), content);
|
|
288
|
+
}
|
|
289
|
+
} else {
|
|
290
|
+
const allOps = [];
|
|
291
|
+
const allEndpoints = [];
|
|
292
|
+
for (const [urlPath, methods] of Object.entries(spec.paths)) {
|
|
293
|
+
for (const [method, op] of Object.entries(methods)) {
|
|
294
|
+
allOps.push(generateMdxForOperation(method, urlPath, op, spec, genOpts));
|
|
295
|
+
allEndpoints.push({ method: method.toUpperCase(), path: urlPath, summary: op.summary || "" });
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
const toc = buildEndpointToc(allEndpoints);
|
|
299
|
+
const content = [
|
|
300
|
+
"---",
|
|
301
|
+
`title: "API Reference"`,
|
|
302
|
+
`description: "Auto-generated from OpenAPI spec"`,
|
|
303
|
+
"api_reference: true",
|
|
304
|
+
"---",
|
|
305
|
+
importBlock,
|
|
306
|
+
apiOverview,
|
|
307
|
+
toc,
|
|
308
|
+
...allOps
|
|
309
|
+
].join("\n");
|
|
310
|
+
fs.writeFileSync(path.join(apiDir, "index.mdx"), content);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
var index_default = definePlugin((options) => {
|
|
314
|
+
const {
|
|
315
|
+
specFile,
|
|
316
|
+
basePath = "api",
|
|
317
|
+
groupBy = "tags",
|
|
318
|
+
baseUrl = "",
|
|
319
|
+
playground = true
|
|
320
|
+
} = options;
|
|
321
|
+
const entries = Array.isArray(specFile) ? specFile.map((s) => ({
|
|
322
|
+
file: s.file,
|
|
323
|
+
basePath: s.basePath ?? basePath,
|
|
324
|
+
groupBy: s.groupBy ?? groupBy,
|
|
325
|
+
baseUrl: s.baseUrl ?? baseUrl
|
|
326
|
+
})) : [{ file: specFile, basePath, groupBy, baseUrl }];
|
|
327
|
+
return {
|
|
328
|
+
name: "@barodoc/plugin-openapi",
|
|
329
|
+
astroIntegration: () => {
|
|
330
|
+
const integration = {
|
|
331
|
+
name: "@barodoc/plugin-openapi",
|
|
332
|
+
hooks: {
|
|
333
|
+
"astro:config:setup": ({ config: astroConfig }) => {
|
|
334
|
+
const root = astroConfig.root.pathname;
|
|
335
|
+
const imports = [];
|
|
336
|
+
imports.push(`import { ApiEndpoint } from "@barodoc/theme-docs/components";`);
|
|
337
|
+
if (playground) {
|
|
338
|
+
imports.push(`import { ApiPlayground } from "@barodoc/theme-docs/components";`);
|
|
339
|
+
}
|
|
340
|
+
const importBlock = imports.join("\n") + "\n";
|
|
341
|
+
for (const entry of entries) {
|
|
342
|
+
processSpec(root, entry, playground, importBlock);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
return integration;
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
});
|
|
351
|
+
function buildApiOverview(spec, baseUrl) {
|
|
352
|
+
const lines = [];
|
|
353
|
+
lines.push(`<div className="bd-api-overview">`);
|
|
354
|
+
if (baseUrl) {
|
|
355
|
+
lines.push(` <div className="bd-api-overview-item">`);
|
|
356
|
+
lines.push(` <span className="bd-api-overview-label">Base URL</span>`);
|
|
357
|
+
lines.push(` <code className="bd-api-overview-value">${baseUrl}</code>`);
|
|
358
|
+
lines.push(` </div>`);
|
|
359
|
+
}
|
|
360
|
+
lines.push(` <div className="bd-api-overview-item">`);
|
|
361
|
+
lines.push(` <span className="bd-api-overview-label">Content-Type</span>`);
|
|
362
|
+
lines.push(` <code className="bd-api-overview-value">application/json</code>`);
|
|
363
|
+
lines.push(` </div>`);
|
|
364
|
+
if (spec.info?.version) {
|
|
365
|
+
lines.push(` <div className="bd-api-overview-item">`);
|
|
366
|
+
lines.push(` <span className="bd-api-overview-label">Version</span>`);
|
|
367
|
+
lines.push(` <code className="bd-api-overview-value">${spec.info.version}</code>`);
|
|
368
|
+
lines.push(` </div>`);
|
|
369
|
+
}
|
|
370
|
+
lines.push(`</div>
|
|
371
|
+
`);
|
|
372
|
+
return lines.join("\n");
|
|
373
|
+
}
|
|
374
|
+
function buildEndpointToc(endpoints) {
|
|
375
|
+
const lines = [];
|
|
376
|
+
lines.push(`<nav className="bd-api-toc">`);
|
|
377
|
+
lines.push(` <div className="bd-api-toc-title">Endpoints</div>`);
|
|
378
|
+
lines.push(` <div className="bd-api-toc-list">`);
|
|
379
|
+
for (const ep of endpoints) {
|
|
380
|
+
const slug = `${ep.method.toLowerCase()}-${ep.path.replace(/[^a-z0-9]+/gi, "-").replace(/^-|-$/g, "")}`;
|
|
381
|
+
lines.push(` <a className="bd-api-toc-item" href={"#${slug}"}>`);
|
|
382
|
+
lines.push(` <span className="bd-api-toc-method bd-method-${ep.method.toLowerCase()}">${ep.method}</span>`);
|
|
383
|
+
const pathDisplay = ep.path.includes("{") ? `{\`${ep.path}\`}` : ep.path;
|
|
384
|
+
lines.push(` <span className="bd-api-toc-path">${pathDisplay}</span>`);
|
|
385
|
+
if (ep.summary) {
|
|
386
|
+
lines.push(` <span className="bd-api-toc-summary">${ep.summary.replace(/"/g, '\\"')}</span>`);
|
|
387
|
+
}
|
|
388
|
+
lines.push(` </a>`);
|
|
389
|
+
}
|
|
390
|
+
lines.push(` </div>`);
|
|
391
|
+
lines.push(`</nav>
|
|
392
|
+
`);
|
|
393
|
+
return lines.join("\n");
|
|
394
|
+
}
|
|
395
|
+
export {
|
|
396
|
+
index_default as default
|
|
397
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barodoc/plugin-openapi",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"description": "OpenAPI/Swagger auto-generation plugin for Barodoc",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -19,14 +19,14 @@
|
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"astro": "^5.0.0",
|
|
22
|
-
"@barodoc/core": "
|
|
22
|
+
"@barodoc/core": "8.0.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/node": "^22.0.0",
|
|
26
26
|
"astro": "^5.0.0",
|
|
27
27
|
"tsup": "^8.3.0",
|
|
28
28
|
"typescript": "^5.7.0",
|
|
29
|
-
"@barodoc/core": "
|
|
29
|
+
"@barodoc/core": "8.0.0"
|
|
30
30
|
},
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"scripts": {
|