lokicms-plugin-api-docs 1.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.
Files changed (38) hide show
  1. package/README.md +220 -0
  2. package/dist/formatters/json-formatter.d.ts +25 -0
  3. package/dist/formatters/json-formatter.d.ts.map +1 -0
  4. package/dist/formatters/json-formatter.js +45 -0
  5. package/dist/formatters/json-formatter.js.map +1 -0
  6. package/dist/formatters/markdown-formatter.d.ts +21 -0
  7. package/dist/formatters/markdown-formatter.d.ts.map +1 -0
  8. package/dist/formatters/markdown-formatter.js +203 -0
  9. package/dist/formatters/markdown-formatter.js.map +1 -0
  10. package/dist/formatters/openapi-formatter.d.ts +14 -0
  11. package/dist/formatters/openapi-formatter.d.ts.map +1 -0
  12. package/dist/formatters/openapi-formatter.js +505 -0
  13. package/dist/formatters/openapi-formatter.js.map +1 -0
  14. package/dist/index.d.ts +16 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +18 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/plugin.d.ts +18 -0
  19. package/dist/plugin.d.ts.map +1 -0
  20. package/dist/plugin.js +448 -0
  21. package/dist/plugin.js.map +1 -0
  22. package/dist/services/doc-generator.d.ts +22 -0
  23. package/dist/services/doc-generator.d.ts.map +1 -0
  24. package/dist/services/doc-generator.js +370 -0
  25. package/dist/services/doc-generator.js.map +1 -0
  26. package/dist/services/schema-converter.d.ts +19 -0
  27. package/dist/services/schema-converter.d.ts.map +1 -0
  28. package/dist/services/schema-converter.js +371 -0
  29. package/dist/services/schema-converter.js.map +1 -0
  30. package/dist/services/typescript-generator.d.ts +27 -0
  31. package/dist/services/typescript-generator.d.ts.map +1 -0
  32. package/dist/services/typescript-generator.js +294 -0
  33. package/dist/services/typescript-generator.js.map +1 -0
  34. package/dist/types.d.ts +245 -0
  35. package/dist/types.d.ts.map +1 -0
  36. package/dist/types.js +5 -0
  37. package/dist/types.js.map +1 -0
  38. package/package.json +41 -0
