@penkov/swagger-code-gen 1.0.5 → 1.0.6
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/templates/index.ejs
CHANGED
|
@@ -12,6 +12,14 @@
|
|
|
12
12
|
*********************************************************/
|
|
13
13
|
import fetch from 'node-fetch';
|
|
14
14
|
|
|
15
|
+
export interface SwaggerCodeGenParams {
|
|
16
|
+
apiPrefix: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const swaggerCodeGenParams: SwaggerCodeGenParams = {
|
|
20
|
+
apiPrefix: ''
|
|
21
|
+
};
|
|
22
|
+
|
|
15
23
|
<% schemas.foreach(schema => { %>
|
|
16
24
|
<%- include('schema.ejs', {schema: schema}); %>
|
|
17
25
|
<% }); %>
|
|
@@ -53,7 +53,7 @@ export async function <%= method.endpointName %>(
|
|
|
53
53
|
query = '?' + queryParams.join('&');
|
|
54
54
|
}
|
|
55
55
|
<%_ } -%>
|
|
56
|
-
const resp = await fetch(
|
|
56
|
+
const resp = await fetch(`${swaggerCodeGenParams.apiPrefix}<%- method.pathWithSubstitutions %>${query}`, {
|
|
57
57
|
method: '<%= method.method %>',
|
|
58
58
|
body: <%= method.body.map(() => 'JSON.stringify(body)').getOrElseValue('undefined') %>,
|
|
59
59
|
headers: {
|