@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
@@ -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
  * Simple API
5
5
  * An API with a single GET request that takes a path parameter
@@ -9,9 +9,9 @@ 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 GetItemById200 = {
12
- description?: string
13
12
  id?: string
14
13
  name?: string
14
+ description?: string
15
15
  }
16
16
 
17
17
  /**
@@ -26,6 +26,8 @@ export class SimpleAPIClient {
26
26
  commonRequestParameters?: Params
27
27
  }) {
28
28
  this.cleanBaseUrl = clientOptions.baseUrl.replace(/\/+$/, '')
29
+
30
+ this.commonRequestParameters = clientOptions.commonRequestParameters || {}
29
31
  }
30
32
 
31
33
  /**
@@ -1,12 +1,12 @@
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
  * An API with a single GET request that takes a path parameter
6
6
  * Service version: 1.0.0
7
7
  */
8
8
  export type GetItemById200 = {
9
- description?: string
10
9
  id?: string
11
10
  name?: string
11
+ description?: string
12
12
  }
@@ -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
  * An API with a single GET request that takes a path parameter
@@ -22,6 +22,8 @@ export class SimpleAPIClient {
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
  /**
@@ -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
  * An API with a single GET request that takes a path parameter
@@ -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
  /**
@@ -1,12 +1,12 @@
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
  * An API with a single GET request that takes a path parameter
6
6
  * Service version: 1.0.0
7
7
  */
8
8
  export type GetItemById200 = {
9
- description?: string
10
9
  id?: string
11
10
  name?: string
11
+ description?: string
12
12
  }
@@ -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
  * Header Demo API
5
5
  * An API demonstrating the use of headers in different ways
@@ -46,6 +46,8 @@ export class HeaderDemoAPIClient {
46
46
  commonRequestParameters?: Params
47
47
  }) {
48
48
  this.cleanBaseUrl = clientOptions.baseUrl.replace(/\/+$/, '')
49
+
50
+ this.commonRequestParameters = clientOptions.commonRequestParameters || {}
49
51
  }
50
52
 
