swaggular 1.0.1 → 1.0.3
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.
|
@@ -72,7 +72,7 @@ function generateServiceFiles(locations, templatesConfig) {
|
|
|
72
72
|
const templatePath = serviceTemplateConfig?.path || 'templates/angular-service.template';
|
|
73
73
|
const methods = service.methods
|
|
74
74
|
.map((method) => {
|
|
75
|
-
return buildMethodTemplate(method, serviceTemplateConfig?.
|
|
75
|
+
return buildMethodTemplate(method, serviceTemplateConfig?.httpParamsHandler);
|
|
76
76
|
})
|
|
77
77
|
.join('\n\n');
|
|
78
78
|
const allImports = Array.from(new Set([...service.imports])).sort();
|
|
@@ -86,11 +86,9 @@ function generateServiceFiles(locations, templatesConfig) {
|
|
|
86
86
|
? `import { ${allImports.join(', ')} } from '${'../'.repeat(location.length)}models';`
|
|
87
87
|
: '',
|
|
88
88
|
hasHttpParamsHandler: hasHttpParams,
|
|
89
|
-
httpParamsHandler: serviceTemplateConfig?.
|
|
90
|
-
httpParamsHandlerImport: hasHttpParams
|
|
91
|
-
|
|
92
|
-
: '',
|
|
93
|
-
extraAngularImports: hasHttpParams && !serviceTemplateConfig?.options?.httpParamsHandler ? ', HttpParams' : '',
|
|
89
|
+
httpParamsHandler: serviceTemplateConfig?.httpParamsHandler,
|
|
90
|
+
httpParamsHandlerImport: hasHttpParams ? serviceTemplateConfig?.httpParamsHandlerImport : '',
|
|
91
|
+
extraAngularImports: hasHttpParams && !serviceTemplateConfig?.httpParamsHandler ? ', HttpParams' : '',
|
|
94
92
|
};
|
|
95
93
|
const content = (0, template_renderer_1.renderServiceTemplate)(templatePath, templateParams);
|
|
96
94
|
filesContent.push({
|
package/dist/types/config.d.ts
CHANGED
|
@@ -1,18 +1,49 @@
|
|
|
1
|
-
import { ServiceTemplateParams } from './template';
|
|
2
1
|
import { InterfaceData } from './interface-data';
|
|
3
2
|
export interface SwaggularConfig {
|
|
4
3
|
types?: {
|
|
4
|
+
/**
|
|
5
|
+
* Optional extends from, if not specified, it will not add any extends from to any interface
|
|
6
|
+
*/
|
|
5
7
|
extendsFrom?: InterfaceData[];
|
|
8
|
+
/**
|
|
9
|
+
* Optional generic, if not specified, it will not add any generic interface
|
|
10
|
+
*/
|
|
6
11
|
generic?: InterfaceData[];
|
|
7
12
|
};
|
|
8
13
|
templates?: {
|
|
14
|
+
/**
|
|
15
|
+
* Optional service template configuration
|
|
16
|
+
*/
|
|
9
17
|
service?: {
|
|
18
|
+
/**
|
|
19
|
+
* Internal template path, e.g., 'templates/angular-service.template'
|
|
20
|
+
*/
|
|
10
21
|
path: string;
|
|
11
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Optional custom transformer, in case you have your own transformer function
|
|
24
|
+
*/
|
|
25
|
+
httpParamsHandler?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Optional custom transformer import, if you have your own transformer function,
|
|
28
|
+
* then specify where does it come from
|
|
29
|
+
*/
|
|
30
|
+
httpParamsHandlerImport?: string;
|
|
12
31
|
};
|
|
13
32
|
};
|
|
33
|
+
/**
|
|
34
|
+
* Optional input path, if not specified, it will use the default input path
|
|
35
|
+
*/
|
|
14
36
|
input?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Optional output path, if not specified, it will use the default output path
|
|
39
|
+
*/
|
|
15
40
|
output?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Optional grouping mode, if not specified, it will use the default grouping mode
|
|
43
|
+
*/
|
|
16
44
|
groupingMode?: 'tags' | 'path';
|
|
45
|
+
/**
|
|
46
|
+
* Optional segments to ignore, if not specified, it will use the default segments to ignore
|
|
47
|
+
*/
|
|
17
48
|
segmentsToIgnore?: string[];
|
|
18
49
|
}
|