@grafana/openapi-to-k6 0.3.0 → 0.3.1

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 (65) hide show
  1. package/dist/generator/index.js +13 -6
  2. package/dist/generator/k6Client.js +3 -1
  3. package/dist/helper.js +16 -0
  4. package/examples/basic_schema/schema.json +2 -1
  5. package/examples/basic_schema/single/simpleAPI.ts +4 -1
  6. package/examples/basic_schema/split/simpleAPI.schemas.ts +2 -1
  7. package/examples/basic_schema/split/simpleAPI.ts +3 -1
  8. package/examples/basic_schema/tags/default.ts +3 -1
  9. package/examples/basic_schema/tags/simpleAPI.schemas.ts +2 -1
  10. package/examples/form_data_schema/single/formDataAPI.ts +8 -6
  11. package/examples/form_data_schema/split/formDataAPI.schemas.ts +5 -5
  12. package/examples/form_data_schema/split/formDataAPI.ts +4 -2
  13. package/examples/form_data_schema/tags/default.ts +4 -2
  14. package/examples/form_data_schema/tags/formDataAPI.schemas.ts +5 -5
  15. package/examples/form_url_encoded_data_schema/single/formURLEncodedAPI.ts +8 -6
  16. package/examples/form_url_encoded_data_schema/split/formURLEncodedAPI.schemas.ts +5 -5
  17. package/examples/form_url_encoded_data_schema/split/formURLEncodedAPI.ts +4 -2
  18. package/examples/form_url_encoded_data_schema/tags/default.ts +4 -2
  19. package/examples/form_url_encoded_data_schema/tags/formURLEncodedAPI.schemas.ts +5 -5
  20. package/examples/form_url_encoded_data_with_query_params_schema/single/formURLEncodedAPIWithQueryParameters.ts +8 -6
  21. package/examples/form_url_encoded_data_with_query_params_schema/split/formURLEncodedAPIWithQueryParameters.schemas.ts +5 -5
  22. package/examples/form_url_encoded_data_with_query_params_schema/split/formURLEncodedAPIWithQueryParameters.ts +4 -2
  23. package/examples/form_url_encoded_data_with_query_params_schema/tags/default.ts +4 -2
  24. package/examples/form_url_encoded_data_with_query_params_schema/tags/formURLEncodedAPIWithQueryParameters.schemas.ts +5 -5
  25. package/examples/get_request_with_path_parameters_schema/single/simpleAPI.ts +4 -2
  26. package/examples/get_request_with_path_parameters_schema/split/simpleAPI.schemas.ts +2 -2
  27. package/examples/get_request_with_path_parameters_schema/split/simpleAPI.ts +3 -1
  28. package/examples/get_request_with_path_parameters_schema/tags/default.ts +3 -1
  29. package/examples/get_request_with_path_parameters_schema/tags/simpleAPI.schemas.ts +2 -2
  30. package/examples/headers_schema/single/headerDemoAPI.ts +5 -3
  31. package/examples/headers_schema/split/headerDemoAPI.schemas.ts +1 -1
  32. package/examples/headers_schema/split/headerDemoAPI.ts +5 -3
  33. package/examples/headers_schema/tags/default.ts +5 -3
  34. package/examples/headers_schema/tags/headerDemoAPI.schemas.ts +1 -1
  35. package/examples/no_title_schema/single/k6Client.ts +3 -1
  36. package/examples/no_title_schema/split/k6Client.schemas.ts +1 -1
  37. package/examples/no_title_schema/split/k6Client.ts +3 -1
  38. package/examples/no_title_schema/tags/default.ts +3 -1
  39. package/examples/no_title_schema/tags/k6Client.schemas.ts +1 -1
  40. package/examples/post_request_with_query_params/single/exampleAPI.ts +8 -6
  41. package/examples/post_request_with_query_params/split/exampleAPI.schemas.ts +5 -5
  42. package/examples/post_request_with_query_params/split/exampleAPI.ts +4 -2
  43. package/examples/post_request_with_query_params/tags/default.ts +4 -2
  44. package/examples/post_request_with_query_params/tags/exampleAPI.schemas.ts +5 -5
  45. package/examples/query_params_schema/single/exampleAPI.ts +5 -3
  46. package/examples/query_params_schema/split/exampleAPI.schemas.ts +3 -3
  47. package/examples/query_params_schema/split/exampleAPI.ts +3 -1
  48. package/examples/query_params_schema/tags/default.ts +3 -1
  49. package/examples/query_params_schema/tags/exampleAPI.schemas.ts +3 -3
  50. package/examples/simple_post_request_schema/single/exampleAPI.ts +14 -12
  51. package/examples/simple_post_request_schema/split/exampleAPI.schemas.ts +11 -11
  52. package/examples/simple_post_request_schema/split/exampleAPI.ts +4 -2
  53. package/examples/simple_post_request_schema/tags/default.ts +4 -2
  54. package/examples/simple_post_request_schema/tags/exampleAPI.schemas.ts +11 -11
  55. package/package.json +3 -2
  56. package/src/generator/index.ts +20 -7
  57. package/src/generator/k6Client.ts +3 -1
  58. package/src/helper.ts +17 -0
  59. package/tests/e2e/single/k6Script.ts +54 -1
  60. package/tests/functional-tests/test-generator/fixtures/basic_parameter_in_ref.json +59 -0
  61. package/tests/functional-tests/test-generator/fixtures/form_data_schema.json +1 -1
  62. package/tests/functional-tests/test-generator/fixtures/form_url_encoded_data_schema.json +1 -1
  63. package/tests/functional-tests/test-generator/fixtures/headers_schema.json +2 -2
  64. package/tests/functional-tests/test-generator/fixtures/simple_post_request_schema.json +1 -1
  65. package/{vite.config.js → vite.config.mjs} +4 -0
