@grafana/openapi-to-k6 0.3.1 → 0.4.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 (67) hide show
  1. package/.github/workflows/publish.yaml +39 -13
  2. package/.github/workflows/tests.yaml +23 -10
  3. package/.nvmrc +1 -1
  4. package/CODEOWNERS +2 -0
  5. package/README.md +34 -39
  6. package/catalog-info.yaml +13 -0
  7. package/dist/generator/k6Client.js +7 -4
  8. package/examples/basic_schema/single/simpleAPI.ts +5 -3
  9. package/examples/basic_schema/split/simpleAPI.schemas.ts +1 -1
  10. package/examples/basic_schema/split/simpleAPI.ts +5 -3
  11. package/examples/basic_schema/tags/default.ts +5 -3
  12. package/examples/basic_schema/tags/simpleAPI.schemas.ts +1 -1
  13. package/examples/form_data_schema/single/formDataAPI.ts +15 -13
  14. package/examples/form_data_schema/split/formDataAPI.schemas.ts +11 -11
  15. package/examples/form_data_schema/split/formDataAPI.ts +5 -3
  16. package/examples/form_data_schema/tags/default.ts +5 -3
  17. package/examples/form_data_schema/tags/formDataAPI.schemas.ts +11 -11
  18. package/examples/form_url_encoded_data_schema/single/formURLEncodedAPI.ts +15 -13
  19. package/examples/form_url_encoded_data_schema/split/formURLEncodedAPI.schemas.ts +11 -11
  20. package/examples/form_url_encoded_data_schema/split/formURLEncodedAPI.ts +5 -3
  21. package/examples/form_url_encoded_data_schema/tags/default.ts +5 -3
  22. package/examples/form_url_encoded_data_schema/tags/formURLEncodedAPI.schemas.ts +11 -11
  23. package/examples/form_url_encoded_data_with_query_params_schema/single/formURLEncodedAPIWithQueryParameters.ts +22 -20
  24. package/examples/form_url_encoded_data_with_query_params_schema/split/formURLEncodedAPIWithQueryParameters.schemas.ts +18 -18
  25. package/examples/form_url_encoded_data_with_query_params_schema/split/formURLEncodedAPIWithQueryParameters.ts +5 -3
  26. package/examples/form_url_encoded_data_with_query_params_schema/tags/default.ts +5 -3
  27. package/examples/form_url_encoded_data_with_query_params_schema/tags/formURLEncodedAPIWithQueryParameters.schemas.ts +18 -18
  28. package/examples/get_request_with_path_parameters_schema/single/simpleAPI.ts +5 -3
  29. package/examples/get_request_with_path_parameters_schema/split/simpleAPI.schemas.ts +1 -1
  30. package/examples/get_request_with_path_parameters_schema/split/simpleAPI.ts +5 -3
  31. package/examples/get_request_with_path_parameters_schema/tags/default.ts +5 -3
  32. package/examples/get_request_with_path_parameters_schema/tags/simpleAPI.schemas.ts +1 -1
  33. package/examples/headers_schema/single/headerDemoAPI.ts +24 -18
  34. package/examples/headers_schema/split/headerDemoAPI.schemas.ts +12 -12
  35. package/examples/headers_schema/split/headerDemoAPI.ts +13 -7
  36. package/examples/headers_schema/tags/default.ts +13 -7
  37. package/examples/headers_schema/tags/headerDemoAPI.schemas.ts +12 -12
  38. package/examples/no_title_schema/single/k6Client.ts +5 -3
  39. package/examples/no_title_schema/split/k6Client.schemas.ts +1 -1
  40. package/examples/no_title_schema/split/k6Client.ts +5 -3
  41. package/examples/no_title_schema/tags/default.ts +5 -3
  42. package/examples/no_title_schema/tags/k6Client.schemas.ts +1 -1
  43. package/examples/post_request_with_query_params/single/exampleAPI.ts +21 -19
  44. package/examples/post_request_with_query_params/split/exampleAPI.schemas.ts +17 -17
  45. package/examples/post_request_with_query_params/split/exampleAPI.ts +5 -3
  46. package/examples/post_request_with_query_params/tags/default.ts +5 -3
  47. package/examples/post_request_with_query_params/tags/exampleAPI.schemas.ts +17 -17
  48. package/examples/query_params_schema/single/exampleAPI.ts +13 -11
  49. package/examples/query_params_schema/split/exampleAPI.schemas.ts +9 -9
  50. package/examples/query_params_schema/split/exampleAPI.ts +5 -3
  51. package/examples/query_params_schema/tags/default.ts +5 -3
  52. package/examples/query_params_schema/tags/exampleAPI.schemas.ts +9 -9
  53. package/examples/simple_post_request_schema/single/exampleAPI.ts +21 -19
  54. package/examples/simple_post_request_schema/split/exampleAPI.schemas.ts +17 -17
  55. package/examples/simple_post_request_schema/split/exampleAPI.ts +5 -3
  56. package/examples/simple_post_request_schema/tags/default.ts +5 -3
  57. package/examples/simple_post_request_schema/tags/exampleAPI.schemas.ts +17 -17
  58. package/package.json +20 -20
  59. package/renovate.json +6 -0
  60. package/src/generator/k6Client.ts +9 -3
  61. package/tests/functional-tests/test-generator/fixtures/form_data_schema.json +2 -2
  62. package/tests/functional-tests/test-generator/fixtures/form_url_encoded_data_schema.json +2 -2
  63. package/tests/functional-tests/test-generator/fixtures/form_url_encoded_data_with_query_params_schema.json +1 -1
  64. package/tests/functional-tests/test-generator/fixtures/get_request_with_path_parameters_schema.json +1 -1
  65. package/tests/functional-tests/test-generator/fixtures/headers_schema.json +6 -6
  66. package/tests/functional-tests/test-generator/fixtures/simple_post_request_schema.json +1 -1
  67. package/tests/functional-tests/test-generator/generator.test.ts +9 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.3.1