51
53
  /**
@@ -67,6 +69,7 @@ export class HeaderDemoAPIClient {
67
69
  const response = http.request('GET', url.toString(), undefined, {
68
70
  ...mergedRequestParameters,
69
71
  headers: {
72
+ ...mergedRequestParameters?.headers,
70
73
  // In the schema, headers can be of any type like number but k6 accepts only strings as headers, hence converting all headers to string
71
74
  ...Object.fromEntries(
72
75
  Object.entries(headers || {}).map(([key, value]) => [
@@ -74,7 +77,6 @@ export class HeaderDemoAPIClient {
74
77
  String(value),
75
78
  ])
76
79
  ),
77
- ...mergedRequestParameters?.headers,
78
80
  },
79
81
  })
80
82
  let data
@@ -114,6 +116,7 @@ export class HeaderDemoAPIClient {
114
116
  {
115
117
  ...mergedRequestParameters,
116
118
  headers: {
119
+ ...mergedRequestParameters?.headers,
117
120
  'Content-Type': 'application/json',
118
121
  // In the schema, headers can be of any type like number but k6 accepts only strings as headers, hence converting all headers to string
119
122
  ...Object.fromEntries(
@@ -122,7 +125,6 @@ export class HeaderDemoAPIClient {
122
125
  String(value),
123
126
  ])
124
127
  ),
125
- ...mergedRequestParameters?.headers,
126
128
  },
127
129
  }
128
130
  )
@@ -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
  * Header Demo API
5
5
  * An API demonstrating the use of headers in different ways
@@ -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
  * Header Demo API
5
5
  * An API demonstrating the use of headers in different ways
@@ -28,6 +28,8 @@ export class HeaderDemoAPIClient {
28
28
  commonRequestParameters?: Params
29
29
  }) {
30
30
  this.cleanBaseUrl = clientOptions.baseUrl.replace(/\/+$/, '')
31
+
32
+ this.commonRequestParameters = clientOptions.commonRequestParameters || {}
31
33
  }
32
34
 
33
35
  /**
@@ -49,6 +51,7 @@ export class HeaderDemoAPIClient {
49
51
  const response = http.request('GET', url.toString(), undefined, {
50
52
  ...mergedRequestParameters,
51
53
  headers: {
54
+ ...mergedRequestParameters?.headers,
52
55
  // In the schema, headers can be of any type like number but k6 accepts only strings as headers, hence converting all headers to string
53
56
  ...Object.fromEntries(
54
57
  Object.entries(headers || {}).map(([key, value]) => [
@@ -56,7 +59,6 @@ export class HeaderDemoAPIClient {
56
59
  String(value),
57
60
  ])
58
61
  ),
59
- ...mergedRequestParameters?.headers,
60
62
  },
61
63
  })
62
64
  let data
@@ -96,6 +98,7 @@ export class HeaderDemoAPIClient {
96
98
  {
97
99
  ...mergedRequestParameters,
98
100
  headers: {
101
+ ...mergedRequestParameters?.headers,
99
102
  'Content-Type': 'application/json',
100
103
  // In the schema, headers can be of any type like number but k6 accepts only strings as headers, hence converting all headers to string
101
104
  ...Object.fromEntries(
@@ -104,7 +107,6 @@ export class HeaderDemoAPIClient {
104
107
  String(value),
105
108
  ])
106
109
  ),
107
- ...mergedRequestParameters?.headers,
108
110
  },
109
111
  }
110
112
  )
@@ -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
  * Header Demo API
5
5
  * An API demonstrating the use of headers in different ways
@@ -28,6 +28,8 @@ export class DefaultClient {
28
28
  commonRequestParameters?: Params
29
29
  }) {
30
30
  this.cleanBaseUrl = clientOptions.baseUrl.replace(/\/+$/, '')
31
+
32
+ this.commonRequestParameters = clientOptions.commonRequestParameters || {}
31
33
  }
32
34
 
33
35
  /**
@@ -49,6 +51,7 @@ export class DefaultClient {
49
51
  const response = http.request('GET', url.toString(), undefined, {
50
52
  ...mergedRequestParameters,
51
53
  headers: {
54
+ ...mergedRequestParameters?.headers,
52
55
  // In the schema, headers can be of any type like number but k6 accepts only strings as headers, hence converting all headers to string
53
56
  ...Object.fromEntries(
54
57
  Object.entries(headers || {}).map(([key, value]) => [
@@ -56,7 +59,6 @@ export class DefaultClient {
56
59
  String(value),
57
60
  ])
58
61
  ),
59
- ...mergedRequestParameters?.headers,
60
62
  },
61
63
  })
62
64
  let data
@@ -95,6 +97,7 @@ export class DefaultClient {
95
97
  {
96
98
  ...mergedRequestParameters,
97
99
  headers: {
100
+ ...mergedRequestParameters?.headers,
98
101
  'Content-Type': 'application/json',
99
102
  // In the schema, headers can be of any type like number but k6 accepts only strings as headers, hence converting all headers to string
100
103
  ...Object.fromEntries(
@@ -103,7 +106,6 @@ export class DefaultClient {
103
106
  String(value),
104
107
  ])
105
108
  ),
106
- ...mergedRequestParameters?.headers,
107
109
  },
108
110
  }
109
111
  )
@@ -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
  * Header Demo API
5
5
  * An API demonstrating the use of headers in different ways
@@ -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
  * K6Client
5
5
  * Service version: 1.0.0
@@ -23,6 +23,8 @@ export class K6ClientClient {
23
23
  commonRequestParameters?: Params
24
24
  }) {
25
25
  this.cleanBaseUrl = clientOptions.baseUrl.replace(/\/+$/, '')
26
+
27
+ this.commonRequestParameters = clientOptions.commonRequestParameters || {}
26
28
  }
27
29
 
28
30
  /**
@@ -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
  * K6Client
5
5
  * Service version: 1.0.0
@@ -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
  * K6Client
5
5
  * Service version: 1.0.0
@@ -21,6 +21,8 @@ export class K6ClientClient {
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
  * K6Client
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,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
  * K6Client
5
5
  * Service version: 1.0.0
@@ -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
  * Example API
5
5
  * API with a POST request having an object as the body and query parameters
@@ -9,14 +9,14 @@ 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
11
  export type CreateExampleData201 = {
12
- /** The data from the body */
13
- data?: string
12
+ /** The user ID from the query parameter */
13
+ userId?: string
14
14
  /** The active status from the query parameter */
