@grafana/openapi-to-k6 0.2.6 → 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 (124) hide show
  1. package/README.md +5 -1
  2. package/dist/constants.js +7 -3
  3. package/dist/generator/index.js +13 -6
  4. package/dist/generator/k6Client.js +8 -56
  5. package/dist/generator/k6ScriptBuilder.js +256 -0
  6. package/dist/helper.js +16 -0
  7. package/examples/basic_schema/schema.json +2 -1
  8. package/examples/basic_schema/single/k6-script.sample.ts +3 -2
  9. package/examples/basic_schema/single/simpleAPI.ts +4 -1
  10. package/examples/basic_schema/split/k6-script.sample.ts +3 -2
  11. package/examples/basic_schema/split/simpleAPI.schemas.ts +2 -1
  12. package/examples/basic_schema/split/simpleAPI.ts +3 -1
  13. package/examples/basic_schema/tags/default.ts +3 -1
  14. package/examples/basic_schema/tags/k6-script.sample.ts +4 -3
  15. package/examples/basic_schema/tags/simpleAPI.schemas.ts +2 -1
  16. package/examples/form_data_schema/schema.json +6 -3
  17. package/examples/form_data_schema/single/formDataAPI.ts +8 -6
  18. package/examples/form_data_schema/single/k6-script.sample.ts +10 -2
  19. package/examples/form_data_schema/split/formDataAPI.schemas.ts +5 -5
  20. package/examples/form_data_schema/split/formDataAPI.ts +4 -2
  21. package/examples/form_data_schema/split/k6-script.sample.ts +10 -2
  22. package/examples/form_data_schema/tags/default.ts +4 -2
  23. package/examples/form_data_schema/tags/formDataAPI.schemas.ts +5 -5
  24. package/examples/form_data_schema/tags/k6-script.sample.ts +11 -3
  25. package/examples/form_url_encoded_data_schema/schema.json +6 -3
  26. package/examples/form_url_encoded_data_schema/single/formURLEncodedAPI.ts +8 -6
  27. package/examples/form_url_encoded_data_schema/single/k6-script.sample.ts +11 -2
  28. package/examples/form_url_encoded_data_schema/split/formURLEncodedAPI.schemas.ts +5 -5
  29. package/examples/form_url_encoded_data_schema/split/formURLEncodedAPI.ts +4 -2
  30. package/examples/form_url_encoded_data_schema/split/k6-script.sample.ts +11 -2
  31. package/examples/form_url_encoded_data_schema/tags/default.ts +4 -2
  32. package/examples/form_url_encoded_data_schema/tags/formURLEncodedAPI.schemas.ts +5 -5
  33. package/examples/form_url_encoded_data_schema/tags/k6-script.sample.ts +12 -3
  34. package/examples/form_url_encoded_data_with_query_params_schema/schema.json +8 -4
  35. package/examples/form_url_encoded_data_with_query_params_schema/single/formURLEncodedAPIWithQueryParameters.ts +8 -6
  36. package/examples/form_url_encoded_data_with_query_params_schema/single/k6-script.sample.ts +19 -6
  37. package/examples/form_url_encoded_data_with_query_params_schema/split/formURLEncodedAPIWithQueryParameters.schemas.ts +5 -5
  38. package/examples/form_url_encoded_data_with_query_params_schema/split/formURLEncodedAPIWithQueryParameters.ts +4 -2
  39. package/examples/form_url_encoded_data_with_query_params_schema/split/k6-script.sample.ts +19 -6
  40. package/examples/form_url_encoded_data_with_query_params_schema/tags/default.ts +4 -2
  41. package/examples/form_url_encoded_data_with_query_params_schema/tags/formURLEncodedAPIWithQueryParameters.schemas.ts +5 -5
  42. package/examples/form_url_encoded_data_with_query_params_schema/tags/k6-script.sample.ts +14 -3
  43. package/examples/get_request_with_path_parameters_schema/schema.json +2 -1
  44. package/examples/get_request_with_path_parameters_schema/single/k6-script.sample.ts +6 -2
  45. package/examples/get_request_with_path_parameters_schema/single/simpleAPI.ts +4 -2
  46. package/examples/get_request_with_path_parameters_schema/split/k6-script.sample.ts +6 -2
  47. package/examples/get_request_with_path_parameters_schema/split/simpleAPI.schemas.ts +2 -2
  48. package/examples/get_request_with_path_parameters_schema/split/simpleAPI.ts +3 -1
  49. package/examples/get_request_with_path_parameters_schema/tags/default.ts +3 -1
  50. package/examples/get_request_with_path_parameters_schema/tags/k6-script.sample.ts +7 -3
  51. package/examples/get_request_with_path_parameters_schema/tags/simpleAPI.schemas.ts +2 -2
  52. package/examples/headers_schema/schema.json +2 -1
  53. package/examples/headers_schema/single/headerDemoAPI.ts +5 -3
  54. package/examples/headers_schema/single/k6-script.sample.ts +15 -4
  55. package/examples/headers_schema/split/headerDemoAPI.schemas.ts +1 -1
  56. package/examples/headers_schema/split/headerDemoAPI.ts +5 -3
  57. package/examples/headers_schema/split/k6-script.sample.ts +15 -4
  58. package/examples/headers_schema/tags/default.ts +5 -3
  59. package/examples/headers_schema/tags/headerDemoAPI.schemas.ts +1 -1
  60. package/examples/headers_schema/tags/k6-script.sample.ts +16 -5
  61. package/examples/no_title_schema/single/k6-script.sample.ts +3 -2
  62. package/examples/no_title_schema/single/k6Client.ts +3 -1
  63. package/examples/no_title_schema/split/k6-script.sample.ts +3 -2
  64. package/examples/no_title_schema/split/k6Client.schemas.ts +1 -1
  65. package/examples/no_title_schema/split/k6Client.ts +3 -1
  66. package/examples/no_title_schema/tags/default.ts +3 -1
  67. package/examples/no_title_schema/tags/k6-script.sample.ts +4 -3
  68. package/examples/no_title_schema/tags/k6Client.schemas.ts +1 -1
  69. package/examples/post_request_with_query_params/schema.json +14 -7
  70. package/examples/post_request_with_query_params/single/exampleAPI.ts +8 -6
  71. package/examples/post_request_with_query_params/single/k6-script.sample.ts +11 -2
  72. package/examples/post_request_with_query_params/split/exampleAPI.schemas.ts +5 -5
  73. package/examples/post_request_with_query_params/split/exampleAPI.ts +4 -2
  74. package/examples/post_request_with_query_params/split/k6-script.sample.ts +11 -2
  75. package/examples/post_request_with_query_params/tags/default.ts +4 -2
  76. package/examples/post_request_with_query_params/tags/exampleAPI.schemas.ts +5 -5
  77. package/examples/post_request_with_query_params/tags/k6-script.sample.ts +12 -3
  78. package/examples/query_params_schema/schema.json +20 -10
  79. package/examples/query_params_schema/single/exampleAPI.ts +5 -3
  80. package/examples/query_params_schema/single/k6-script.sample.ts +8 -2
  81. package/examples/query_params_schema/split/exampleAPI.schemas.ts +3 -3
  82. package/examples/query_params_schema/split/exampleAPI.ts +3 -1
  83. package/examples/query_params_schema/split/k6-script.sample.ts +8 -2
  84. package/examples/query_params_schema/tags/default.ts +3 -1
  85. package/examples/query_params_schema/tags/exampleAPI.schemas.ts +3 -3
  86. package/examples/query_params_schema/tags/k6-script.sample.ts +9 -3
  87. package/examples/simple_post_request_schema/schema.json +30 -15
  88. package/examples/simple_post_request_schema/single/exampleAPI.ts +14 -12
  89. package/examples/simple_post_request_schema/single/k6-script.sample.ts +16 -2
  90. package/examples/simple_post_request_schema/split/exampleAPI.schemas.ts +11 -11
  91. package/examples/simple_post_request_schema/split/exampleAPI.ts +4 -2
  92. package/examples/simple_post_request_schema/split/k6-script.sample.ts +16 -2
  93. package/examples/simple_post_request_schema/tags/default.ts +4 -2
  94. package/examples/simple_post_request_schema/tags/exampleAPI.schemas.ts +11 -11
  95. package/examples/simple_post_request_schema/tags/k6-script.sample.ts +17 -3
  96. package/package.json +5 -2
  97. package/src/constants.ts +7 -3
  98. package/src/generator/index.ts +20 -7
  99. package/src/generator/k6Client.ts +6 -73
  100. package/src/generator/k6ScriptBuilder.ts +328 -0
  101. package/src/helper.ts +17 -0
  102. package/tests/e2e/schema.json +135 -18
  103. package/tests/e2e/single/k6Script.ts +54 -1
  104. package/tests/functional-tests/helper.ts +16 -0
  105. package/tests/functional-tests/test-generator/fixtures/basic_parameter_in_ref.json +59 -0
  106. package/tests/functional-tests/{fixtures/schemas → test-generator/fixtures}/form_data_schema.json +1 -1
  107. package/tests/functional-tests/{fixtures/schemas → test-generator/fixtures}/form_url_encoded_data_schema.json +1 -1
  108. package/tests/functional-tests/{fixtures/schemas → test-generator/fixtures}/headers_schema.json +2 -2
  109. package/tests/functional-tests/{fixtures/schemas → test-generator/fixtures}/simple_post_request_schema.json +1 -1
  110. package/tests/functional-tests/test-generator/generator.test.ts +154 -0
  111. package/tests/functional-tests/test-sample-k6-scripts/fixtures/schema_using_ref_models.json +394 -0
  112. package/tests/functional-tests/test-sample-k6-scripts/fixtures/schema_with_examples.json +416 -0
  113. package/tests/functional-tests/test-sample-k6-scripts/fixtures/schema_with_no_variables.json +32 -0
  114. package/tests/functional-tests/test-sample-k6-scripts/sampleK6Scripts.test.ts +248 -0
  115. package/tests/functional-tests/test-tags-filtering/tagsFiltering.test.ts +166 -0
  116. package/{vite.config.js → vite.config.mjs} +4 -0
  117. package/tests/functional-tests/generator.test.ts +0 -319
  118. /package/tests/functional-tests/{fixtures/schemas → test-generator/fixtures}/basic_schema.json +0 -0
  119. /package/tests/functional-tests/{fixtures/schemas → test-generator/fixtures}/form_url_encoded_data_with_query_params_schema.json +0 -0
  120. /package/tests/functional-tests/{fixtures/schemas → test-generator/fixtures}/get_request_with_path_parameters_schema.json +0 -0
  121. /package/tests/functional-tests/{fixtures/schemas → test-generator/fixtures}/no_title_schema.json +0 -0
  122. /package/tests/functional-tests/{fixtures/schemas → test-generator/fixtures}/post_request_with_query_params.json +0 -0
  123. /package/tests/functional-tests/{fixtures/schemas → test-generator/fixtures}/query_params_schema.json +0 -0
  124. /package/tests/functional-tests/{fixtures → test-tags-filtering/fixtures}/tags_filtering.json +0 -0