@@ -31,7 +31,7 @@ const generatedFileHeaderGenerator = (info) => {
31
31
  ...(info.version ? [`Service version: ${info.version}`] : []),
32
32
  ];
33
33
  };
34
- const afterAllFilesWriteHandler = (filePaths) => __awaiter(void 0, void 0, void 0, function* () {
34
+ const afterAllFilesWriteHandler = (filePaths, outputOverrider) => __awaiter(void 0, void 0, void 0, function* () {
35
35
  const removeSingleFile = (filePath) => {
36
36
  try {
37
37
  fs_1.default.unlinkSync(filePath);
@@ -54,7 +54,14 @@ const afterAllFilesWriteHandler = (filePaths) => __awaiter(void 0, void 0, void
54
54
  removeSingleFile(filePath);
55
55
  continue;
56
56
  }
57
- yield (0, helper_1.formatFileWithPrettier)(filePath);
57
+ try {
58
+ yield (0, helper_1.formatFileWithPrettier)(filePath);
59
+ }
60
+ catch (error) {
61
+ yield outputOverrider.temporarilyWriteToStdoutAndStderr(() => __awaiter(void 0, void 0, void 0, function* () {
62
+ logger_1.logger.error(`Error in formatting file ${filePath}: ${error}`);
63
+ }));
64
+ }
58
65
  const fileName = path_1.default.basename(filePath);
59
66
  if (fileName === '.ts') {
60
67
  // Generated SDK had no name because there was no title in the schema
@@ -102,7 +109,7 @@ exports.default = (_a) => __awaiter(void 0, [_a], void 0, function* ({ openApiPa
102
109
  },
103
110
  hooks: {
104
111
  afterAllFilesWrite: (filePaths) => __awaiter(void 0, void 0, void 0, function* () {
105
- const filteredFilePaths = yield afterAllFilesWriteHandler(filePaths);
112
+ const filteredFilePaths = yield afterAllFilesWriteHandler(filePaths, outputOverrider);
106
113
  generatedFilePaths.push(...filteredFilePaths);
107
114
  }),
108
115
  },
@@ -110,8 +117,8 @@ exports.default = (_a) => __awaiter(void 0, [_a], void 0, function* ({ openApiPa
110
117
  }));
111
118
  if (generatedFilePaths.length === 0) {
112
119
  const tagsMessage = (tags === null || tags === void 0 ? void 0 : tags.length) && tags.length > 0
113
- ? ` Applied tag filter(s): ${tags.join(', ')}`
114
- : '';
115
- throw new errors_1.NoFilesGeneratedError(`No files were generated.${tagsMessage}`);
120
+ ? ` Applied tag filter(s): ${tags.join(', ')}. `
121
+ : ' ';
122
+ throw new errors_1.NoFilesGeneratedError(`No files were generated.${tagsMessage}Try running with --verbose flag to get more details.`);
116
123
  }
117
124
  });
@@ -70,6 +70,7 @@ const _getRequestParamsValue = ({ response, queryParams, headers, body, }) => {
70
70
  // Expand the headers
71
71
  if (body.contentType || headers) {
72
72
  let headersValue = `\n headers: {`;
73
+ headersValue += '\n...mergedRequestParameters?.headers,';
73
74
  if (body.contentType) {
74
75
  if (body.formData) {
75
76
  headersValue += `\n'Content-Type': '${body.contentType}; boundary=' + formData.boundary,`;
@@ -82,7 +83,7 @@ const _getRequestParamsValue = ({ response, queryParams, headers, body, }) => {
82
83
  headersValue += `\n// In the schema, headers can be of any type like number but k6 accepts only strings as headers, hence converting all headers to string`;
83
84
  headersValue += `\n...Object.fromEntries(Object.entries(headers || {}).map(([key, value]) => [key, String(value)])),`;
84
85
  }
85
- headersValue += `\n...mergedRequestParameters?.headers},`;
86
+ headersValue += `\n},`;
86
87
  value += headersValue;
87
88
  }
88
89
  return `{${value}}`;
@@ -210,6 +211,7 @@ const generateK6Header = ({ title }) => {
210
211
  commonRequestParameters?: Params
211
212
  }) {
212
213
  this.cleanBaseUrl = clientOptions.baseUrl.replace(/\\/+$/, '');\n
214
+ this.commonRequestParameters = clientOptions.commonRequestParameters || {};
213
215
  }\n
214
216
  `;
215
217
  };
package/dist/helper.js CHANGED
@@ -123,6 +123,22 @@ class OutputOverrider {
123
123
  process.stdout.write = this.originalStdoutWrite;
124
124
  process.stderr.write = this.originalStderrWrite;
125
125
  }
126
+ // Method to temporarily write to stdout and stderr
127
+ temporarilyWriteToStdoutAndStderr(callback) {
128
+ return __awaiter(this, void 0, void 0, function* () {
129
+ const currentStdoutWrite = process.stdout.write;
130
+ const currentStderrWrite = process.stderr.write;
131
+ process.stdout.write = this.originalStdoutWrite;
132
+ process.stderr.write = this.originalStderrWrite;
133
+ try {
134
+ yield callback();
135
+ }
136
+ finally {
137
+ process.stdout.write = currentStdoutWrite;
138
+ process.stderr.write = currentStderrWrite;
139
+ }
140
+ });
141
+ }
126
142
  }
127
143
  exports.OutputOverrider = OutputOverrider;
128
144
  OutputOverrider.instance = null;
@@ -18,7 +18,8 @@
18
18
  "properties": {
19
19
  "message": {
20
20
  "type": "string",
21
- "example": "Hello, World!"
21
+ "example": "Hello, World!",
22
+ "pattern": "^([a-zA-Z_][a-zA-Z0-9_-]*:)?([a-zA-Z_][a-zA-Z0-9_-]*/)?([a-zA-Z_][.a-zA-Z0-9_-]*)$"
22
23
  }
23
24
  }
24
25
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.3.0
2
+ * Automatically generated by @grafana/openapi-to-k6: 0.3.1
3
3
  * Do not edit manually.
4
4
  * Simple API
5
5
  * Service version: 1.0.0
@@ -8,6 +8,7 @@ import { URL } from 'https://jslib.k6.io/url/1.0.0/index.js'
8
8
  import http from 'k6/http'
9
9
  import type { Params, Response } from 'k6/http'
10
10
  export type GetExample200 = {
11
+ /** @pattern ^([a-zA-Z_][a-zA-Z0-9_-]*:)?([a-zA-Z_][a-zA-Z0-9_-]*\/)?([a-zA-Z_][.a-zA-Z0-9_-]*)$ */
11
12
  message?: string
12
13
  }
13
14
 
@@ -23,6 +24,8 @@ export class SimpleAPIClient {
23
24
  commonRequestParameters?: Params
24
25
  }) {
25
26
  this.cleanBaseUrl = clientOptions.baseUrl.replace(/\/+$/, '')
27
+
28
+ this.commonRequestParameters = clientOptions.commonRequestParameters || {}
26
29
  }
27
30
 
28
31
  /**
@@ -1,9 +1,10 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.3.0
2
+ * Automatically generated by @grafana/openapi-to-k6: 0.3.1
3
3
  * Do not edit manually.
4
4
  * Simple API
5
5
  * Service version: 1.0.0
6
6
  */
7
7
  export type GetExample200 = {
8
+ /** @pattern ^([a-zA-Z_][a-zA-Z0-9_-]*:)?([a-zA-Z_][a-zA-Z0-9_-]*\/)?([a-zA-Z_][.a-zA-Z0-9_-]*)$ */
8
9
  message?: string
9
10
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.3.0
2
+ * Automatically generated by @grafana/openapi-to-k6: 0.3.1
3
3
  * Do not edit manually.
4
4
  * Simple API
5
5
  * Service version: 1.0.0
@@ -21,6 +21,8 @@ export class SimpleAPIClient {
21
21
  commonRequestParameters?: Params
22
22
  }) {
23
23
  this.cleanBaseUrl = clientOptions.baseUrl.replace(/\/+$/, '')
24
+
25
+ this.commonRequestParameters = clientOptions.commonRequestParameters || {}
24
26
  }
25
27
 
26
28
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.3.0
2
+ * Automatically generated by @grafana/openapi-to-k6: 0.3.1
3
3
  * Do not edit manually.
4
4
  * Simple API
5
5
  * Service version: 1.0.0
@@ -21,6 +21,8 @@ export class DefaultClient {
21
21
  commonRequestParameters?: Params
22
22
  }) {
23
23
  this.cleanBaseUrl = clientOptions.baseUrl.replace(/\/+$/, '')
24
+
25
+ this.commonRequestParameters = clientOptions.commonRequestParameters || {}
24
26
  }
25
27
 
26
28
  /**
@@ -1,9 +1,10 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.3.0
2
+ * Automatically generated by @grafana/openapi-to-k6: 0.3.1
3
3
  * Do not edit manually.
4
4
  * Simple API
5
5
  * Service version: 1.0.0
6
6
  */
7
7
  export type GetExample200 = {
8
+ /** @pattern ^([a-zA-Z_][a-zA-Z0-9_-]*:)?([a-zA-Z_][a-zA-Z0-9_-]*\/)?([a-zA-Z_][.a-zA-Z0-9_-]*)$ */
8
9
  message?: string
9
10
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.3.0
2
+ * Automatically generated by @grafana/openapi-to-k6: 0.3.1
3
3
  * Do not edit manually.
4
4
  * Form Data API
5
5
  * Service version: 1.0.0
@@ -9,20 +9,20 @@ import { URL } from 'https://jslib.k6.io/url/1.0.0/index.js'
9
9
  import http from 'k6/http'
10
10
  import type { Params, Response } from 'k6/http'
11
11
  export type PostUpload400 = {
12
- error?: string
13
12
  success?: boolean
13
+ error?: string
14
14
  }
15
15
 
16
16
  export type PostUpload200 = {
17
- message?: string
18
17
  success?: boolean
18
+ message?: string
19
19
  }
20
20
 
21
21
  export type PostUploadBody = {
22
- /** Description of the file */
23
- description?: string
24
22
  /** File to upload */
25
23
  file: Blob
24
+ /** Description of the file */
25
+ description?: string
26
26
  /** User ID associated with the upload */
27
27
  userId: string
28
28
  }
@@ -39,6 +39,8 @@ export class FormDataAPIClient {
39
39
  commonRequestParameters?: Params
40
40
  }) {
41
41
  this.cleanBaseUrl = clientOptions.baseUrl.replace(/\/+$/, '')
42
+
43
+ this.commonRequestParameters = clientOptions.commonRequestParameters || {}
42
44
  }
43
45
 
44
46
  /**
@@ -67,8 +69,8 @@ export class FormDataAPIClient {
67
69
  const response = http.request('POST', url.toString(), formData.body(), {
68
70
  ...mergedRequestParameters,
69
71
  headers: {
70
- 'Content-Type': 'multipart/form-data; boundary=' + formData.boundary,
71
72
  ...mergedRequestParameters?.headers,
73
+ 'Content-Type': 'multipart/form-data; boundary=' + formData.boundary,
72
74
  },
73
75
  })
74
76
  let data
@@ -1,24 +1,24 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.3.0
2
+ * Automatically generated by @grafana/openapi-to-k6: 0.3.1
3
3
  * Do not edit manually.
4
4
  * Form Data API
5
5
  * Service version: 1.0.0
6
6
  */
7
7
  export type PostUpload400 = {
8
- error?: string
9
8
  success?: boolean
9
+ error?: string
10
10
  }
11
11
 
12
12
  export type PostUpload200 = {
13
- message?: string
14
13
  success?: boolean
14
+ message?: string
15
15
  }
16
16
 
17
17
  export type PostUploadBody = {
18
- /** Description of the file */
19
- description?: string
20
18
  /** File to upload */
21
19
  file: Blob
20
+ /** Description of the file */
21
+ description?: string
22
22
  /** User ID associated with the upload */
23
23
  userId: string
24
24
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.3.0
2
+ * Automatically generated by @grafana/openapi-to-k6: 0.3.1
3
3
  * Do not edit manually.
4
4
  * Form Data API
5
5
  * Service version: 1.0.0
@@ -22,6 +22,8 @@ export class FormDataAPIClient {
22
22
  commonRequestParameters?: Params
23
23
  }) {
24
24
  this.cleanBaseUrl = clientOptions.baseUrl.replace(/\/+$/, '')
25
+
26
+ this.commonRequestParameters = clientOptions.commonRequestParameters || {}
25
27
  }
26
28
 
27
29
  /**
@@ -50,8 +52,8 @@ export class FormDataAPIClient {
50
52
  const response = http.request('POST', url.toString(), formData.body(), {
51
53
  ...mergedRequestParameters,
52
54
  headers: {
53
- 'Content-Type': 'multipart/form-data; boundary=' + formData.boundary,
54
55
  ...mergedRequestParameters?.headers,
56
+ 'Content-Type': 'multipart/form-data; boundary=' + formData.boundary,
55
57
  },
56
58
  })
57
59
  let data
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.3.0
2
+ * Automatically generated by @grafana/openapi-to-k6: 0.3.1
3
3
  * Do not edit manually.
4
4
  * Form Data API
5
5
  * Service version: 1.0.0
@@ -22,6 +22,8 @@ export class DefaultClient {
22
22
  commonRequestParameters?: Params
23
23
  }) {
24
24
  this.cleanBaseUrl = clientOptions.baseUrl.replace(/\/+$/, '')
25
+
26
+ this.commonRequestParameters = clientOptions.commonRequestParameters || {}
25
27
  }
26
28
 
27
29
  /**
@@ -50,8 +52,8 @@ export class DefaultClient {
50
52
  const response = http.request('POST', url.toString(), formData.body(), {
51
53
  ...mergedRequestParameters,
52
54
  headers: {
53
- 'Content-Type': 'multipart/form-data; boundary=' + formData.boundary,
54
55
  ...mergedRequestParameters?.headers,
56
+ 'Content-Type': 'multipart/form-data; boundary=' + formData.boundary,
55
57
  },
56
58
  })
57
59
  let data
@@ -1,24 +1,24 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.3.0
2
+ * Automatically generated by @grafana/openapi-to-k6: 0.3.1
3
3
  * Do not edit manually.
4
4
  * Form Data API
5
5
  * Service version: 1.0.0
6
6
  */
7
7
  export type PostUpload400 = {
8
- error?: string
9
8
  success?: boolean
9
+ error?: string
10
10
  }
11
11
 
12
12
  export type PostUpload200 = {
13
- message?: string
14
13
  success?: boolean
14
+ message?: string
15
15
  }
16
16
 
17
17
  export type PostUploadBody = {
18
- /** Description of the file */
19
- description?: string
20
18
  /** File to upload */
21
19
  file: Blob
20
+ /** Description of the file */
21
+ description?: string
22
22
  /** User ID associated with the upload */
23
23
  userId: string
24
24
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.3.0
2
+ * Automatically generated by @grafana/openapi-to-k6: 0.3.1
3
3
  * Do not edit manually.
4
4
  * Form URL Encoded API
5
5
  * Service version: 1.0.0
@@ -8,22 +8,22 @@ import { URL } from 'https://jslib.k6.io/url/1.0.0/index.js'
8
8
  import http from 'k6/http'
9
9
  import type { Params, Response } from 'k6/http'
10
10
  export type PostSubmitForm400 = {
11
- error?: string
12
11
  success?: boolean
12
+ error?: string
13
13
  }
14
14
 
15
15
  export type PostSubmitForm200 = {
16
- message?: string
17
16
  success?: boolean
17
+ message?: string
18
18
  }
19
19
 
20
20
  export type PostSubmitFormBody = {
21
+ /** Name of the user */
22
+ name: string
21
23
  /** Age of the user */
22
24
  age?: number
23
25
  /** Email address of the user */
24
26
  email: string
25
- /** Name of the user */
26
- name: string
27
27
  }
28
28
 
29
29
  /**
@@ -38,6 +38,8 @@ export class FormURLEncodedAPIClient {
38
38
  commonRequestParameters?: Params
39
39
  }) {
40
40
  this.cleanBaseUrl = clientOptions.baseUrl.replace(/\/+$/, '')
41
+
42
+ this.commonRequestParameters = clientOptions.commonRequestParameters || {}
41
43
  }
42
44
 
43
45
  /**
@@ -63,8 +65,8 @@ export class FormURLEncodedAPIClient {
63
65
  {
64
66
  ...mergedRequestParameters,
65
67
  headers: {
66
- 'Content-Type': 'application/x-www-form-urlencoded',
67
68
  ...mergedRequestParameters?.headers,
69
+ 'Content-Type': 'application/x-www-form-urlencoded',
68
70
  },
69
71
  }
70
72
  )
@@ -1,24 +1,24 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.3.0
2
+ * Automatically generated by @grafana/openapi-to-k6: 0.3.1
3
3
  * Do not edit manually.
4
4
  * Form URL Encoded API
5
5
  * Service version: 1.0.0
6
6
  */
7
7
  export type PostSubmitForm400 = {
8
- error?: string
9
8
  success?: boolean
9
+ error?: string
10
10
  }
11
11
 
12
12
  export type PostSubmitForm200 = {
13
- message?: string
14
13
  success?: boolean
14
+ message?: string
15
15
  }
16
16
 
17
17
  export type PostSubmitFormBody = {
18
+ /** Name of the user */
19
+ name: string
18
20
  /** Age of the user */
19
21
  age?: number
20
22
  /** Email address of the user */
21
23
  email: string
22
- /** Name of the user */
23
- name: string
24
24
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.3.0
2
+ * Automatically generated by @grafana/openapi-to-k6: 0.3.1
3
3
  * Do not edit manually.
4
4
  * Form URL Encoded API
5
5
  * Service version: 1.0.0
@@ -24,6 +24,8 @@ export class FormURLEncodedAPIClient {
24
24
  commonRequestParameters?: Params
25
25
  }) {
26
26
  this.cleanBaseUrl = clientOptions.baseUrl.replace(/\/+$/, '')
27
+
28
+ this.commonRequestParameters = clientOptions.commonRequestParameters || {}
27
29
  }
28
30
 
29
31
  /**
@@ -49,8 +51,8 @@ export class FormURLEncodedAPIClient {
49
51
  {
50
52
  ...mergedRequestParameters,
51
53
  headers: {
52
- 'Content-Type': 'application/x-www-form-urlencoded',
53
54
  ...mergedRequestParameters?.headers,
55
+ 'Content-Type': 'application/x-www-form-urlencoded',
54
56
  },
55
57
  }
56
58
  )
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.3.0
2
+ * Automatically generated by @grafana/openapi-to-k6: 0.3.1
3
3
  * Do not edit manually.
4
4
  * Form URL Encoded API
5
5
  * Service version: 1.0.0
@@ -24,6 +24,8 @@ export class DefaultClient {
24
24
  commonRequestParameters?: Params
25
25
  }) {
26
26
  this.cleanBaseUrl = clientOptions.baseUrl.replace(/\/+$/, '')
27
+
28
+ this.commonRequestParameters = clientOptions.commonRequestParameters || {}
27
29
  }
28
30
 
29
31
  /**
@@ -49,8 +51,8 @@ export class DefaultClient {
49
51
  {
50
52
  ...mergedRequestParameters,
51
53
  headers: {
52
- 'Content-Type': 'application/x-www-form-urlencoded',
53
54
  ...mergedRequestParameters?.headers,
55
+ 'Content-Type': 'application/x-www-form-urlencoded',
54
56
  },
55
57
  }
56
58
  )
@@ -1,24 +1,24 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.3.0
2
+ * Automatically generated by @grafana/openapi-to-k6: 0.3.1
3
3
  * Do not edit manually.
4
4
  * Form URL Encoded API
5
5
  * Service version: 1.0.0
6
6
  */
7
7
  export type PostSubmitForm400 = {
8
- error?: string
9
8
  success?: boolean
9
+ error?: string
10
10
  }
11
11
 
12
12
  export type PostSubmitForm200 = {
13
- message?: string
14
13
  success?: boolean
14
+ message?: string
15
15
  }
16
16
 
17
17
  export type PostSubmitFormBody = {
18
+ /** Name of the user */
19
+ name: string
18
20
  /** Age of the user */
19
21
  age?: number
20
22
  /** Email address of the user */
21
23
  email: string
22
- /** Name of the user */
23
- name: string
24
24
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.3.0
2
+ * Automatically generated by @grafana/openapi-to-k6: 0.3.1
3
3
  * Do not edit manually.
4
4
  * Form URL Encoded API with Query Parameters
5
5
  * Service version: 1.0.0
@@ -8,22 +8,22 @@ import { URL, URLSearchParams } from 'https://jslib.k6.io/url/1.0.0/index.js'
8
8
  import http from 'k6/http'
9
9
  import type { Params, Response } from 'k6/http'
10
10
  export type PostSubmitForm400 = {
11
- error?: string
12
11
  success?: boolean
12
+ error?: string
13
13
  }
14
14
 
15
15
  export type PostSubmitForm200 = {
16
- message?: string
17
16
  success?: boolean
17
+ message?: string
18
18
  }
19
19
 
20
20
  export type PostSubmitFormBody = {
21
+ /** Name of the user */
22
+ name: string
21
23
  /** Age of the user */
22
24
  age?: number
23
25
  /** Email address of the user */
24
26
  email: string
25
- /** Name of the user */
26
- name: string
27
27
  }
28
28
 
29
29
  export type PostSubmitFormParams = {
@@ -49,6 +49,8 @@ export class FormURLEncodedAPIWithQueryParametersClient {
49
49
  commonRequestParameters?: Params
50
50
  }) {
51
51
  this.cleanBaseUrl = clientOptions.baseUrl.replace(/\/+$/, '')
52
+
53
+ this.commonRequestParameters = clientOptions.commonRequestParameters || {}
52
54
  }
53
55
 
54
56
  /**
@@ -79,8 +81,8 @@ export class FormURLEncodedAPIWithQueryParametersClient {
79
81
  {
80
82
  ...mergedRequestParameters,
81
83
  headers: {
82
- 'Content-Type': 'application/x-www-form-urlencoded',
83
84
  ...mergedRequestParameters?.headers,
85
+ 'Content-Type': 'application/x-www-form-urlencoded',
84
86
  },
85
87
  }
86
88
  )
@@ -1,26 +1,26 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.3.0
2
+ * Automatically generated by @grafana/openapi-to-k6: 0.3.1
3
3
  * Do not edit manually.
4
4
  * Form URL Encoded API with Query Parameters
5
5
  * Service version: 1.0.0
6
6
  */
7
7
  export type PostSubmitForm400 = {
8
- error?: string
9
8
  success?: boolean
9
+ error?: string
10
10
  }
11
11
 
12
12
  export type PostSubmitForm200 = {
13
- message?: string
14
13
  success?: boolean
14
+ message?: string
15
15
  }
16
16
 
17
17
  export type PostSubmitFormBody = {
18
+ /** Name of the user */
19
+ name: string
18
20
  /** Age of the user */
19
21
  age?: number
20
22
  /** Email address of the user */
21
23
  email: string
22
- /** Name of the user */
23
- name: string
24
24
  }
25
25
 
26
26
  export type PostSubmitFormParams = {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.3.0
2
+ * Automatically generated by @grafana/openapi-to-k6: 0.3.1
3
3
  * Do not edit manually.
4
4
  * Form URL Encoded API with Query Parameters
5
5
  * Service version: 1.0.0
@@ -25,6 +25,8 @@ export class FormURLEncodedAPIWithQueryParametersClient {
25
25
  commonRequestParameters?: Params
26
26
  }) {
27
27
  this.cleanBaseUrl = clientOptions.baseUrl.replace(/\/+$/, '')
28
+
29
+ this.commonRequestParameters = clientOptions.commonRequestParameters || {}
28
30
  }
29
31
 
30
32
  /**
@@ -55,8 +57,8 @@ export class FormURLEncodedAPIWithQueryParametersClient {
55
57
  {
56
58
  ...mergedRequestParameters,
57
59
  headers: {
58
- 'Content-Type': 'application/x-www-form-urlencoded',
59
60
  ...mergedRequestParameters?.headers,
61
+ 'Content-Type': 'application/x-www-form-urlencoded',
60
62
  },
61
63
  }
62
64
  )
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.3.0
2
+ * Automatically generated by @grafana/openapi-to-k6: 0.3.1
3
3
  * Do not edit manually.
4
4
  * Form URL Encoded API with Query Parameters
5
5
  * Service version: 1.0.0
@@ -25,6 +25,8 @@ export class DefaultClient {
25
25
  commonRequestParameters?: Params
26
26
  }) {
27
27
  this.cleanBaseUrl = clientOptions.baseUrl.replace(/\/+$/, '')
28
+
29
+ this.commonRequestParameters = clientOptions.commonRequestParameters || {}
28
30
  }
29
31
 
30
32
  /**
@@ -55,8 +57,8 @@ export class DefaultClient {
55
57
  {
56
58
  ...mergedRequestParameters,
57
59
  headers: {
58
- 'Content-Type': 'application/x-www-form-urlencoded',
59
60
  ...mergedRequestParameters?.headers,
61
+ 'Content-Type': 'application/x-www-form-urlencoded',
60
62
  },
61
63
  }
62
64
  )