jszy-swagger-doc-generator 1.4.1 → 1.5.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.
@@ -0,0 +1,90 @@
1
+ import { SwaggerDoc } from '../types';
2
+ export declare class SwaggerDocGenerator {
3
+ /**
4
+ * Fetches the Swagger/OpenAPI JSON from a given URL
5
+ */
6
+ fetchSwaggerJSON(url: string): Promise<SwaggerDoc>;
7
+ /**
8
+ * Loads Swagger JSON from a local file
9
+ */
10
+ loadSwaggerFromFile(filePath: string): SwaggerDoc;
11
+ /**
12
+ * Generates frontend resources using Handlebars templates
13
+ */
14
+ generateHandlebarsResources(swaggerDoc: SwaggerDoc, templatePaths?: {
15
+ hooks?: string;
16
+ types?: string;
17
+ components?: string;
18
+ pages?: string;
19
+ }): Map<string, {
20
+ hooks: string;
21
+ types: string;
22
+ }>;
23
+ /**
24
+ * Checks if a schema is used in any of the endpoints
25
+ */
26
+ isSchemaUsedInEndpoints(schemaName: string, endpoints: Array<{
27
+ path: string;
28
+ method: string;
29
+ endpointInfo: any;
30
+ }>, allSchemas: {
31
+ [key: string]: any;
32
+ }): boolean;
33
+ /**
34
+ * Checks if a schema contains a reference to another schema
35
+ */
36
+ schemaContainsRef(schema: any, targetSchemaName: string, allSchemas: {
37
+ [key: string]: any;
38
+ }): boolean;
39
+ /**
40
+ * Find all referenced schemas from a set of directly used schemas
41
+ */
42
+ findAllReferencedSchemas(initialSchemas: Set<string>, allSchemas: {
43
+ [key: string]: any;
44
+ }): Set<string>;
45
+ /**
46
+ * Find schema references in a given schema
47
+ */
48
+ findSchemaReferences(schema: any, allSchemas: {
49
+ [key: string]: any;
50
+ }): Set<string>;
51
+ /**
52
+ * Generates a parameter interface for an API endpoint
53
+ */
54
+ generateParamInterface(path: string, method: string, endpointInfo: any, schemas: {
55
+ [key: string]: any;
56
+ }): string;
57
+ /**
58
+ * Generates a React Query hook using axios
59
+ */
60
+ generateReactQueryHook(path: string, method: string, endpointInfo: any, schemas: {
61
+ [key: string]: any;
62
+ }): string;
63
+ /**
64
+ * Generate operation ID from path and method if not provided
65
+ */
66
+ generateOperationId(path: string, method: string): string;
67
+ /**
68
+ * Formats code using Prettier - sync version with child process
69
+ */
70
+ private formatCode;
71
+ /**
72
+ * Gets the parser based on file extension
73
+ */
74
+ private getParserForFile;
75
+ /**
76
+ * Saves the generated documentation to a file
77
+ */
78
+ saveDocumentationToFile(documentation: string, outputPath: string): void;
79
+ /**
80
+ * Saves the generated TypeScript types to a file
81
+ */
82
+ saveTypesToFile(types: string, outputPath: string): void;
83
+ /**
84
+ * Saves the generated React hooks to files organized by tag
85
+ */
86
+ saveHooksByTag(hooksByTag: Map<string, {
87
+ hooks: string;
88
+ types: string;
89
+ }>, outputDir: string): void;
90
+ }