@@ -1,11 +1,12 @@
1
- import { K6ClientClient } from './k6Client.ts'
1
+ import { DefaultClient } from './default.ts'
2
2
 
3
3
  const baseUrl = '<BASE_URL>'
4
- const client = new K6ClientClient({ baseUrl })
4
+ const defaultClient = new DefaultClient({ baseUrl })
5
5
 
6
6
  export default function () {
7
7
  /**
8
8
  * Retrieve example data
9
9
  */
10
- const getExampleResponseData = client.getExample()
10
+
11
+ const getExampleResponseData = defaultClient.getExample()
11
12
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.2.6
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
@@ -17,7 +17,8 @@
17
17
  "in": "query",
18
18
  "required": true,
19
19
  "schema": {
20
- "type": "string"
20
+ "type": "string",
21
+ "example": "12345"
21
22
  },
22
23
  "description": "A string query parameter for user ID"
23
24
  },
@@ -26,7 +27,8 @@
26
27
  "in": "query",
27
28
  "required": false,
28
29
  "schema": {
29
- "type": "boolean"
30
+ "type": "boolean",
31
+ "example": true
30
32
  },
31
33
  "description": "A boolean query parameter"
32
34
  }
@@ -40,7 +42,8 @@
40
42
  "properties": {
41
43
  "data": {
42
44
  "type": "string",
43
- "description": "A string field representing data"
45
+ "description": "A string field representing data",
46
+ "example": "data"
44
47
  }
45
48
  },