package/README.md ADDED
@@ -0,0 +1,220 @@
1
+ # lokicms-plugin-api-docs
2
+
3
+ API documentation generator for LokiCMS with OpenAPI, Markdown, and TypeScript output support.
4
+
5
+ ## Features
6
+
7
+ - **Runtime Introspection**: Automatically discovers registered MCP tools and content types
8
+ - **Multiple Output Formats**: JSON, Markdown, OpenAPI 3.0, TypeScript interfaces
9
+ - **Zod Schema Conversion**: Converts Zod schemas to JSON Schema for documentation
10
+ - **5 MCP Tools**: Full control via Model Context Protocol
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install lokicms-plugin-api-docs
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ ```typescript
21
+ import apiDocsPlugin from 'lokicms-plugin-api-docs';
22
+
23
+ const cms = createLokiCMS({
24
+ plugins: [apiDocsPlugin],
25
+ apiDocs: {
26
+ title: 'My API',
27
+ version: '1.0.0',
28
+ description: 'API documentation for my LokiCMS project',
29
+ baseUrl: 'http://localhost:3000',
30
+ includeExamples: true,
31
+ },
32
+ });
33
+ ```
34
+
35
+ ## MCP Tools
36
+
37
+ | Tool | Description |
38
+ |------|-------------|
39
+ | `docs_generate` | Generate complete API documentation in specified format |
40
+ | `docs_tools` | List all available MCP tools with their schemas |
41
+ | `docs_content_types` | Document all content types and their fields |
42
+ | `docs_export` | Export documentation to a file |
43
+ | `docs_endpoints` | Generate REST-like endpoint documentation |
44
+
45
+ ### docs_generate
46
+
47
+ Generate complete API documentation.
48
+
49
+ ```json
50
+ {
51
+ "format": "openapi",
52
+ "includeTools": true,
53
+ "includeContentTypes": true,
54
+ "includeExamples": true,
55
+ "baseUrl": "https://api.example.com"
56
+ }
57
+ ```
58
+
59
+ ### docs_tools
60
+
61
+ List all available MCP tools.
62
+
63
+ ```json
64
+ {
65
+ "format": "markdown",
66
+ "filter": "vault",
67
+ "includeExamples": true
68
+ }
69
+ ```
70
+
71
+ ### docs_content_types
72
+
73
+ Document content types.
74
+
75
+ ```json
76
+ {
77
+ "format": "typescript",
78
+ "filter": "product"
79
+ }
80
+ ```
81
+
82
+ ### docs_export
83
+
84
+ Export documentation to a file.
85
+
86
+ ```json
87
+ {
88
+ "format": "openapi",
89
+ "outputPath": "./docs/api.json"
90
+ }
91
+ ```
92
+
93
+ ### docs_endpoints
94
+
95
+ Generate endpoint documentation.
96
+
97
+ ```json
98
+ {
99
+ "format": "markdown",
100
+ "groupByTag": true
101
+ }
102
+ ```
103
+
104
+ ## Output Formats
105
+
106
+ ### JSON
107
+
108
+ Raw structured JSON output with all documentation data.
109
+
110
+ ### Markdown
111
+
112
+ Human-readable documentation with tables and formatting:
113
+
114
+ ```markdown
115
+ # My API Documentation
116
+
117
+ ## MCP Tools
118
+
119
+ ### vault_create
120
+ Create a new credential
121
+
122
+ **Parameters:**
123
+ | Name | Type | Required | Description |
124
+ |------|------|----------|-------------|
125
+ | `name` | string | Yes | Credential name |
126
+ ...
127
+ ```
128
+
129
+ ### OpenAPI 3.0
130
+
131
+ Standard OpenAPI specification for use with Swagger UI, Postman, etc.
132
+
133
+ ```json
134
+ {
135
+ "openapi": "3.0.0",
136
+ "info": {
137
+ "title": "My API",
138
+ "version": "1.0.0"
139
+ },
140
+ "paths": {
141
+ "/mcp/vault_create": {
142
+ "post": {
143
+ "summary": "Create a new credential",
144
+ ...
145
+ }
146
+ }
147
+ }
148
+ }
149
+ ```
150
+
151
+ ### TypeScript
152
+
153
+ Generated TypeScript interfaces for type-safe frontend integration:
154
+
155
+ ```typescript
156
+ /**
157
+ * Create a new credential
158
+ */
159
+ export interface VaultCreateInput {
160
+ /** Credential name */
161
+ name: string;
162
+ /** Credential value */
163
+ value: string;
164
+ /** Project identifier */
165
+ project: string;
166
+ // ...
167
+ }
168
+ ```
169
+
170
+ ## Programmatic Usage
171
+
172
+ ```typescript
173
+ import {
174
+ getDocGenerator,
175
+ formatAsOpenApi,
176
+ generateTypeScript,
177
+ } from 'lokicms-plugin-api-docs';
178
+
179
+ // Get the documentation generator
180
+ const docGen = getDocGenerator();
181
+
182
+ // Generate documentation
183
+ const docs = await docGen.generate({
184
+ includeTools: true,
185
+ includeContentTypes: true,
186
+ includeExamples: true,
187
+ });
188
+
189
+ // Format as OpenAPI
190
+ const openApiSpec = formatAsOpenApi(docs, {
191
+ baseUrl: 'https://api.example.com',
192
+ });
193
+
194
+ // Generate TypeScript interfaces
195
+ const tsOutput = generateTypeScript(docs);
196
+ console.log(tsOutput.code);
197
+ ```
198
+
199
+ ## Configuration
200
+
201
+ ```typescript
202
+ interface ApiDocsConfig {
203
+ /** API title for documentation */
204
+ title?: string;
205
+ /** API version */
206
+ version?: string;
207
+ /** API description */
208
+ description?: string;
209
+ /** Base URL for endpoints */
210
+ baseUrl?: string;
211
+ /** Include example values in documentation */
212
+ includeExamples?: boolean;
213
+ /** Default output directory for exports */
214
+ outputDir?: string;
215
+ }
216
+ ```
217
+
218
+ ## License
219
+
220
+ MIT
@@ -0,0 +1,25 @@
1
+ /**
2
+ * JSON Formatter
3
+ * Outputs API documentation as formatted JSON
4
+ */
5
+ import type { ApiDocumentation } from '../types.js';
6
+ /**
7
+ * Format documentation as JSON
8
+ */
9
+ export declare function formatAsJson(docs: ApiDocumentation, options?: {
10
+ pretty?: boolean;
11
+ includeMetadata?: boolean;
12
+ }): string;
13
+ /**
14
+ * Format a subset of documentation as JSON
15
+ */
16
+ export declare function formatToolsAsJson(tools: ApiDocumentation['tools'], pretty?: boolean): string;
17
+ /**
18
+ * Format content types as JSON
19
+ */
20
+ export declare function formatContentTypesAsJson(contentTypes: ApiDocumentation['contentTypes'], pretty?: boolean): string;
21
+ /**
22
+ * Format endpoints as JSON
23
+ */
24
+ export declare function formatEndpointsAsJson(endpoints: ApiDocumentation['endpoints'], pretty?: boolean): string;
25
+ //# sourceMappingURL=json-formatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-formatter.d.ts","sourceRoot":"","sources":["../../src/formatters/json-formatter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD;;GAEG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,gBAAgB,EACtB,OAAO,GAAE;IACP,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,eAAe,CAAC,EAAE,OAAO,CAAC;CACtB,GACL,MAAM,CAcR;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,gBAAgB,CAAC,OAAO,CAAC,EAChC,MAAM,UAAO,GACZ,MAAM,CAIR;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,YAAY,EAAE,gBAAgB,CAAC,cAAc,CAAC,EAC9C,MAAM,UAAO,GACZ,MAAM,CAIR;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,gBAAgB,CAAC,WAAW,CAAC,EACxC,MAAM,UAAO,GACZ,MAAM,CAIR"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * JSON Formatter
3
+ * Outputs API documentation as formatted JSON
4
+ */
5
+ /**
6
+ * Format documentation as JSON
7
+ */
8
+ export function formatAsJson(docs, options = {}) {
9
+ const { pretty = true, includeMetadata = true } = options;
10
+ const output = includeMetadata
11
+ ? docs
12
+ : {
13
+ tools: docs.tools,
14
+ contentTypes: docs.contentTypes,
15
+ endpoints: docs.endpoints,
16
+ };
17
+ return pretty
18
+ ? JSON.stringify(output, null, 2)
19
+ : JSON.stringify(output);
20
+ }
21
+ /**
22
+ * Format a subset of documentation as JSON
23
+ */
24
+ export function formatToolsAsJson(tools, pretty = true) {
25
+ return pretty
26
+ ? JSON.stringify({ tools }, null, 2)
27
+ : JSON.stringify({ tools });
28
+ }
29
+ /**
30
+ * Format content types as JSON
31
+ */
32
+ export function formatContentTypesAsJson(contentTypes, pretty = true) {
33
+ return pretty
34
+ ? JSON.stringify({ contentTypes }, null, 2)
35
+ : JSON.stringify({ contentTypes });
36
+ }
37
+ /**
38
+ * Format endpoints as JSON
39
+ */
40
+ export function formatEndpointsAsJson(endpoints, pretty = true) {
41
+ return pretty
42
+ ? JSON.stringify({ endpoints }, null, 2)
43
+ : JSON.stringify({ endpoints });
44
+ }
45
+ //# sourceMappingURL=json-formatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-formatter.js","sourceRoot":"","sources":["../../src/formatters/json-formatter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;GAEG;AACH,MAAM,UAAU,YAAY,CAC1B,IAAsB,EACtB,UAGI,EAAE;IAEN,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,eAAe,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;IAE1D,MAAM,MAAM,GAAG,eAAe;QAC5B,CAAC,CAAC,IAAI;QACN,CAAC,CAAC;YACE,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,SAAS,EAAE,IAAI,CAAC,SAAS;SAC1B,CAAC;IAEN,OAAO,MAAM;QACX,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;QACjC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;AAC7B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAC/B,KAAgC,EAChC,MAAM,GAAG,IAAI;IAEb,OAAO,MAAM;QACX,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;QACpC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AAChC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,wBAAwB,CACtC,YAA8C,EAC9C,MAAM,GAAG,IAAI;IAEb,OAAO,MAAM;QACX,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,YAAY,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;QAC3C,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC;AACvC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CACnC,SAAwC,EACxC,MAAM,GAAG,IAAI;IAEb,OAAO,MAAM;QACX,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;QACxC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;AACpC,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Markdown Formatter
3
+ * Outputs API documentation as readable Markdown
4
+ */
5
+ import type { ApiDocumentation, ToolDocumentation, ContentTypeDocumentation } from '../types.js';
6
+ /**
7
+ * Format complete documentation as Markdown
8
+ */
9
+ export declare function formatAsMarkdown(docs: ApiDocumentation, options?: {
10
+ includeTableOfContents?: boolean;
11
+ includeExamples?: boolean;
12
+ }): string;
13
+ /**
14
+ * Format tools only as Markdown
15
+ */
16
+ export declare function formatToolsAsMarkdown(tools: ToolDocumentation[], includeExamples?: boolean): string;
17
+ /**
18
+ * Format content types only as Markdown
19
+ */
20
+ export declare function formatContentTypesAsMarkdown(contentTypes: ContentTypeDocumentation[]): string;
21
+ //# sourceMappingURL=markdown-formatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown-formatter.d.ts","sourceRoot":"","sources":["../../src/formatters/markdown-formatter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAChB,iBAAiB,EACjB,wBAAwB,EAGzB,MAAM,aAAa,CAAC;AAErB;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,gBAAgB,EACtB,OAAO,GAAE;IACP,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,eAAe,CAAC,EAAE,OAAO,CAAC;CACtB,GACL,MAAM,CAuER;AA+HD;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,iBAAiB,EAAE,EAC1B,eAAe,UAAQ,GACtB,MAAM,CAYR;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAC1C,YAAY,EAAE,wBAAwB,EAAE,GACvC,MAAM,CAYR"}
@@ -0,0 +1,203 @@
1
+ /**
2
+ * Markdown Formatter
3
+ * Outputs API documentation as readable Markdown
4
+ */
5
+ /**
6
+ * Format complete documentation as Markdown
7
+ */
8
+ export function formatAsMarkdown(docs, options = {}) {
9
+ const { includeTableOfContents = true, includeExamples = false } = options;
10
+ const lines = [];
11
+ // Title
12
+ lines.push(`# ${docs.info.title}`);
13
+ lines.push('');
14
+ lines.push(docs.info.description);
15
+ lines.push('');
16
+ lines.push(`**Version:** ${docs.info.version}`);
17
+ lines.push(`**Generated:** ${docs.info.generatedAt}`);
18
+ lines.push('');
19
+ // Table of Contents
20
+ if (includeTableOfContents) {
21
+ lines.push('## Table of Contents');
22
+ lines.push('');
23
+ if (docs.tools.length > 0) {
24
+ lines.push('- [MCP Tools](#mcp-tools)');
25
+ for (const tool of docs.tools) {
26
+ lines.push(` - [${tool.name}](#${tool.name.toLowerCase().replace(/_/g, '-')})`);
27
+ }
28
+ }
29
+ if (docs.contentTypes.length > 0) {
30
+ lines.push('- [Content Types](#content-types)');
31
+ for (const type of docs.contentTypes) {
32
+ lines.push(` - [${type.name}](#${type.slug.toLowerCase()})`);
33
+ }
34
+ }
35
+ if (docs.endpoints && docs.endpoints.length > 0) {
36
+ lines.push('- [Endpoints](#endpoints)');
37
+ }
38
+ lines.push('');
39
+ }
40
+ // MCP Tools Section
41
+ if (docs.tools.length > 0) {
42
+ lines.push('---');
43
+ lines.push('');
44
+ lines.push('## MCP Tools');
45
+ lines.push('');
46
+ for (const tool of docs.tools) {
47
+ lines.push(...formatTool(tool, includeExamples));
48
+ lines.push('');
49
+ }
50
+ }
51
+ // Content Types Section
52
+ if (docs.contentTypes.length > 0) {
53
+ lines.push('---');
54
+ lines.push('');
55
+ lines.push('## Content Types');
56
+ lines.push('');
57
+ for (const contentType of docs.contentTypes) {
58
+ lines.push(...formatContentType(contentType));
59
+ lines.push('');
60
+ }
61
+ }
62
+ // Endpoints Section
63
+ if (docs.endpoints && docs.endpoints.length > 0) {
64
+ lines.push('---');
65
+ lines.push('');
66
+ lines.push('## Endpoints');
67
+ lines.push('');
68
+ lines.push(...formatEndpointsTable(docs.endpoints));
69
+ }
70
+ return lines.join('\n');
71
+ }
72
+ /**
73
+ * Format a single MCP tool as Markdown
74
+ */
75
+ function formatTool(tool, includeExamples = false) {
76
+ const lines = [];
77
+ lines.push(`### ${tool.name}`);
78
+ lines.push('');
79
+ lines.push(tool.description);
80
+ lines.push('');
81
+ if (tool.parameters.length > 0) {
82
+ lines.push('**Parameters:**');
83
+ lines.push('');
84
+ lines.push('| Name | Type | Required | Description |');
85
+ lines.push('|------|------|----------|-------------|');
86
+ for (const param of tool.parameters) {
87
+ const required = param.required ? 'Yes' : 'No';
88
+ const description = formatDescription(param);
89
+ lines.push(`| \`${param.name}\` | ${param.type} | ${required} | ${description} |`);
90
+ }
91
+ lines.push('');
92
+ }
93
+ else {
94
+ lines.push('*No parameters required*');
95
+ lines.push('');
96
+ }
97
+ if (includeExamples && tool.examples && tool.examples.length > 0) {
98
+ lines.push('**Examples:**');
99
+ lines.push('');
100
+ for (const example of tool.examples) {
101
+ lines.push(`*${example.name}*${example.description ? ` - ${example.description}` : ''}`);
102
+ lines.push('');
103
+ lines.push('```json');
104
+ lines.push(JSON.stringify(example.input, null, 2));
105
+ lines.push('```');
106
+ lines.push('');
107
+ }
108
+ }
109
+ return lines;
110
+ }
111
+ /**
112
+ * Format parameter description with enum and default
113
+ */
114
+ function formatDescription(param) {
115
+ let desc = param.description || '-';
116
+ if (param.enum && param.enum.length > 0) {
117
+ desc += ` (${param.enum.map(v => `\`${v}\``).join(', ')})`;
118
+ }
119
+ if (param.default !== undefined) {
120
+ desc += ` Default: \`${JSON.stringify(param.default)}\``;
121
+ }
122
+ return desc;
123
+ }
124
+ /**
125
+ * Format a content type as Markdown
126
+ */
127
+ function formatContentType(contentType) {
128
+ const lines = [];
129
+ lines.push(`### ${contentType.name}`);
130
+ lines.push('');
131
+ if (contentType.description) {
132
+ lines.push(contentType.description);
133
+ lines.push('');
134
+ }
135
+ lines.push(`**Slug:** \`${contentType.slug}\``);
136
+ lines.push('');
137
+ if (contentType.fields.length > 0) {
138
+ lines.push('**Fields:**');
139
+ lines.push('');
140
+ lines.push('| Name | Type | Required | Description |');
141
+ lines.push('|------|------|----------|-------------|');
142
+ for (const field of contentType.fields) {
143
+ const required = field.required ? 'Yes' : 'No';
144
+ const description = field.description || '-';
145
+ lines.push(`| \`${field.name}\` | ${field.type} | ${required} | ${description} |`);
146
+ }
147
+ lines.push('');
148
+ }
149
+ return lines;
150
+ }
151
+ /**
152
+ * Format endpoints as a table
153
+ */
154
+ function formatEndpointsTable(endpoints) {
155
+ const lines = [];
156
+ // Group by tags
157
+ const grouped = new Map();
158
+ for (const endpoint of endpoints) {
159
+ const tag = endpoint.tags?.[0] || 'General';
160
+ if (!grouped.has(tag)) {
161
+ grouped.set(tag, []);
162
+ }
163
+ grouped.get(tag).push(endpoint);
164
+ }
165
+ for (const [tag, tagEndpoints] of grouped) {
166
+ lines.push(`### ${tag}`);
167
+ lines.push('');
168
+ lines.push('| Method | Path | Summary |');
169
+ lines.push('|--------|------|---------|');
170
+ for (const endpoint of tagEndpoints) {
171
+ lines.push(`| \`${endpoint.method}\` | \`${endpoint.path}\` | ${endpoint.summary} |`);
172
+ }
173
+ lines.push('');
174
+ }
175
+ return lines;
176
+ }
177
+ /**
178
+ * Format tools only as Markdown
179
+ */
180
+ export function formatToolsAsMarkdown(tools, includeExamples = false) {
181
+ const lines = [];
182
+ lines.push('# MCP Tools');
183
+ lines.push('');
184
+ for (const tool of tools) {
185
+ lines.push(...formatTool(tool, includeExamples));
186
+ lines.push('');
187
+ }
188
+ return lines.join('\n');
189
+ }
190
+ /**
191
+ * Format content types only as Markdown
192
+ */
193
+ export function formatContentTypesAsMarkdown(contentTypes) {
194
+ const lines = [];
195
+ lines.push('# Content Types');
196
+ lines.push('');
197
+ for (const contentType of contentTypes) {
198
+ lines.push(...formatContentType(contentType));
199
+ lines.push('');
200
+ }
201
+ return lines.join('\n');
202
+ }
203
+ //# sourceMappingURL=markdown-formatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown-formatter.js","sourceRoot":"","sources":["../../src/formatters/markdown-formatter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAAsB,EACtB,UAGI,EAAE;IAEN,MAAM,EAAE,sBAAsB,GAAG,IAAI,EAAE,eAAe,GAAG,KAAK,EAAE,GAAG,OAAO,CAAC;IAC3E,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,QAAQ;IACR,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IACnC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAClC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,gBAAgB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;IAChD,KAAK,CAAC,IAAI,CAAC,kBAAkB,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;IACtD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEf,oBAAoB;IACpB,IAAI,sBAAsB,EAAE,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QACnC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC1B,KAAK,CAAC,IAAI,CAAC,2B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AAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,4BAA4B,CAC1C,YAAwC;IAExC,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAC9B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEf,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;QACvC,KAAK,CAAC,IAAI,CAAC,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAAC;QAC9C,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * OpenAPI Formatter
3
+ * Outputs API documentation as OpenAPI 3.0 specification
4
+ */
5
+ import type { ApiDocumentation } from '../types.js';
6
+ /**
7
+ * Format documentation as OpenAPI 3.0 specification
8
+ */
9
+ export declare function formatAsOpenApi(docs: ApiDocumentation, options?: {
10
+ baseUrl?: string;
11
+ serverDescription?: string;
12
+ outputFormat?: 'json' | 'yaml';
13
+ }): string;
14
+ //# sourceMappingURL=openapi-formatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openapi-formatter.d.ts","sourceRoot":"","sources":["../../src/formatters/openapi-formatter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAQjB,MAAM,aAAa,CAAC;AAErB;;GAEG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,gBAAgB,EACtB,OAAO,GAAE;IACP,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC3B,GACL,MAAM,CAcR"}