2
+ * Automatically generated by @grafana/openapi-to-k6: 0.4.1
3
3
  * Do not edit manually.
4
4
  * Header Demo API
5
5
  * An API demonstrating the use of headers in different ways
@@ -8,12 +8,15 @@
8
8
  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
- export type GetExampleResponseHeaders200 = {
12
- status?: string
11
+ export type GetExampleGetHeaders = {
12
+ /**
13
+ * A custom header for this request
14
+ */
15
+ 'X-Custom-Header'?: string
13
16
  }
14
17
 
15
- export type PostExamplePostBody = {
16
- data?: string
18
+ export type GetExampleGet200 = {
19
+ message?: string
17
20
  }
18
21
 
19
22
  export type PostExamplePostHeaders = {
@@ -23,15 +26,12 @@ export type PostExamplePostHeaders = {
23
26
  Authorization: string
24
27
  }
25
28
 
26
- export type GetExampleGet200 = {
27
- message?: string
29
+ export type PostExamplePostBody = {
30
+ data?: string
28
31
  }
29
32
 
30
- export type GetExampleGetHeaders = {
31
- /**
32
- * A custom header for this request
33
- */
34
- 'X-Custom-Header'?: string
33
+ export type GetExampleResponseHeaders200 = {
34
+ status?: string
35
35
  }
36
36
 
37
37
  /**
@@ -60,13 +60,14 @@ export class HeaderDemoAPIClient {
60
60
  ): {
61
61
  response: Response
62
62
  data: GetExampleGet200
63
+ operationId: string
63
64
  } {
64
- const url = new URL(this.cleanBaseUrl + `/example-get`)
65
+ const k6url = new URL(this.cleanBaseUrl + `/example-get`)
65
66
  const mergedRequestParameters = this._mergeRequestParameters(
66
67
  requestParameters || {},
67
68
  this.commonRequestParameters
68
69
  )
69
- const response = http.request('GET', url.toString(), undefined, {
70
+ const response = http.request('GET', k6url.toString(), undefined, {
70
71
  ...mergedRequestParameters,
71
72
  headers: {
72
73
  ...mergedRequestParameters?.headers,
@@ -89,6 +90,7 @@ export class HeaderDemoAPIClient {
89
90
  return {
90
91
  response,
91
92
  data,
93
+ operationId: 'GetExampleGet',
92
94
  }
93
95
  }
94
96
 
@@ -103,15 +105,16 @@ export class HeaderDemoAPIClient {
103
105
  ): {
104
106
  response: Response
105
107
  data: void
108
+ operationId: string
106
109
  } {
107
- const url = new URL(this.cleanBaseUrl + `/example-post`)
110
+ const k6url = new URL(this.cleanBaseUrl + `/example-post`)
108
111
  const mergedRequestParameters = this._mergeRequestParameters(
109
112
  requestParameters || {},
110
113
  this.commonRequestParameters
111
114
  )
112
115
  const response = http.request(
113
116
  'POST',
114
- url.toString(),
117
+ k6url.toString(),
115
118
  JSON.stringify(postExamplePostBody),
116
119
  {
117
120
  ...mergedRequestParameters,
@@ -138,6 +141,7 @@ export class HeaderDemoAPIClient {
138
141
  return {
139
142
  response,
140
143
  data,
144
+ operationId: 'PostExamplePost',
141
145
  }
142
146
  }
143
147
 
@@ -148,15 +152,16 @@ export class HeaderDemoAPIClient {
148
152
  getExampleResponseHeaders(requestParameters?: Params): {
149
153
  response: Response
150
154
  data: GetExampleResponseHeaders200
155
+ operationId: string
151
156
  } {
152
- const url = new URL(this.cleanBaseUrl + `/example-response-headers`)
157
+ const k6url = new URL(this.cleanBaseUrl + `/example-response-headers`)
153
158
  const mergedRequestParameters = this._mergeRequestParameters(
154
159
  requestParameters || {},
155
160
  this.commonRequestParameters
156
161
  )
157
162
  const response = http.request(
158
163
  'GET',
159
- url.toString(),
164
+ k6url.toString(),
160
165
  undefined,
161
166
  mergedRequestParameters
162
167
  )
@@ -170,6 +175,7 @@ export class HeaderDemoAPIClient {
170
175
  return {
171
176
  response,
172
177
  data,
178
+ operationId: 'GetExampleResponseHeaders',
173
179
  }
174
180
  }
175
181
 
@@ -1,16 +1,19 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.3.1
2
+ * Automatically generated by @grafana/openapi-to-k6: 0.4.1
3
3
  * Do not edit manually.
4
4
  * Header Demo API
5
5
  * An API demonstrating the use of headers in different ways
6
6
  * Service version: 1.0.0
7
7
  */
8
- export type GetExampleResponseHeaders200 = {
9
- status?: string
8
+ export type GetExampleGetHeaders = {
9
+ /**
10
+ * A custom header for this request
11
+ */
12
+ 'X-Custom-Header'?: string
10
13
  }
11
14
 
12
- export type PostExamplePostBody = {
13
- data?: string
15
+ export type GetExampleGet200 = {
16
+ message?: string
14
17
  }
15
18
 
16
19
  export type PostExamplePostHeaders = {
@@ -20,13 +23,10 @@ export type PostExamplePostHeaders = {
20
23
  Authorization: string
21
24
  }
22
25
 
23
- export type GetExampleGet200 = {
24
- message?: string
26
+ export type PostExamplePostBody = {
27
+ data?: string
25
28
  }
26
29
 
27
- export type GetExampleGetHeaders = {
28
- /**
29
- * A custom header for this request
30
- */
31
- 'X-Custom-Header'?: string
30
+ export type GetExampleResponseHeaders200 = {
31
+ status?: string
32
32
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.3.1
2
+ * Automatically generated by @grafana/openapi-to-k6: 0.4.1
3
3
  * Do not edit manually.
4
4
  * Header Demo API
5
5
  * An API demonstrating the use of headers in different ways
@@ -42,13 +42,14 @@ export class HeaderDemoAPIClient {
42
42
  ): {
43
43
  response: Response
44
44
  data: GetExampleGet200
45
+ operationId: string
45
46
  } {
46
- const url = new URL(this.cleanBaseUrl + `/example-get`)
47
+ const k6url = new URL(this.cleanBaseUrl + `/example-get`)
47
48
  const mergedRequestParameters = this._mergeRequestParameters(
48
49
  requestParameters || {},
49
50
  this.commonRequestParameters
50
51
  )
51
- const response = http.request('GET', url.toString(), undefined, {
52
+ const response = http.request('GET', k6url.toString(), undefined, {
52
53
  ...mergedRequestParameters,
53
54
  headers: {
54
55
  ...mergedRequestParameters?.headers,
@@ -71,6 +72,7 @@ export class HeaderDemoAPIClient {
71
72
  return {
72
73
  response,
73
74
  data,
75
+ operationId: 'GetExampleGet',
74
76
  }
75
77
  }
76
78
 
@@ -85,15 +87,16 @@ export class HeaderDemoAPIClient {
85
87
  ): {
86
88
  response: Response
87
89
  data: void
90
+ operationId: string
88
91
  } {
89
- const url = new URL(this.cleanBaseUrl + `/example-post`)
92
+ const k6url = new URL(this.cleanBaseUrl + `/example-post`)
90
93
  const mergedRequestParameters = this._mergeRequestParameters(
91
94
  requestParameters || {},
92
95
  this.commonRequestParameters
93
96
  )
94
97
  const response = http.request(
95
98
  'POST',
96
- url.toString(),
99
+ k6url.toString(),
97
100
  JSON.stringify(postExamplePostBody),
98
101
  {
99
102
  ...mergedRequestParameters,
@@ -120,6 +123,7 @@ export class HeaderDemoAPIClient {
120
123
  return {
121
124
  response,
122
125
  data,
126
+ operationId: 'PostExamplePost',
123
127
  }
124
128
  }
125
129
 
@@ -130,15 +134,16 @@ export class HeaderDemoAPIClient {
130
134
  getExampleResponseHeaders(requestParameters?: Params): {
131
135
  response: Response
132
136
  data: GetExampleResponseHeaders200
137
+ operationId: string
133
138
  } {
134
- const url = new URL(this.cleanBaseUrl + `/example-response-headers`)
139
+ const k6url = new URL(this.cleanBaseUrl + `/example-response-headers`)
135
140
  const mergedRequestParameters = this._mergeRequestParameters(
136
141
  requestParameters || {},
137
142
  this.commonRequestParameters
138
143
  )
139
144
  const response = http.request(
140
145
  'GET',
141
- url.toString(),
146
+ k6url.toString(),
142
147
  undefined,
143
148
  mergedRequestParameters
144
149
  )
@@ -152,6 +157,7 @@ export class HeaderDemoAPIClient {
152
157
  return {
153
158
  response,
154
159
  data,
160
+ operationId: 'GetExampleResponseHeaders',
155
161
  }
156
162
  }
157
163
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.3.1
2
+ * Automatically generated by @grafana/openapi-to-k6: 0.4.1
3
3
  * Do not edit manually.
4
4
  * Header Demo API
5
5
  * An API demonstrating the use of headers in different ways
@@ -42,13 +42,14 @@ export class DefaultClient {
42
42
  ): {
43
43
  response: Response
44
44
  data: GetExampleGet200
45
+ operationId: string
45
46
  } {
46
- const url = new URL(this.cleanBaseUrl + `/example-get`)
47
+ const k6url = new URL(this.cleanBaseUrl + `/example-get`)
47
48
  const mergedRequestParameters = this._mergeRequestParameters(
48
49
  requestParameters || {},
49
50
  this.commonRequestParameters
50
51
  )
51
- const response = http.request('GET', url.toString(), undefined, {
52
+ const response = http.request('GET', k6url.toString(), undefined, {
52
53
  ...mergedRequestParameters,
53
54
  headers: {
54
55
  ...mergedRequestParameters?.headers,
@@ -71,6 +72,7 @@ export class DefaultClient {
71
72
  return {
72
73
  response,
73
74
  data,
75
+ operationId: 'GetExampleGet',
74
76
  }
75
77
  }
76
78
  /**
@@ -84,15 +86,16 @@ export class DefaultClient {
84
86
  ): {
85
87
  response: Response
86
88
  data: void
89
+ operationId: string
87
90
  } {
88
- const url = new URL(this.cleanBaseUrl + `/example-post`)
91
+ const k6url = new URL(this.cleanBaseUrl + `/example-post`)
89
92
  const mergedRequestParameters = this._mergeRequestParameters(
90
93
  requestParameters || {},
91
94
  this.commonRequestParameters
92
95
  )
93
96
  const response = http.request(
94
97
  'POST',
95
- url.toString(),
98
+ k6url.toString(),
96
99
  JSON.stringify(postExamplePostBody),
97
100
  {
98
101
  ...mergedRequestParameters,
@@ -119,6 +122,7 @@ export class DefaultClient {
119
122
  return {
120
123
  response,
121
124
  data,
125
+ operationId: 'PostExamplePost',
122
126
  }
123
127
  }
124
128
  /**
@@ -128,15 +132,16 @@ export class DefaultClient {
128
132
  getExampleResponseHeaders(requestParameters?: Params): {
129
133
  response: Response
130
134
  data: GetExampleResponseHeaders200
135
+ operationId: string
131
136
  } {
132
- const url = new URL(this.cleanBaseUrl + `/example-response-headers`)
137
+ const k6url = new URL(this.cleanBaseUrl + `/example-response-headers`)
133
138
  const mergedRequestParameters = this._mergeRequestParameters(
134
139
  requestParameters || {},
135
140
  this.commonRequestParameters
136
141
  )
137
142
  const response = http.request(
138
143
  'GET',
139
- url.toString(),
144
+ k6url.toString(),
140
145
  undefined,
141
146
  mergedRequestParameters
142
147
  )
@@ -150,6 +155,7 @@ export class DefaultClient {
150
155
  return {
151
156
  response,
152
157
  data,
158
+ operationId: 'GetExampleResponseHeaders',
153
159
  }
154
160
  }
155
161
 
@@ -1,16 +1,19 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.3.1
2
+ * Automatically generated by @grafana/openapi-to-k6: 0.4.1
3
3
  * Do not edit manually.
4
4
  * Header Demo API
5
5
  * An API demonstrating the use of headers in different ways
6
6
  * Service version: 1.0.0
7
7
  */
8
- export type GetExampleResponseHeaders200 = {
9
- status?: string
8
+ export type GetExampleGetHeaders = {
9
+ /**
10
+ * A custom header for this request
11
+ */
12
+ 'X-Custom-Header'?: string
10
13
  }
11
14
 
12
- export type PostExamplePostBody = {
13
- data?: string
15
+ export type GetExampleGet200 = {
16
+ message?: string
14
17
  }
15
18
 
16
19
  export type PostExamplePostHeaders = {
@@ -20,13 +23,10 @@ export type PostExamplePostHeaders = {
20
23
  Authorization: string
21
24
  }
22
25
 
23
- export type GetExampleGet200 = {
24
- message?: string
26
+ export type PostExamplePostBody = {
27
+ data?: string
25
28
  }
26
29
 
27
- export type GetExampleGetHeaders = {
28
- /**
29
- * A custom header for this request
30
- */
31
- 'X-Custom-Header'?: string
30
+ export type GetExampleResponseHeaders200 = {
31
+ status?: string
32
32
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.3.1
2
+ * Automatically generated by @grafana/openapi-to-k6: 0.4.1
3
3
  * Do not edit manually.
4
4
  * K6Client
5
5
  * Service version: 1.0.0
@@ -33,15 +33,16 @@ export class K6ClientClient {
33
33
  getExample(requestParameters?: Params): {
34
34
  response: Response
35
35
  data: GetExample200
36
+ operationId: string
36
37
  } {
37
- const url = new URL(this.cleanBaseUrl + `/example`)
38
+ const k6url = new URL(this.cleanBaseUrl + `/example`)
38
39
  const mergedRequestParameters = this._mergeRequestParameters(
39
40
  requestParameters || {},
40
41
  this.commonRequestParameters
41
42
  )
42
43
  const response = http.request(
43
44
  'GET',
44
- url.toString(),
45
+ k6url.toString(),
45
46
  undefined,
46
47
  mergedRequestParameters
47
48
  )
@@ -55,6 +56,7 @@ export class K6ClientClient {
55
56
  return {
56
57
  response,
57
58
  data,
59
+ operationId: 'GetExample',
58
60
  }
59
61
  }
60
62
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.3.1
2
+ * Automatically generated by @grafana/openapi-to-k6: 0.4.1
3
3
  * Do not edit manually.
4
4
  * K6Client
5
5
  * Service version: 1.0.0
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.3.1
2
+ * Automatically generated by @grafana/openapi-to-k6: 0.4.1
3
3
  * Do not edit manually.
4
4
  * K6Client
5
5
  * Service version: 1.0.0
@@ -31,15 +31,16 @@ export class K6ClientClient {
31
31
  getExample(requestParameters?: Params): {
32
32
  response: Response
33
33
  data: GetExample200
34
+ operationId: string
34
35
  } {
35
- const url = new URL(this.cleanBaseUrl + `/example`)
36
+ const k6url = new URL(this.cleanBaseUrl + `/example`)
36
37
  const mergedRequestParameters = this._mergeRequestParameters(
37
38
  requestParameters || {},
38
39
  this.commonRequestParameters
39
40
  )
40
41
  const response = http.request(
41
42
  'GET',
42
- url.toString(),
43
+ k6url.toString(),
43
44
  undefined,
44
45
  mergedRequestParameters
45
46
  )
@@ -53,6 +54,7 @@ export class K6ClientClient {
53
54
  return {
54
55
  response,
55
56
  data,
57
+ operationId: 'GetExample',
56
58
  }
57
59
  }
58
60
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.3.1
2
+ * Automatically generated by @grafana/openapi-to-k6: 0.4.1
3
3
  * Do not edit manually.
4
4
  * K6Client
5
5
  * Service version: 1.0.0
@@ -31,15 +31,16 @@ export class DefaultClient {
31
31
  getExample(requestParameters?: Params): {
32
32
  response: Response
33
33
  data: GetExample200
34
+ operationId: string
34
35
  } {
35
- const url = new URL(this.cleanBaseUrl + `/example`)
36
+ const k6url = new URL(this.cleanBaseUrl + `/example`)
36
37
  const mergedRequestParameters = this._mergeRequestParameters(
37
38
  requestParameters || {},
38
39
  this.commonRequestParameters
39
40
  )
40
41
  const response = http.request(
41
42
  'GET',
42
- url.toString(),
43
+ k6url.toString(),
43
44
  undefined,
44
45
  mergedRequestParameters
45
46
  )
@@ -53,6 +54,7 @@ export class DefaultClient {
53
54
  return {
54
55
  response,
55
56
  data,
57
+ operationId: 'GetExample',
56
58
  }
57
59
  }
58
60
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.3.1
2
+ * Automatically generated by @grafana/openapi-to-k6: 0.4.1
3
3
  * Do not edit manually.
4
4
  * K6Client
5
5
  * Service version: 1.0.0
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.3.1
2
+ * Automatically generated by @grafana/openapi-to-k6: 0.4.1
3
3
  * Do not edit manually.
4
4
  * Example API
5
5
  * API with a POST request having an object as the body and query parameters
@@ -8,22 +8,6 @@
8
8
  import { URL, URLSearchParams } 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
- export type CreateExampleData201 = {
12
- /** The user ID from the query parameter */
13
- userId?: string
14
- /** The active status from the query parameter */
15
- isActive?: boolean
16
- /** The data from the body */
17
- data?: string
18
- /** Response status */
19
- status?: string
20
- }
21
-
22
- export type CreateExampleDataBody = {
23
- /** A string field representing data */
24
- data: string
25
- }
26
-
27
11
  export type CreateExampleDataParams = {
28
12
  /**
29
13
  * A string query parameter for user ID
@@ -35,6 +19,22 @@ export type CreateExampleDataParams = {
35
19
  isActive?: boolean
36
20
  }
37
21
 
22
+ export type CreateExampleDataBody = {
23
+ /** A string field representing data */
24
+ data: string
25
+ }
26
+
27
+ export type CreateExampleData201 = {
28
+ /** The user ID from the query parameter */
29
+ userId?: string
30
+ /** The active status from the query parameter */
31
+ isActive?: boolean
32
+ /** The data from the body */
33
+ data?: string
34
+ /** Response status */
35
+ status?: string
36
+ }
37
+
38
38
  /**
39
39
  * This is the base client to use for interacting with the API.
40
40
  */
@@ -62,8 +62,9 @@ export class ExampleAPIClient {
62
62
  ): {
63
63
  response: Response
64
64
  data: CreateExampleData201
65
+ operationId: string
65
66
  } {
66
- const url = new URL(
67
+ const k6url = new URL(
67
68
  this.cleanBaseUrl +
68
69
  `/example` +
69
70
  `?${new URLSearchParams(params).toString()}`
@@ -74,7 +75,7 @@ export class ExampleAPIClient {
74
75
  )
75
76
  const response = http.request(
76
77
  'POST',
77
- url.toString(),
78
+ k6url.toString(),
78
79
  JSON.stringify(createExampleDataBody),
79
80
  {
80
81
  ...mergedRequestParameters,
@@ -94,6 +95,7 @@ export class ExampleAPIClient {
94
95
  return {
95
96
  response,
96
97
  data,
98
+ operationId: 'createExampleData',
97
99
  }
98
100
  }
99
101
 
@@ -1,26 +1,10 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.3.1
2
+ * Automatically generated by @grafana/openapi-to-k6: 0.4.1
3
3
  * Do not edit manually.
4
4
  * Example API
5
5
  * API with a POST request having an object as the body and query parameters
6
6
  * Service version: 1.0.0
7
7
  */
8
- export type CreateExampleData201 = {
9
- /** The user ID from the query parameter */
10
- userId?: string
11
- /** The active status from the query parameter */
12
- isActive?: boolean
13
- /** The data from the body */
14
- data?: string
15
- /** Response status */
16
- status?: string
17
- }
18
-
19
- export type CreateExampleDataBody = {
20
- /** A string field representing data */
21
- data: string
22
- }
23
-
24
8
  export type CreateExampleDataParams = {
25
9
  /**
26
10
  * A string query parameter for user ID
@@ -31,3 +15,19 @@ export type CreateExampleDataParams = {
31
15
  */
32
16
  isActive?: boolean
33
17
  }
18
+
19
+ export type CreateExampleDataBody = {
20
+ /** A string field representing data */
21
+ data: string
22
+ }
23
+
24
+ export type CreateExampleData201 = {
25
+ /** The user ID from the query parameter */
26
+ userId?: string
27
+ /** The active status from the query parameter */
28
+ isActive?: boolean
29
+ /** The data from the body */
30
+ data?: string
31
+ /** Response status */
32
+ status?: string
33
+ }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.3.1
2
+ * Automatically generated by @grafana/openapi-to-k6: 0.4.1
3
3
  * Do not edit manually.
4
4
  * Example API
5
5
  * API with a POST request having an object as the body and query parameters
@@ -41,8 +41,9 @@ export class ExampleAPIClient {
41
41
  ): {
42
42
  response: Response
43
43
  data: CreateExampleData201
44
+ operationId: string
44
45
  } {
45
- const url = new URL(
46
+ const k6url = new URL(
46
47
  this.cleanBaseUrl +
47
48
  `/example` +
48
49
  `?${new URLSearchParams(params).toString()}`
@@ -53,7 +54,7 @@ export class ExampleAPIClient {
53
54
  )
54
55
  const response = http.request(
55
56
  'POST',
56
- url.toString(),
57
+ k6url.toString(),
57
58
  JSON.stringify(createExampleDataBody),
58
59
  {
59
60
  ...mergedRequestParameters,
@@ -73,6 +74,7 @@ export class ExampleAPIClient {
73
74
  return {
74
75
  response,
75
76
  data,
77
+ operationId: 'createExampleData',
76
78
  }
77
79
  }
78
80
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.3.1
2
+ * Automatically generated by @grafana/openapi-to-k6: 0.4.1
3
3
  * Do not edit manually.
4
4
  * Example API
5
5
  * API with a POST request having an object as the body and query parameters
@@ -41,8 +41,9 @@ export class DefaultClient {
41
41
  ): {
42
42
  response: Response
43
43
  data: CreateExampleData201
44
+ operationId: string
44
45
  } {
45
- const url = new URL(
46
+ const k6url = new URL(
46
47
  this.cleanBaseUrl +
47
48
  `/example` +
48
49
  `?${new URLSearchParams(params).toString()}`
@@ -53,7 +54,7 @@ export class DefaultClient {
53
54
  )
54
55
  const response = http.request(
55
56
  'POST',
56
- url.toString(),
57
+ k6url.toString(),
57
58
  JSON.stringify(createExampleDataBody),
58
59
  {
59
60
  ...mergedRequestParameters,
@@ -73,6 +74,7 @@ export class DefaultClient {
73
74
  return {
74
75
  response,
75
76
  data,
77
+ operationId: 'createExampleData',
76
78
  }
77
79
  }
78
80