46
49
  "required": [
@@ -60,19 +63,23 @@
60
63
  "properties": {
61
64
  "userId": {
62
65
  "type": "string",
63
- "description": "The user ID from the query parameter"
66
+ "description": "The user ID from the query parameter",
67
+ "example": "12345"
64
68
  },
65
69
  "isActive": {
66
70
  "type": "boolean",
67
- "description": "The active status from the query parameter"
71
+ "description": "The active status from the query parameter",
72
+ "example": true
68
73
  },
69
74
  "data": {
70
75
  "type": "string",
71
- "description": "The data from the body"
76
+ "description": "The data from the body",
77
+ "example": "data"
72
78
  },
73
79
  "status": {
74
80
  "type": "string",
75
- "description": "Response status"
81
+ "description": "Response status",
82
+ "example": "success"
76
83
  }
77
84
  }
78
85
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.2.6
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,13 +1,22 @@
1
1
  import { ExampleAPIClient } from './exampleAPI.ts'
2
2
 
3
3
  const baseUrl = '<BASE_URL>'
4
- const client = new ExampleAPIClient({ baseUrl })
4
+ const exampleAPIClient = new ExampleAPIClient({ baseUrl })
5
5
 
6
6
  export default function () {
7
+ let createExampleDataBody, params
8
+
7
9
  /**
8
10
  * Create example data
9
11
  */
10
- const createExampleDataResponseData = client.createExampleData(
12
+ createExampleDataBody = {
13
+ data: 'data',
14
+ }
15
+ params = {
16
+ userId: '12345',
17
+ }
18
+
19
+ const createExampleDataResponseData = exampleAPIClient.createExampleData(
11
20
  createExampleDataBody,
12
21
  params
13
22
  )
@@ -1,19 +1,19 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.2.6
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.2.6
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,13 +1,22 @@
1
1
  import { ExampleAPIClient } from './exampleAPI.ts'
2
2
 
3
3
  const baseUrl = '<BASE_URL>'
4
- const client = new ExampleAPIClient({ baseUrl })
4
+ const exampleAPIClient = new ExampleAPIClient({ baseUrl })
5
5
 
6
6
  export default function () {
7
+ let createExampleDataBody, params
8
+
7
9
  /**
8
10
  * Create example data
9
11
  */
10
- const createExampleDataResponseData = client.createExampleData(
12
+ createExampleDataBody = {
13
+ data: 'data',
14
+ }
15
+ params = {
16
+ userId: '12345',
17
+ }
18
+
19
+ const createExampleDataResponseData = exampleAPIClient.createExampleData(
11
20
  createExampleDataBody,
12
21
  params
13
22
  )
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.2.6
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.2.6
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,13 +1,22 @@
1
- import { ExampleAPIClient } from './exampleAPI.ts'
1
+ import { DefaultClient } from './default.ts'
2
2
 
3
3
  const baseUrl = '<BASE_URL>'
4
- const client = new ExampleAPIClient({ baseUrl })
4
+ const defaultClient = new DefaultClient({ baseUrl })
5
5
 
6
6
  export default function () {
7
+ let createExampleDataBody, params
8
+
7
9
  /**
8
10
  * Create example data
9
11
  */
10
- const createExampleDataResponseData = client.createExampleData(
12
+ createExampleDataBody = {
13
+ data: 'data',
14
+ }
15
+ params = {
16
+ userId: '12345',
17
+ }
18
+
19
+ const createExampleDataResponseData = defaultClient.createExampleData(
11
20
  createExampleDataBody,
12
21
  params
13
22
  )
@@ -17,7 +17,8 @@
17
17
  "in": "query",
18
18
  "required": true,
19
19
  "schema": {
20
- "type": "string"
20
+ "type": "string",
21
+ "example": "John Doe"
21
22
  },
22
23
  "description": "A string parameter"
23
24
  },
@@ -27,7 +28,8 @@
27
28
  "required": false,
28
29
  "schema": {
29
30
  "type": "integer",
30
- "format": "int32"
31
+ "format": "int32",
32
+ "example": 25
31
33
  },
32
34
  "description": "An integer parameter"
33
35
  },
@@ -36,7 +38,8 @@
36
38
  "in": "query",
37
39
  "required": false,
38
40
  "schema": {
39
- "type": "boolean"
41
+ "type": "boolean",
42
+ "example": true
40
43
  },
41
44
  "description": "A boolean parameter"
42
45
  },
@@ -49,7 +52,8 @@
49
52
  "schema": {
50
53
  "type": "array",
51
54
  "items": {
52
- "type": "string"
55
+ "type": "string",
56
+ "example": "tag1"
53
57
  }
54
58
  },
55
59
  "description": "An array of strings parameter"
@@ -60,7 +64,8 @@
60
64
  "required": false,
61
65
  "schema": {
62
66
  "type": "string",
63
- "format": "date"
67
+ "format": "date",
68
+ "example": "2024-01-01"
64
69
  },
65
70
  "description": "A date parameter in YYYY-MM-DD format"
66
71
  }
@@ -74,24 +79,29 @@
74
79
  "type": "object",
75
80
  "properties": {
76
81
  "name": {
77
- "type": "string"
82
+ "type": "string",
83
+ "example": "John Doe"
78
84
  },
79
85
  "age": {
80
86
  "type": "integer",
81
- "format": "int32"
87
+ "format": "int32",
88
+ "example": 25
82
89
  },
83
90
  "isActive": {
84
- "type": "boolean"
91
+ "type": "boolean",
92
+ "example": true
85
93
  },
86
94
  "tags": {
87
95
  "type": "array",
88
96
  "items": {
89
- "type": "string"
97
+ "type": "string",
98
+ "example": "tag1"
90
99
  }
91
100
  },
92
101
  "date": {
93
102
  "type": "string",
94
- "format": "date"
103
+ "format": "date",
104
+ "example": "2024-01-01"
95
105
  }
96
106
  }
97
107
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.2.6
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,11 +1,17 @@
1
1
  import { ExampleAPIClient } from './exampleAPI.ts'
2
2
 
3
3
  const baseUrl = '<BASE_URL>'
4
- const client = new ExampleAPIClient({ baseUrl })
4
+ const exampleAPIClient = new ExampleAPIClient({ baseUrl })
5
5
 
6
6
  export default function () {
7
+ let params
8
+
7
9
  /**
8
10
  * Get example data
9
11
  */
10
- const getExampleDataResponseData = client.getExampleData(params)
12
+ params = {
13
+ name: 'John Doe',
14
+ }
15
+
16
+ const getExampleDataResponseData = exampleAPIClient.getExampleData(params)
11
17
  }
@@ -1,16 +1,16 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.2.6
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.2.6
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,11 +1,17 @@
1
1
  import { ExampleAPIClient } from './exampleAPI.ts'
2
2
 
3
3
  const baseUrl = '<BASE_URL>'
4
- const client = new ExampleAPIClient({ baseUrl })
4
+ const exampleAPIClient = new ExampleAPIClient({ baseUrl })
5
5
 
6
6
  export default function () {
7
+ let params
8
+
7
9
  /**
8
10
  * Get example data
9
11
  */
10
- const getExampleDataResponseData = client.getExampleData(params)
12
+ params = {
13
+ name: 'John Doe',
14
+ }
15
+
16
+ const getExampleDataResponseData = exampleAPIClient.getExampleData(params)
11
17
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Automatically generated by @grafana/openapi-to-k6: 0.2.6
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.2.6
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,11 +1,17 @@
1
- import { ExampleAPIClient } from './exampleAPI.ts'
1
+ import { DefaultClient } from './default.ts'
2
2
 
3
3
  const baseUrl = '<BASE_URL>'
4
- const client = new ExampleAPIClient({ baseUrl })
4
+ const defaultClient = new DefaultClient({ baseUrl })
5
5
 
6
6
  export default function () {
7
+ let params
8
+
7
9
  /**
8
10
  * Get example data
9
11
  */
10
- const getExampleDataResponseData = client.getExampleData(params)
12
+ params = {
13
+ name: 'John Doe',
14
+ }
15
+
16
+ const getExampleDataResponseData = defaultClient.getExampleData(params)
11
17
  }
@@ -20,39 +20,46 @@
20
20
  "properties": {
21
21
  "name": {
22
22
  "type": "string",
23
- "description": "A string parameter"
23
+ "description": "A string parameter",
24
+ "example": "John Doe"
24
25
  },
25
26
  "age": {
26
27
  "type": "integer",
27
28
  "format": "int32",
28
- "description": "An integer parameter"
29
+ "description": "An integer parameter",
30
+ "example": 25
29
31
  },
30
32
  "isActive": {
31
33
  "type": "boolean",
32
- "description": "A boolean parameter"
34
+ "description": "A boolean parameter",
35
+ "example": true
33
36
  },
34
37
  "tags": {
35
38
  "type": "array",
36
39
  "items": {
37
40
  "type": "string"
38
41
  },
39
- "description": "An array of strings"
42
+ "description": "An array of strings",
43
+ "example": ["tag1", "tag2"]
40
44
  },
41
45
  "date": {
42
46
  "type": "string",
43
47
  "format": "date",
44
- "description": "A date parameter in YYYY-MM-DD format"
48
+ "description": "A date parameter in YYYY-MM-DD format",
49
+ "example": "2024-01-01"
45
50
  },
46
51
  "meta": {
47
52
  "type": "object",
48
53
  "properties": {
49
54
  "createdBy": {
50
55
  "type": "string",
51
- "description": "A string parameter for the creator's name"
56
+ "description": "A string parameter for the creator's name",
57
+ "example": "John Doe"
52
58
  },
53
59
  "updatedBy": {
54
60
  "type": "string",
55
- "description": "A string parameter for the updater's name"
61
+ "description": "A string parameter for the updater's name",
62
+ "example": "Jane Doe"
56
63
  }
57
64
  },
58
65
  "description": "An object parameter containing metadata"
@@ -77,36 +84,44 @@
77
84
  "properties": {
78
85
  "id": {
79
86
  "type": "string",
80
- "description": "The unique ID of the created resource"
87
+ "description": "The unique ID of the created resource",
88
+ "example": "12345"
81
89
  },
82
90
  "name": {
83
- "type": "string"
91
+ "type": "string",
92
+ "example": "John Doe"
84
93
  },
85
94
  "age": {
86
95
  "type": "integer",
87
- "format": "int32"
96
+ "format": "int32",
97
+ "example": 25
88
98
  },
89
99
  "isActive": {
90
- "type": "boolean"
100
+ "type": "boolean",
101
+ "example": true
91
102
  },
92
103
  "tags": {
93
104
  "type": "array",
94
105
  "items": {
95
- "type": "string"
106
+ "type": "string",
107
+ "example": ["tag1", "tag2"]
96
108
  }
97
109
  },
98
110
  "date": {
99
111
  "type": "string",
100
- "format": "date"
112
+ "format": "date",
113
+ "example": "2024-01-01"
101
114
  },
102
115
  "meta": {
103
116
  "type": "object",
104
117
  "properties": {
105
118
  "createdBy": {
106
- "type": "string"
119
+ "type": "string",
120
+ "example": "John Doe"
107
121
  },
108
122
  "updatedBy": {
109
- "type": "string"
123
+ "type": "string",
124
+ "example": "Jane Doe"
110
125
  }
111
126
  }
112
127
  }