15
15
  isActive?: boolean
16
+ /** The data from the body */
17
+ data?: string
16
18
  /** Response status */
17
19
  status?: string
18
- /** The user ID from the query parameter */
19
- userId?: string
20
20
  }
21
21
 
22
22
  export type CreateExampleDataBody = {
@@ -47,6 +47,8 @@ export class ExampleAPIClient {
47
47
  commonRequestParameters?: Params
48
48
  }) {
49
49
  this.cleanBaseUrl = clientOptions.baseUrl.replace(/\/+$/, '')
50
+
51
+ this.commonRequestParameters = clientOptions.commonRequestParameters || {}
50
52
  }
51
53
 
52
54
  /**
@@ -77,8 +79,8 @@ export class ExampleAPIClient {
77
79
  {
78
80
  ...mergedRequestParameters,
79
81
  headers: {
80
- 'Content-Type': 'application/json',
81
82
  ...mergedRequestParameters?.headers,
83
+ 'Content-Type': 'application/json',
82
84
  },
83
85
  }
84
86
  )
@@ -1,19 +1,19 @@
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
  * 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
8
  export type CreateExampleData201 = {
9
- /** The data from the body */
10
- data?: string
9
+ /** The user ID from the query parameter */
10
+ userId?: string
11
11
  /** The active status from the query parameter */
12
12
  isActive?: boolean
13
+ /** The data from the body */
14
+ data?: string
13
15
  /** Response status */
14
16
  status?: string
15
- /** The user ID from the query parameter */
16
- userId?: string
17
17
  }
18
18
 
19
19
  export type CreateExampleDataBody = {
@@ -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
  * Example API
5
5
  * API with a POST request having an object as the body and query parameters
@@ -26,6 +26,8 @@ export class ExampleAPIClient {
26
26
  commonRequestParameters?: Params
27
27
  }) {
28
28
  this.cleanBaseUrl = clientOptions.baseUrl.replace(/\/+$/, '')
29
+
30
+ this.commonRequestParameters = clientOptions.commonRequestParameters || {}
29
31
  }
30
32
 
31
33
  /**
@@ -56,8 +58,8 @@ export class ExampleAPIClient {
56
58
  {
57
59
  ...mergedRequestParameters,
58
60
  headers: {
59
- 'Content-Type': 'application/json',
60
61
  ...mergedRequestParameters?.headers,
62
+ 'Content-Type': 'application/json',
61
63
  },
62
64
  }
63
65
  )
@@ -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
  * Example API
5
5
  * API with a POST request having an object as the body and query parameters
@@ -26,6 +26,8 @@ export class DefaultClient {
26
26
  commonRequestParameters?: Params
27
27
  }) {
28
28
  this.cleanBaseUrl = clientOptions.baseUrl.replace(/\/+$/, '')
29
+
30
+ this.commonRequestParameters = clientOptions.commonRequestParameters || {}
29
31
  }
30
32
 
31
33
  /**
@@ -56,8 +58,8 @@ export class DefaultClient {
56
58
  {
57
59
  ...mergedRequestParameters,
58
60
  headers: {
59
- 'Content-Type': 'application/json',
60
61
  ...mergedRequestParameters?.headers,
62
+ 'Content-Type': 'application/json',
61
63
  },
62
64
  }
63
65
  )
@@ -1,19 +1,19 @@
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
  * 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
8
  export type CreateExampleData201 = {
9
- /** The data from the body */
10
- data?: string
9
+ /** The user ID from the query parameter */
10
+ userId?: string
11
11
  /** The active status from the query parameter */
12
12
  isActive?: boolean
13
+ /** The data from the body */
14
+ data?: string
13
15
  /** Response status */
14
16
  status?: string
15
- /** The user ID from the query parameter */
16
- userId?: string
17
17
  }
18
18
 
