@sdk-it/readme 0.24.0 → 0.26.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 +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +82 -10
- package/dist/index.js.map +2 -2
- package/dist/lib/generator.d.ts +6 -0
- package/dist/lib/generator.d.ts.map +1 -0
- package/dist/lib/prop.emitter.d.ts.map +1 -1
- package/dist/lib/readme.d.ts +3 -4
- package/dist/lib/readme.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// packages/readme/src/lib/readme.ts
|
|
2
2
|
import { isEmpty } from "@sdk-it/core";
|
|
3
3
|
import {
|
|
4
|
-
forEachOperation
|
|
4
|
+
forEachOperation,
|
|
5
|
+
toSidebar
|
|
5
6
|
} from "@sdk-it/spec";
|
|
6
7
|
|
|
7
8
|
// packages/readme/src/lib/prop.emitter.ts
|
|
@@ -262,18 +263,29 @@ var PropEmitter = class {
|
|
|
262
263
|
if (requestBody.description) {
|
|
263
264
|
lines.push(requestBody.description);
|
|
264
265
|
}
|
|
265
|
-
if (requestBody.required) {
|
|
266
|
-
lines.push(`*This request body is required.*`);
|
|
267
|
-
}
|
|
268
266
|
if (requestBody.content) {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
267
|
+
const contentEntries = Object.entries(requestBody.content);
|
|
268
|
+
if (contentEntries.length === 1) {
|
|
269
|
+
const [contentType, mediaType] = contentEntries[0];
|
|
272
270
|
lines.push(`**Content Type:** \`${contentType}\``);
|
|
273
271
|
if (mediaType.schema) {
|
|
274
272
|
const schemaDocs = this.handle(mediaType.schema);
|
|
275
273
|
lines.push(...schemaDocs);
|
|
276
274
|
}
|
|
275
|
+
} else {
|
|
276
|
+
for (const [contentType, mediaType] of contentEntries) {
|
|
277
|
+
lines.push(`<details>`);
|
|
278
|
+
lines.push(
|
|
279
|
+
`<summary><b>Content Type:</b> \`${contentType}\`</summary>`
|
|
280
|
+
);
|
|
281
|
+
lines.push("");
|
|
282
|
+
if (mediaType.schema) {
|
|
283
|
+
const schemaDocs = this.handle(mediaType.schema);
|
|
284
|
+
lines.push(...schemaDocs.map((l) => l));
|
|
285
|
+
}
|
|
286
|
+
lines.push("");
|
|
287
|
+
lines.push(`</details>`);
|
|
288
|
+
}
|
|
277
289
|
}
|
|
278
290
|
}
|
|
279
291
|
return lines;
|
|
@@ -281,16 +293,55 @@ var PropEmitter = class {
|
|
|
281
293
|
};
|
|
282
294
|
|
|
283
295
|
// packages/readme/src/lib/readme.ts
|
|
296
|
+
function generateTableOfContents(spec) {
|
|
297
|
+
const tocLines = [];
|
|
298
|
+
const sidebar = toSidebar(spec);
|
|
299
|
+
tocLines.push("## Table of Contents");
|
|
300
|
+
tocLines.push("");
|
|
301
|
+
for (const category of sidebar) {
|
|
302
|
+
if (category.category) {
|
|
303
|
+
tocLines.push(`### ${category.category}`);
|
|
304
|
+
tocLines.push("");
|
|
305
|
+
}
|
|
306
|
+
for (const item of category.items) {
|
|
307
|
+
if (item.items && item.items.length > 0) {
|
|
308
|
+
tocLines.push(`- **${item.title}**`);
|
|
309
|
+
for (const subItem of item.items) {
|
|
310
|
+
const anchor = `#${subItem.title.toLowerCase().replace(/[^\w\s-]/g, "").replace(/\s+/g, "-")}`;
|
|
311
|
+
tocLines.push(` - [${subItem.title}](${anchor})`);
|
|
312
|
+
}
|
|
313
|
+
} else {
|
|
314
|
+
tocLines.push(`- **${item.title}**`);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
tocLines.push("");
|
|
318
|
+
}
|
|
319
|
+
if (spec.components?.schemas) {
|
|
320
|
+
tocLines.push("- [Schemas](#schemas)");
|
|
321
|
+
tocLines.push("");
|
|
322
|
+
}
|
|
323
|
+
return tocLines;
|
|
324
|
+
}
|
|
284
325
|
function toReadme(spec, generators) {
|
|
285
326
|
const markdown = [];
|
|
286
327
|
const propEmitter = new PropEmitter(spec);
|
|
328
|
+
markdown.push("# API Reference");
|
|
329
|
+
markdown.push("");
|
|
330
|
+
markdown.push(
|
|
331
|
+
"This document provides an overview of the API endpoints available in this service. Each endpoint includes a brief description, example usage, and details about request and response formats."
|
|
332
|
+
);
|
|
333
|
+
markdown.push("");
|
|
334
|
+
markdown.unshift(...generateTableOfContents(spec));
|
|
335
|
+
markdown.push("");
|
|
336
|
+
markdown.push("```\n" + generators.client() + "\n```");
|
|
337
|
+
markdown.push("");
|
|
287
338
|
forEachOperation(spec, (entry, operation) => {
|
|
288
|
-
const { method, path
|
|
339
|
+
const { method, path } = entry;
|
|
289
340
|
markdown.push(
|
|
290
|
-
`#### ${name
|
|
341
|
+
`#### ${operation["x-fn-name"]} | ${`_${method.toUpperCase()} ${path}_`}`
|
|
291
342
|
);
|
|
292
343
|
markdown.push(operation.summary || "");
|
|
293
|
-
const snippet = generators.
|
|
344
|
+
const snippet = generators.snippet(entry, operation);
|
|
294
345
|
markdown.push(`##### Example usage`);
|
|
295
346
|
markdown.push(snippet);
|
|
296
347
|
const requestBodyContent = propEmitter.requestBody(operation.requestBody);
|
|
@@ -320,6 +371,27 @@ ${l}`));
|
|
|
320
371
|
markdown.push(`</details>`);
|
|
321
372
|
}
|
|
322
373
|
});
|
|
374
|
+
if (spec.components?.schemas) {
|
|
375
|
+
markdown.push("## Schemas");
|
|
376
|
+
markdown.push("");
|
|
377
|
+
for (const [schemaName, schema] of Object.entries(
|
|
378
|
+
spec.components.schemas
|
|
379
|
+
)) {
|
|
380
|
+
if (schemaName === "ValidationError") {
|
|
381
|
+
continue;
|
|
382
|
+
}
|
|
383
|
+
markdown.push(`<details>`);
|
|
384
|
+
markdown.push(
|
|
385
|
+
`<summary><h3 id="${schemaName.toLowerCase()}">${schemaName}</h3></summary>`
|
|
386
|
+
);
|
|
387
|
+
markdown.push("");
|
|
388
|
+
const schemaDocs = propEmitter.handle(schema);
|
|
389
|
+
markdown.push(...schemaDocs.map((line) => line.trim()));
|
|
390
|
+
markdown.push("");
|
|
391
|
+
markdown.push(`</details>`);
|
|
392
|
+
markdown.push("");
|
|
393
|
+
}
|
|
394
|
+
}
|
|
323
395
|
return markdown.join("\n\n");
|
|
324
396
|
}
|
|
325
397
|
export {
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/lib/readme.ts", "../src/lib/prop.emitter.ts"],
|
|
4
|
-
"sourcesContent": ["import { isEmpty } from '@sdk-it/core';\nimport {\n type OperationEntry,\n type OurOpenAPIObject,\n type TunedOperationObject,\n forEachOperation,\n} from '@sdk-it/spec';\n\nimport { PropEmitter } from './prop.emitter.ts';\n\nexport function toReadme(\n spec: OurOpenAPIObject,\n generators: {\n generateSnippet: (\n entry: OperationEntry,\n operation: TunedOperationObject,\n ) => string;\n },\n) {\n // table of content is the navigation headers in apiref\n const markdown: string[] = [];\n const propEmitter = new PropEmitter(spec);\n\n forEachOperation(spec, (entry, operation) => {\n const { method, path, name } = entry;\n markdown.push(\n `#### ${name || operation.operationId} | ${`_${method.toUpperCase()} ${path}_`}`,\n );\n markdown.push(operation.summary || '');\n\n const snippet = generators.generateSnippet(entry, operation);\n markdown.push(`##### Example usage`);\n markdown.push(snippet);\n\n // Process request body using the refactored emitter\n const requestBodyContent = propEmitter.requestBody(operation.requestBody);\n if (requestBodyContent.length > 1) {\n // Check if more than just the header was added\n markdown.push(requestBodyContent.join('\\n\\n'));\n }\n\n markdown.push(`##### Responses`);\n for (const status in operation.responses) {\n const response = operation.responses[status];\n // Wrap each response in its own toggle\n markdown.push(`<details>`);\n markdown.push(\n `<summary><b>${status}</b> <i>${response.description}</i></summary>`,\n );\n if (!isEmpty(response.content)) {\n for (const [contentType, mediaType] of Object.entries(\n response.content,\n )) {\n markdown.push(`\\n**Content Type:** \\`${contentType}\\``);\n if (mediaType.schema) {\n const schemaDocs = propEmitter.handle(mediaType.schema);\n // hide emitter output under the toggle\n markdown.push(...schemaDocs.map((l) => `\\n${l}`));\n }\n }\n }\n markdown.push(`</details>`);\n }\n });\n return markdown.join('\\n\\n');\n}\n", "import type {\n OpenAPIObject,\n ReferenceObject,\n RequestBodyObject,\n SchemaObject,\n} from 'openapi3-ts/oas31';\n\nimport { followRef, isRef } from '@sdk-it/core';\nimport { coerceTypes } from '@sdk-it/spec';\n\n/**\n * PropEmitter handles converting OpenAPI schemas to Markdown documentation\n * Similar structure to ZodDeserializer but for generating markdown props documentation\n */\nexport class PropEmitter {\n #spec: OpenAPIObject;\n\n constructor(spec: OpenAPIObject) {\n this.#spec = spec;\n }\n\n /**\n * Handle objects (properties)\n */\n #object(schema: SchemaObject): string[] {\n const lines: string[] = [];\n const properties = schema.properties || {};\n\n if (Object.keys(properties).length > 0) {\n lines.push(`**Properties:**`);\n\n for (const [propName, propSchema] of Object.entries(properties)) {\n const isRequired = (schema.required ?? []).includes(propName);\n lines.push(...this.#property(propName, propSchema, isRequired));\n }\n }\n\n // Handle additionalProperties\n if (schema.additionalProperties) {\n lines.push(`**Additional Properties:**`);\n if (typeof schema.additionalProperties === 'boolean') {\n lines.push(`- Allowed: ${schema.additionalProperties}`);\n } else {\n // Indent the schema documentation for additional properties\n lines.push(\n ...this.handle(schema.additionalProperties).map((l) => ` ${l}`),\n );\n }\n }\n\n return lines;\n }\n\n /**\n * Format a property with its type and description\n */\n #property(\n name: string,\n schema: SchemaObject | ReferenceObject,\n required: boolean,\n ): string[] {\n // get full docs and extract the type line\n const docs = this.handle(schema);\n const rawType = docs[0]\n .replace('**Type:** ', '')\n .replace(' (nullable)', '|null');\n\n // detect default if present on the schema\n const defaultVal =\n !isRef(schema) && (schema as SchemaObject).default !== undefined\n ? ` default: ${JSON.stringify((schema as SchemaObject).default)}`\n : '';\n\n // build summary line\n const reqMark = required ? ' required' : '';\n const summary = `- \\`${name}\\` ${rawType}${reqMark}${defaultVal}:`;\n\n // assemble final lines (skip the type and any default in details)\n const detailLines = docs\n .slice(1)\n .filter((l) => !l.startsWith('**Default:**'))\n .map((l) => ` ${l}`);\n\n return [summary, ...detailLines];\n }\n\n /**\n * Handle array schemas\n */\n #array(schema: SchemaObject): string[] {\n const lines: string[] = [];\n lines.push(`**Array items:**`);\n\n if (schema.items) {\n // Get documentation for the items schema\n const itemDocs = this.handle(schema.items);\n // Indent item documentation\n lines.push(...itemDocs.map((line) => ` ${line}`));\n } else {\n lines.push(` **Type:** \\`unknown\\``); // Array of unknown items\n }\n // Add array constraints\n if (schema.minItems !== undefined)\n lines.push(`- Minimum items: ${schema.minItems}`);\n if (schema.maxItems !== undefined)\n lines.push(`- Maximum items: ${schema.maxItems}`);\n if (schema.uniqueItems) lines.push(`- Items must be unique.`);\n\n return lines;\n }\n\n #ref($ref: string): string[] {\n const schemaName = $ref.split('/').pop() || 'object';\n const resolved = followRef<SchemaObject>(this.#spec, $ref);\n // Link to the schema definition (assuming heading anchors are generated elsewhere)\n const lines = [\n `**Type:** [\\`${schemaName}\\`](#${schemaName.toLowerCase()})`,\n ];\n if (resolved.description) {\n lines.push(resolved.description);\n }\n // Avoid deep recursion by default, just link and show description.\n // If more detail is needed, the linked definition should provide it.\n return lines;\n }\n\n #allOf(schemas: (SchemaObject | ReferenceObject)[]): string[] {\n const lines = ['**All of (Intersection):**'];\n schemas.forEach((subSchema, index) => {\n lines.push(`- **Constraint ${index + 1}:**`);\n const subLines = this.handle(subSchema);\n lines.push(...subLines.map((l) => ` ${l}`)); // Indent sub-schema docs\n });\n return lines;\n }\n\n #anyOf(schemas: (SchemaObject | ReferenceObject)[]): string[] {\n const lines = ['**Any of (Union):**'];\n schemas.forEach((subSchema, index) => {\n lines.push(`- **Option ${index + 1}:**`);\n const subLines = this.handle(subSchema);\n lines.push(...subLines.map((l) => ` ${l}`));\n });\n return lines;\n }\n\n #oneOf(schemas: (SchemaObject | ReferenceObject)[]): string[] {\n const lines = ['**One of (Exclusive Union):**'];\n schemas.forEach((subSchema, index) => {\n lines.push(`- **Option ${index + 1}:**`);\n const subLines = this.handle(subSchema);\n lines.push(...subLines.map((l) => ` ${l}`));\n });\n return lines;\n }\n\n #enum(schema: SchemaObject): string[] {\n const lines = [`**Type:** \\`${schema.type || 'unknown'}\\` (enum)`];\n if (schema.description) lines.push(schema.description);\n lines.push('**Allowed values:**');\n lines.push(\n ...(schema.enum || []).map((val) => `- \\`${JSON.stringify(val)}\\``),\n );\n if (schema.default !== undefined) {\n lines.push(`**Default:** \\`${JSON.stringify(schema.default)}\\``);\n }\n return lines;\n }\n\n #normal(type: string, schema: SchemaObject, nullable: boolean): string[] {\n const lines: string[] = [];\n const nullableSuffix = nullable ? ' (nullable)' : '';\n const description = schema.description ? [schema.description] : [];\n\n switch (type) {\n case 'string':\n lines.push(\n `**Type:** \\`string\\`${schema.format ? ` (format: ${schema.format})` : ''}${nullableSuffix}`,\n );\n lines.push(...description);\n if (schema.minLength !== undefined)\n lines.push(`- Minimum length: ${schema.minLength}`);\n if (schema.maxLength !== undefined)\n lines.push(`- Maximum length: ${schema.maxLength}`);\n if (schema.pattern !== undefined)\n lines.push(`- Pattern: \\`${schema.pattern}\\``);\n break;\n case 'number':\n case 'integer':\n lines.push(\n `**Type:** \\`${type}\\`${schema.format ? ` (format: ${schema.format})` : ''}${nullableSuffix}`,\n );\n lines.push(...description);\n // Add number constraints (OpenAPI 3.1)\n if (schema.minimum !== undefined) {\n // Check if exclusiveMinimum is a number (OAS 3.1)\n const exclusiveMin = typeof schema.exclusiveMinimum === 'number';\n lines.push(\n `- Minimum: ${schema.minimum}${exclusiveMin ? ' (exclusive)' : ''}`,\n );\n if (exclusiveMin) {\n lines.push(\n `- Must be strictly greater than: ${schema.exclusiveMinimum}`,\n );\n }\n } else if (typeof schema.exclusiveMinimum === 'number') {\n lines.push(\n `- Must be strictly greater than: ${schema.exclusiveMinimum}`,\n );\n }\n\n if (schema.maximum !== undefined) {\n // Check if exclusiveMaximum is a number (OAS 3.1)\n const exclusiveMax = typeof schema.exclusiveMaximum === 'number';\n lines.push(\n `- Maximum: ${schema.maximum}${exclusiveMax ? ' (exclusive)' : ''}`,\n );\n if (exclusiveMax) {\n lines.push(\n `- Must be strictly less than: ${schema.exclusiveMaximum}`,\n );\n }\n } else if (typeof schema.exclusiveMaximum === 'number') {\n lines.push(\n `- Must be strictly less than: ${schema.exclusiveMaximum}`,\n );\n }\n if (schema.multipleOf !== undefined)\n lines.push(`- Must be a multiple of: ${schema.multipleOf}`);\n break;\n case 'boolean':\n lines.push(`**Type:** \\`boolean\\`${nullableSuffix}`);\n lines.push(...description);\n break;\n case 'object':\n lines.push(`**Type:** \\`object\\`${nullableSuffix}`);\n lines.push(...description);\n lines.push(...this.#object(schema));\n break;\n case 'array':\n lines.push(`**Type:** \\`array\\`${nullableSuffix}`);\n lines.push(...description);\n lines.push(...this.#array(schema));\n break;\n case 'null':\n lines.push(`**Type:** \\`null\\``);\n lines.push(...description);\n break;\n default:\n lines.push(`**Type:** \\`${type}\\`${nullableSuffix}`);\n lines.push(...description);\n }\n if (schema.default !== undefined) {\n lines.push(`**Default:** \\`${JSON.stringify(schema.default)}\\``);\n }\n return lines.filter((l) => l); // Filter out empty description lines\n }\n\n /**\n * Handle schemas by resolving references and delegating to appropriate handler\n */\n public handle(schemaOrRef: SchemaObject | ReferenceObject): string[] {\n if (isRef(schemaOrRef)) {\n return this.#ref(schemaOrRef.$ref);\n }\n\n const schema = schemaOrRef;\n\n // Handle composition keywords first\n if (schema.allOf && Array.isArray(schema.allOf)) {\n return this.#allOf(schema.allOf);\n }\n if (schema.anyOf && Array.isArray(schema.anyOf)) {\n return this.#anyOf(schema.anyOf);\n }\n if (schema.oneOf && Array.isArray(schema.oneOf)) {\n return this.#oneOf(schema.oneOf);\n }\n\n // Handle enums\n if (schema.enum && Array.isArray(schema.enum)) {\n return this.#enum(schema);\n }\n\n // Determine type(s) and nullability\n let types = coerceTypes(schema);\n let nullable = false; // Default to false\n\n if (types.includes('null')) {\n nullable = true;\n types = types.filter((t) => t !== 'null');\n }\n\n // Infer type if not explicitly set\n if (types.length === 0) {\n if (schema.properties || schema.additionalProperties) {\n types = ['object'];\n } else if (schema.items) {\n types = ['array'];\n }\n // Add other inferences if needed (e.g., based on format)\n }\n\n // If still no type, treat as unknown or any\n if (types.length === 0) {\n const lines = ['**Type:** `unknown`'];\n if (schema.description) lines.push(schema.description);\n if (schema.default !== undefined)\n lines.push(`**Default:** \\`${JSON.stringify(schema.default)}\\``);\n return lines;\n }\n\n // Handle single type (potentially nullable)\n if (types.length === 1) {\n return this.#normal(types[0], schema, nullable);\n }\n\n // Handle union of multiple non-null types (potentially nullable overall)\n const typeString = types.join(' | ');\n const nullableSuffix = nullable ? ' (nullable)' : '';\n const lines = [`**Type:** \\`${typeString}\\`${nullableSuffix}`];\n if (schema.description) lines.push(schema.description);\n if (schema.default !== undefined)\n lines.push(`**Default:** \\`${JSON.stringify(schema.default)}\\``);\n return lines;\n }\n\n /**\n * Process a request body and return markdown documentation\n */\n requestBody(requestBody?: RequestBodyObject): string[] {\n if (!requestBody) return [];\n\n const lines: string[] = [];\n lines.push(`##### Request Body`);\n\n if (requestBody.description) {\n lines.push(requestBody.description);\n }\n if (requestBody.required) {\n lines.push(`*This request body is required.*`);\n }\n\n if (requestBody.content) {\n for (const [contentType, mediaType] of Object.entries(\n requestBody.content,\n )) {\n lines.push(`**Content Type:** \\`${contentType}\\``);\n\n if (mediaType.schema) {\n // Use the main handle method here\n const schemaDocs = this.handle(mediaType.schema);\n lines.push(...schemaDocs); // Add schema docs directly\n }\n }\n }\n\n return lines;\n }\n}\n"],
|
|
5
|
-
"mappings": ";AAAA,SAAS,eAAe;AACxB;AAAA,
|
|
4
|
+
"sourcesContent": ["import { isEmpty } from '@sdk-it/core';\nimport {\n type OurOpenAPIObject,\n forEachOperation,\n toSidebar,\n} from '@sdk-it/spec';\n\nimport type { Generator } from './generator.ts';\nimport { PropEmitter } from './prop.emitter.ts';\n\n/**\n * Generate Table of Contents from sidebar data\n */\nfunction generateTableOfContents(spec: OurOpenAPIObject): string[] {\n const tocLines: string[] = [];\n const sidebar = toSidebar(spec);\n\n tocLines.push('## Table of Contents');\n tocLines.push('');\n\n // Generate TOC based on sidebar structure\n for (const category of sidebar) {\n if (category.category) {\n tocLines.push(`### ${category.category}`);\n tocLines.push('');\n }\n\n for (const item of category.items) {\n if (item.items && item.items.length > 0) {\n // This is a tag/group with operations\n tocLines.push(`- **${item.title}**`);\n\n // Add each operation in this tag\n for (const subItem of item.items) {\n // Create anchor that matches the markdown header format\n const anchor = `#${subItem.title\n .toLowerCase()\n .replace(/[^\\w\\s-]/g, '')\n .replace(/\\s+/g, '-')}`;\n tocLines.push(` - [${subItem.title}](${anchor})`);\n }\n } else {\n // This might be a standalone item\n tocLines.push(`- **${item.title}**`);\n }\n }\n tocLines.push('');\n }\n\n // Add link to Schemas section if it exists\n if (spec.components?.schemas) {\n tocLines.push('- [Schemas](#schemas)');\n tocLines.push('');\n }\n\n return tocLines;\n}\n\nexport function toReadme(spec: OurOpenAPIObject, generators: Generator) {\n // table of content is the navigation headers in apiref\n const markdown: string[] = [];\n const propEmitter = new PropEmitter(spec);\n\n markdown.push('# API Reference');\n markdown.push('');\n markdown.push(\n 'This document provides an overview of the API endpoints available in this service. Each endpoint includes a brief description, example usage, and details about request and response formats.',\n );\n markdown.push('');\n markdown.unshift(...generateTableOfContents(spec));\n markdown.push('');\n markdown.push('```\\n' + generators.client() + '\\n```');\n markdown.push('');\n\n forEachOperation(spec, (entry, operation) => {\n const { method, path } = entry;\n markdown.push(\n `#### ${operation['x-fn-name']} | ${`_${method.toUpperCase()} ${path}_`}`,\n );\n markdown.push(operation.summary || '');\n\n const snippet = generators.snippet(entry, operation);\n markdown.push(`##### Example usage`);\n markdown.push(snippet);\n\n // Process request body using the refactored emitter\n const requestBodyContent = propEmitter.requestBody(operation.requestBody);\n if (requestBodyContent.length > 1) {\n // Check if more than just the header was added\n markdown.push(requestBodyContent.join('\\n\\n'));\n }\n\n markdown.push(`##### Responses`);\n for (const status in operation.responses) {\n const response = operation.responses[status];\n // Wrap each response in its own toggle\n markdown.push(`<details>`);\n markdown.push(\n `<summary><b>${status}</b> <i>${response.description}</i></summary>`,\n );\n if (!isEmpty(response.content)) {\n for (const [contentType, mediaType] of Object.entries(\n response.content,\n )) {\n markdown.push(`\\n**Content Type:** \\`${contentType}\\``);\n if (mediaType.schema) {\n const schemaDocs = propEmitter.handle(mediaType.schema);\n // hide emitter output under the toggle\n markdown.push(...schemaDocs.map((l) => `\\n${l}`));\n }\n }\n }\n markdown.push(`</details>`);\n }\n }); // Add schemas section at the bottom\n if (spec.components?.schemas) {\n markdown.push('## Schemas');\n markdown.push('');\n\n for (const [schemaName, schema] of Object.entries(\n spec.components.schemas,\n )) {\n // Include all schemas except ValidationError which is internal\n if (schemaName === 'ValidationError') {\n continue;\n }\n\n markdown.push(`<details>`);\n markdown.push(\n `<summary><h3 id=\"${schemaName.toLowerCase()}\">${schemaName}</h3></summary>`,\n );\n markdown.push('');\n\n const schemaDocs = propEmitter.handle(schema);\n markdown.push(...schemaDocs.map((line) => line.trim()));\n\n markdown.push('');\n markdown.push(`</details>`);\n markdown.push('');\n }\n }\n\n // Generate Table of Contents\n\n return markdown.join('\\n\\n');\n}\n", "import type {\n OpenAPIObject,\n ReferenceObject,\n RequestBodyObject,\n SchemaObject,\n} from 'openapi3-ts/oas31';\n\nimport { followRef, isRef } from '@sdk-it/core';\nimport { coerceTypes } from '@sdk-it/spec';\n\n/**\n * PropEmitter handles converting OpenAPI schemas to Markdown documentation\n * Similar structure to ZodDeserializer but for generating markdown props documentation\n */\nexport class PropEmitter {\n #spec: OpenAPIObject;\n\n constructor(spec: OpenAPIObject) {\n this.#spec = spec;\n }\n\n /**\n * Handle objects (properties)\n */\n #object(schema: SchemaObject): string[] {\n const lines: string[] = [];\n const properties = schema.properties || {};\n\n if (Object.keys(properties).length > 0) {\n lines.push(`**Properties:**`);\n\n for (const [propName, propSchema] of Object.entries(properties)) {\n const isRequired = (schema.required ?? []).includes(propName);\n lines.push(...this.#property(propName, propSchema, isRequired));\n }\n }\n\n // Handle additionalProperties\n if (schema.additionalProperties) {\n lines.push(`**Additional Properties:**`);\n if (typeof schema.additionalProperties === 'boolean') {\n lines.push(`- Allowed: ${schema.additionalProperties}`);\n } else {\n // Indent the schema documentation for additional properties\n lines.push(\n ...this.handle(schema.additionalProperties).map((l) => ` ${l}`),\n );\n }\n }\n\n return lines;\n }\n\n /**\n * Format a property with its type and description\n */\n #property(\n name: string,\n schema: SchemaObject | ReferenceObject,\n required: boolean,\n ): string[] {\n // get full docs and extract the type line\n const docs = this.handle(schema);\n const rawType = docs[0]\n .replace('**Type:** ', '')\n .replace(' (nullable)', '|null');\n\n // detect default if present on the schema\n const defaultVal =\n !isRef(schema) && (schema as SchemaObject).default !== undefined\n ? ` default: ${JSON.stringify((schema as SchemaObject).default)}`\n : '';\n\n // build summary line\n const reqMark = required ? ' required' : '';\n const summary = `- \\`${name}\\` ${rawType}${reqMark}${defaultVal}:`;\n\n // assemble final lines (skip the type and any default in details)\n const detailLines = docs\n .slice(1)\n .filter((l) => !l.startsWith('**Default:**'))\n .map((l) => ` ${l}`);\n\n return [summary, ...detailLines];\n }\n\n /**\n * Handle array schemas\n */\n #array(schema: SchemaObject): string[] {\n const lines: string[] = [];\n lines.push(`**Array items:**`);\n\n if (schema.items) {\n // Get documentation for the items schema\n const itemDocs = this.handle(schema.items);\n // Indent item documentation\n lines.push(...itemDocs.map((line) => ` ${line}`));\n } else {\n lines.push(` **Type:** \\`unknown\\``); // Array of unknown items\n }\n // Add array constraints\n if (schema.minItems !== undefined)\n lines.push(`- Minimum items: ${schema.minItems}`);\n if (schema.maxItems !== undefined)\n lines.push(`- Maximum items: ${schema.maxItems}`);\n if (schema.uniqueItems) lines.push(`- Items must be unique.`);\n\n return lines;\n }\n\n #ref($ref: string): string[] {\n const schemaName = $ref.split('/').pop() || 'object';\n const resolved = followRef<SchemaObject>(this.#spec, $ref);\n // Link to the schema definition (assuming heading anchors are generated elsewhere)\n const lines = [\n `**Type:** [\\`${schemaName}\\`](#${schemaName.toLowerCase()})`,\n ];\n if (resolved.description) {\n lines.push(resolved.description);\n }\n // Avoid deep recursion by default, just link and show description.\n // If more detail is needed, the linked definition should provide it.\n return lines;\n }\n\n #allOf(schemas: (SchemaObject | ReferenceObject)[]): string[] {\n const lines = ['**All of (Intersection):**'];\n schemas.forEach((subSchema, index) => {\n lines.push(`- **Constraint ${index + 1}:**`);\n const subLines = this.handle(subSchema);\n lines.push(...subLines.map((l) => ` ${l}`)); // Indent sub-schema docs\n });\n return lines;\n }\n\n #anyOf(schemas: (SchemaObject | ReferenceObject)[]): string[] {\n const lines = ['**Any of (Union):**'];\n schemas.forEach((subSchema, index) => {\n lines.push(`- **Option ${index + 1}:**`);\n const subLines = this.handle(subSchema);\n lines.push(...subLines.map((l) => ` ${l}`));\n });\n return lines;\n }\n\n #oneOf(schemas: (SchemaObject | ReferenceObject)[]): string[] {\n const lines = ['**One of (Exclusive Union):**'];\n schemas.forEach((subSchema, index) => {\n lines.push(`- **Option ${index + 1}:**`);\n const subLines = this.handle(subSchema);\n lines.push(...subLines.map((l) => ` ${l}`));\n });\n return lines;\n }\n\n #enum(schema: SchemaObject): string[] {\n const lines = [`**Type:** \\`${schema.type || 'unknown'}\\` (enum)`];\n if (schema.description) lines.push(schema.description);\n lines.push('**Allowed values:**');\n lines.push(\n ...(schema.enum || []).map((val) => `- \\`${JSON.stringify(val)}\\``),\n );\n if (schema.default !== undefined) {\n lines.push(`**Default:** \\`${JSON.stringify(schema.default)}\\``);\n }\n return lines;\n }\n\n #normal(type: string, schema: SchemaObject, nullable: boolean): string[] {\n const lines: string[] = [];\n const nullableSuffix = nullable ? ' (nullable)' : '';\n const description = schema.description ? [schema.description] : [];\n\n switch (type) {\n case 'string':\n lines.push(\n `**Type:** \\`string\\`${schema.format ? ` (format: ${schema.format})` : ''}${nullableSuffix}`,\n );\n lines.push(...description);\n if (schema.minLength !== undefined)\n lines.push(`- Minimum length: ${schema.minLength}`);\n if (schema.maxLength !== undefined)\n lines.push(`- Maximum length: ${schema.maxLength}`);\n if (schema.pattern !== undefined)\n lines.push(`- Pattern: \\`${schema.pattern}\\``);\n break;\n case 'number':\n case 'integer':\n lines.push(\n `**Type:** \\`${type}\\`${schema.format ? ` (format: ${schema.format})` : ''}${nullableSuffix}`,\n );\n lines.push(...description);\n // Add number constraints (OpenAPI 3.1)\n if (schema.minimum !== undefined) {\n // Check if exclusiveMinimum is a number (OAS 3.1)\n const exclusiveMin = typeof schema.exclusiveMinimum === 'number';\n lines.push(\n `- Minimum: ${schema.minimum}${exclusiveMin ? ' (exclusive)' : ''}`,\n );\n if (exclusiveMin) {\n lines.push(\n `- Must be strictly greater than: ${schema.exclusiveMinimum}`,\n );\n }\n } else if (typeof schema.exclusiveMinimum === 'number') {\n lines.push(\n `- Must be strictly greater than: ${schema.exclusiveMinimum}`,\n );\n }\n\n if (schema.maximum !== undefined) {\n // Check if exclusiveMaximum is a number (OAS 3.1)\n const exclusiveMax = typeof schema.exclusiveMaximum === 'number';\n lines.push(\n `- Maximum: ${schema.maximum}${exclusiveMax ? ' (exclusive)' : ''}`,\n );\n if (exclusiveMax) {\n lines.push(\n `- Must be strictly less than: ${schema.exclusiveMaximum}`,\n );\n }\n } else if (typeof schema.exclusiveMaximum === 'number') {\n lines.push(\n `- Must be strictly less than: ${schema.exclusiveMaximum}`,\n );\n }\n if (schema.multipleOf !== undefined)\n lines.push(`- Must be a multiple of: ${schema.multipleOf}`);\n break;\n case 'boolean':\n lines.push(`**Type:** \\`boolean\\`${nullableSuffix}`);\n lines.push(...description);\n break;\n case 'object':\n lines.push(`**Type:** \\`object\\`${nullableSuffix}`);\n lines.push(...description);\n lines.push(...this.#object(schema));\n break;\n case 'array':\n lines.push(`**Type:** \\`array\\`${nullableSuffix}`);\n lines.push(...description);\n lines.push(...this.#array(schema));\n break;\n case 'null':\n lines.push(`**Type:** \\`null\\``);\n lines.push(...description);\n break;\n default:\n lines.push(`**Type:** \\`${type}\\`${nullableSuffix}`);\n lines.push(...description);\n }\n if (schema.default !== undefined) {\n lines.push(`**Default:** \\`${JSON.stringify(schema.default)}\\``);\n }\n return lines.filter((l) => l); // Filter out empty description lines\n }\n\n /**\n * Handle schemas by resolving references and delegating to appropriate handler\n */\n public handle(schemaOrRef: SchemaObject | ReferenceObject): string[] {\n if (isRef(schemaOrRef)) {\n return this.#ref(schemaOrRef.$ref);\n }\n\n const schema = schemaOrRef;\n\n // Handle composition keywords first\n if (schema.allOf && Array.isArray(schema.allOf)) {\n return this.#allOf(schema.allOf);\n }\n if (schema.anyOf && Array.isArray(schema.anyOf)) {\n return this.#anyOf(schema.anyOf);\n }\n if (schema.oneOf && Array.isArray(schema.oneOf)) {\n return this.#oneOf(schema.oneOf);\n }\n\n // Handle enums\n if (schema.enum && Array.isArray(schema.enum)) {\n return this.#enum(schema);\n }\n\n // Determine type(s) and nullability\n let types = coerceTypes(schema);\n let nullable = false; // Default to false\n\n if (types.includes('null')) {\n nullable = true;\n types = types.filter((t) => t !== 'null');\n }\n\n // Infer type if not explicitly set\n if (types.length === 0) {\n if (schema.properties || schema.additionalProperties) {\n types = ['object'];\n } else if (schema.items) {\n types = ['array'];\n }\n // Add other inferences if needed (e.g., based on format)\n }\n\n // If still no type, treat as unknown or any\n if (types.length === 0) {\n const lines = ['**Type:** `unknown`'];\n if (schema.description) lines.push(schema.description);\n if (schema.default !== undefined)\n lines.push(`**Default:** \\`${JSON.stringify(schema.default)}\\``);\n return lines;\n }\n\n // Handle single type (potentially nullable)\n if (types.length === 1) {\n return this.#normal(types[0], schema, nullable);\n }\n\n // Handle union of multiple non-null types (potentially nullable overall)\n const typeString = types.join(' | ');\n const nullableSuffix = nullable ? ' (nullable)' : '';\n const lines = [`**Type:** \\`${typeString}\\`${nullableSuffix}`];\n if (schema.description) lines.push(schema.description);\n if (schema.default !== undefined)\n lines.push(`**Default:** \\`${JSON.stringify(schema.default)}\\``);\n return lines;\n }\n\n /**\n * Process a request body and return markdown documentation\n */\n requestBody(requestBody?: RequestBodyObject): string[] {\n if (!requestBody) return [];\n\n const lines: string[] = [];\n lines.push(`##### Request Body`);\n\n if (requestBody.description) {\n lines.push(requestBody.description);\n }\n\n if (requestBody.content) {\n const contentEntries = Object.entries(requestBody.content);\n\n // If only one content type, show it directly without toggles\n if (contentEntries.length === 1) {\n const [contentType, mediaType] = contentEntries[0];\n lines.push(`**Content Type:** \\`${contentType}\\``);\n\n if (mediaType.schema) {\n const schemaDocs = this.handle(mediaType.schema);\n lines.push(...schemaDocs);\n }\n } else {\n // Multiple content types - use collapsible toggles\n for (const [contentType, mediaType] of contentEntries) {\n lines.push(`<details>`);\n lines.push(\n `<summary><b>Content Type:</b> \\`${contentType}\\`</summary>`,\n );\n lines.push('');\n\n if (mediaType.schema) {\n const schemaDocs = this.handle(mediaType.schema);\n lines.push(...schemaDocs.map((l) => l));\n }\n\n lines.push('');\n lines.push(`</details>`);\n }\n }\n }\n\n return lines;\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,eAAe;AACxB;AAAA,EAEE;AAAA,EACA;AAAA,OACK;;;ACEP,SAAS,WAAW,aAAa;AACjC,SAAS,mBAAmB;AAMrB,IAAM,cAAN,MAAkB;AAAA,EACvB;AAAA,EAEA,YAAY,MAAqB;AAC/B,SAAK,QAAQ;AAAA,EACf;AAAA;AAAA;AAAA;AAAA,EAKA,QAAQ,QAAgC;AACtC,UAAM,QAAkB,CAAC;AACzB,UAAM,aAAa,OAAO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AAW,IAAI;AACtD,cAAI,UAAU,QAAQ;AACpB,kBAAM,aAAa,YAAY,OAAO,UAAU,MAAM;AAEtD,qBAAS,KAAK,GAAG,WAAW,IAAI,CAAC,MAAM;AAAA,EAAK,CAAC,EAAE,CAAC;AAAA,UAClD;AAAA,QACF;AAAA,MACF;AACA,eAAS,KAAK,YAAY;AAAA,IAC5B;AAAA,EACF,CAAC;AACD,MAAI,KAAK,YAAY,SAAS;AAC5B,aAAS,KAAK,YAAY;AAC1B,aAAS,KAAK,EAAE;AAEhB,eAAW,CAAC,YAAY,MAAM,KAAK,OAAO;AAAA,MACxC,KAAK,WAAW;AAAA,IAClB,GAAG;AAED,UAAI,eAAe,mBAAmB;AACpC;AAAA,MACF;AAEA,eAAS,KAAK,WAAW;AACzB,eAAS;AAAA,QACP,oBAAoB,WAAW,YAAY,CAAC,KAAK,UAAU;AAAA,MAC7D;AACA,eAAS,KAAK,EAAE;AAEhB,YAAM,aAAa,YAAY,OAAO,MAAM;AAC5C,eAAS,KAAK,GAAG,WAAW,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,CAAC;AAEtD,eAAS,KAAK,EAAE;AAChB,eAAS,KAAK,YAAY;AAC1B,eAAS,KAAK,EAAE;AAAA,IAClB;AAAA,EACF;AAIA,SAAO,SAAS,KAAK,MAAM;AAC7B;",
|
|
6
6
|
"names": ["lines"]
|
|
7
7
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/lib/generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACrB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,WAAW,SAAS;IACxB,MAAM,IAAI,MAAM,CAAC;IACjB,OAAO,CAAC,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,oBAAoB,GAAG,MAAM,CAAC;CACzE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prop.emitter.d.ts","sourceRoot":"","sources":["../../src/lib/prop.emitter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,YAAY,EACb,MAAM,mBAAmB,CAAC;AAK3B;;;GAGG;AACH,qBAAa,WAAW;;gBAGV,IAAI,EAAE,aAAa;IAiP/B;;OAEG;IACI,MAAM,CAAC,WAAW,EAAE,YAAY,GAAG,eAAe,GAAG,MAAM,EAAE;IAkEpE;;OAEG;IACH,WAAW,CAAC,WAAW,CAAC,EAAE,iBAAiB,GAAG,MAAM,EAAE;
|
|
1
|
+
{"version":3,"file":"prop.emitter.d.ts","sourceRoot":"","sources":["../../src/lib/prop.emitter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,YAAY,EACb,MAAM,mBAAmB,CAAC;AAK3B;;;GAGG;AACH,qBAAa,WAAW;;gBAGV,IAAI,EAAE,aAAa;IAiP/B;;OAEG;IACI,MAAM,CAAC,WAAW,EAAE,YAAY,GAAG,eAAe,GAAG,MAAM,EAAE;IAkEpE;;OAEG;IACH,WAAW,CAAC,WAAW,CAAC,EAAE,iBAAiB,GAAG,MAAM,EAAE;CA4CvD"}
|
package/dist/lib/readme.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}): string;
|
|
1
|
+
import { type OurOpenAPIObject } from '@sdk-it/spec';
|
|
2
|
+
import type { Generator } from './generator.ts';
|
|
3
|
+
export declare function toReadme(spec: OurOpenAPIObject, generators: Generator): string;
|
|
5
4
|
//# sourceMappingURL=readme.d.ts.map
|
package/dist/lib/readme.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readme.d.ts","sourceRoot":"","sources":["../../src/lib/readme.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,
|
|
1
|
+
{"version":3,"file":"readme.d.ts","sourceRoot":"","sources":["../../src/lib/readme.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,gBAAgB,EAGtB,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAmDhD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,gBAAgB,EAAE,UAAU,EAAE,SAAS,UAuFrE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sdk-it/readme",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"!**/*.tsbuildinfo"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@sdk-it/core": "0.
|
|
25
|
-
"@sdk-it/spec": "0.
|
|
24
|
+
"@sdk-it/core": "0.26.0",
|
|
25
|
+
"@sdk-it/spec": "0.26.0"
|
|
26
26
|
}
|
|
27
27
|
}
|