19
19
  export type CreateExampleDataBody = {
@@ -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
  * Example API
5
5
  * API with all formats of query parameters
@@ -9,11 +9,11 @@ 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
11
  export type GetExampleData200 = {
12
+ name?: string
12
13
  age?: number
13
- date?: string
14
14
  isActive?: boolean
15
- name?: string
16
15
  tags?: string[]
16
+ date?: string
17
17
  }
18
18
 
19
19
  export type GetExampleDataParams = {
@@ -51,6 +51,8 @@ export class ExampleAPIClient {
51
51
  commonRequestParameters?: Params
52
52
  }) {
53
53
  this.cleanBaseUrl = clientOptions.baseUrl.replace(/\/+$/, '')
54
+
55
+ this.commonRequestParameters = clientOptions.commonRequestParameters || {}
54
56
  }
55
57
 
56
58
  /**
@@ -1,16 +1,16 @@
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
  * Example API
5
5
  * API with all formats of query parameters
6
6
  * Service version: 1.0.0
7
7
  */
8
8
  export type GetExampleData200 = {
9
+ name?: string
9
10
  age?: number
10
- date?: string
11
11
  isActive?: boolean
12
- name?: string
13
12
  tags?: string[]
13
+ date?: string
14
14
  }
15
15
 
16
16
  export type GetExampleDataParams = {
@@ -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
  * Example API
5
5
  * API with all formats of query parameters
@@ -25,6 +25,8 @@ export class ExampleAPIClient {
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
  /**
@@ -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
  * Example API
5
5
  * API with all formats of query parameters
@@ -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
  /**
@@ -1,16 +1,16 @@
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
  * Example API
5
5
  * API with all formats of query parameters
6
6
  * Service version: 1.0.0
7
7
  */
8
8
  export type GetExampleData200 = {
9
+ name?: string
9
10
  age?: number
10
- date?: string
11
11
  isActive?: boolean
12
- name?: string
13
12
  tags?: string[]
13
+ date?: string
14
14
  }
15
15
 
16
16
  export type GetExampleDataParams = {
@@ -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
  * Example API
5
5
  * API with all formats of data in the POST request body
@@ -14,14 +14,14 @@ export type CreateExampleData201Meta = {
14
14
  }
15
15
 
16
16
  export type CreateExampleData201 = {
17
- age?: number
18
- date?: string
19
17
  /** The unique ID of the created resource */
20
18
  id?: string
21
- isActive?: boolean
22
- meta?: CreateExampleData201Meta
23
19
  name?: string
20
+ age?: number
21
+ isActive?: boolean
24
22
  tags?: string[]
23
+ date?: string
24
+ meta?: CreateExampleData201Meta
25
25
  }
26
26
 
27
27
  /**
@@ -35,18 +35,18 @@ export type CreateExampleDataBodyMeta = {
35
35
  }
36
36
 
37
37
  export type CreateExampleDataBody = {
38
+ /** A string parameter */
39
+ name: string
38
40
  /** An integer parameter */
39
41
  age: number
40
- /** A date parameter in YYYY-MM-DD format */
41
- date?: string
42
42
  /** A boolean parameter */
43
43
  isActive: boolean
44
- /** An object parameter containing metadata */
45
- meta?: CreateExampleDataBodyMeta
46
- /** A string parameter */
47
- name: string
48
44
  /** An array of strings */
49
45
  tags?: string[]
46
+ /** A date parameter in YYYY-MM-DD format */
47
+ date?: string
48
+ /** An object parameter containing metadata */
49
+ meta?: CreateExampleDataBodyMeta
50
50
  }
51
51
 
52
52
  /**
@@ -61,6 +61,8 @@ export class ExampleAPIClient {
61
61
  commonRequestParameters?: Params
62
62
  }) {
63
63
  this.cleanBaseUrl = clientOptions.baseUrl.replace(/\/+$/, '')
64
+
65
+ this.commonRequestParameters = clientOptions.commonRequestParameters || {}
64
66
  }
65
67
 
66
68
  /**
@@ -86,8 +88,8 @@ export class ExampleAPIClient {
86
88
  {
87
89
  ...mergedRequestParameters,
88
90
  headers: {
89
- 'Content-Type': 'application/json',
90
91
  ...mergedRequestParameters?.headers,
92
+ 'Content-Type': 'application/json',
91
93
  },
92
94
  }
93
95
  )