@grafana/openapi-to-k6 0.2.6 → 0.3.0

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 (116) hide show
  1. package/README.md +5 -1
  2. package/dist/constants.js +7 -3
  3. package/dist/generator/k6Client.js +5 -55
  4. package/dist/generator/k6ScriptBuilder.js +256 -0
  5. package/examples/basic_schema/single/k6-script.sample.ts +3 -2
  6. package/examples/basic_schema/single/simpleAPI.ts +1 -1
  7. package/examples/basic_schema/split/k6-script.sample.ts +3 -2
  8. package/examples/basic_schema/split/simpleAPI.schemas.ts +1 -1
  9. package/examples/basic_schema/split/simpleAPI.ts +1 -1
  10. package/examples/basic_schema/tags/default.ts +1 -1
  11. package/examples/basic_schema/tags/k6-script.sample.ts +4 -3
  12. package/examples/basic_schema/tags/simpleAPI.schemas.ts +1 -1
  13. package/examples/form_data_schema/schema.json +6 -3
  14. package/examples/form_data_schema/single/formDataAPI.ts +1 -1
  15. package/examples/form_data_schema/single/k6-script.sample.ts +10 -2
  16. package/examples/form_data_schema/split/formDataAPI.schemas.ts +1 -1
  17. package/examples/form_data_schema/split/formDataAPI.ts +1 -1
  18. package/examples/form_data_schema/split/k6-script.sample.ts +10 -2
  19. package/examples/form_data_schema/tags/default.ts +1 -1
  20. package/examples/form_data_schema/tags/formDataAPI.schemas.ts +1 -1
  21. package/examples/form_data_schema/tags/k6-script.sample.ts +11 -3
  22. package/examples/form_url_encoded_data_schema/schema.json +6 -3
  23. package/examples/form_url_encoded_data_schema/single/formURLEncodedAPI.ts +1 -1
  24. package/examples/form_url_encoded_data_schema/single/k6-script.sample.ts +11 -2
  25. package/examples/form_url_encoded_data_schema/split/formURLEncodedAPI.schemas.ts +1 -1
  26. package/examples/form_url_encoded_data_schema/split/formURLEncodedAPI.ts +1 -1
  27. package/examples/form_url_encoded_data_schema/split/k6-script.sample.ts +11 -2
  28. package/examples/form_url_encoded_data_schema/tags/default.ts +1 -1
  29. package/examples/form_url_encoded_data_schema/tags/formURLEncodedAPI.schemas.ts +1 -1
  30. package/examples/form_url_encoded_data_schema/tags/k6-script.sample.ts +12 -3
  31. package/examples/form_url_encoded_data_with_query_params_schema/schema.json +8 -4
  32. package/examples/form_url_encoded_data_with_query_params_schema/single/formURLEncodedAPIWithQueryParameters.ts +1 -1
  33. package/examples/form_url_encoded_data_with_query_params_schema/single/k6-script.sample.ts +19 -6
  34. package/examples/form_url_encoded_data_with_query_params_schema/split/formURLEncodedAPIWithQueryParameters.schemas.ts +1 -1
  35. package/examples/form_url_encoded_data_with_query_params_schema/split/formURLEncodedAPIWithQueryParameters.ts +1 -1
  36. package/examples/form_url_encoded_data_with_query_params_schema/split/k6-script.sample.ts +19 -6
  37. package/examples/form_url_encoded_data_with_query_params_schema/tags/default.ts +1 -1
  38. package/examples/form_url_encoded_data_with_query_params_schema/tags/formURLEncodedAPIWithQueryParameters.schemas.ts +1 -1
  39. package/examples/form_url_encoded_data_with_query_params_schema/tags/k6-script.sample.ts +14 -3
  40. package/examples/get_request_with_path_parameters_schema/schema.json +2 -1
  41. package/examples/get_request_with_path_parameters_schema/single/k6-script.sample.ts +6 -2
  42. package/examples/get_request_with_path_parameters_schema/single/simpleAPI.ts +1 -1
  43. package/examples/get_request_with_path_parameters_schema/split/k6-script.sample.ts +6 -2
  44. package/examples/get_request_with_path_parameters_schema/split/simpleAPI.schemas.ts +1 -1
  45. package/examples/get_request_with_path_parameters_schema/split/simpleAPI.ts +1 -1
  46. package/examples/get_request_with_path_parameters_schema/tags/default.ts +1 -1
  47. package/examples/get_request_with_path_parameters_schema/tags/k6-script.sample.ts +7 -3
  48. package/examples/get_request_with_path_parameters_schema/tags/simpleAPI.schemas.ts +1 -1
  49. package/examples/headers_schema/schema.json +2 -1
  50. package/examples/headers_schema/single/headerDemoAPI.ts +1 -1
  51. package/examples/headers_schema/single/k6-script.sample.ts +15 -4
  52. package/examples/headers_schema/split/headerDemoAPI.schemas.ts +1 -1
  53. package/examples/headers_schema/split/headerDemoAPI.ts +1 -1
  54. package/examples/headers_schema/split/k6-script.sample.ts +15 -4
  55. package/examples/headers_schema/tags/default.ts +1 -1
  56. package/examples/headers_schema/tags/headerDemoAPI.schemas.ts +1 -1
  57. package/examples/headers_schema/tags/k6-script.sample.ts +16 -5
  58. package/examples/no_title_schema/single/k6-script.sample.ts +3 -2
  59. package/examples/no_title_schema/single/k6Client.ts +1 -1
  60. package/examples/no_title_schema/split/k6-script.sample.ts +3 -2
  61. package/examples/no_title_schema/split/k6Client.schemas.ts +1 -1
  62. package/examples/no_title_schema/split/k6Client.ts +1 -1
  63. package/examples/no_title_schema/tags/default.ts +1 -1
  64. package/examples/no_title_schema/tags/k6-script.sample.ts +4 -3
  65. package/examples/no_title_schema/tags/k6Client.schemas.ts +1 -1
  66. package/examples/post_request_with_query_params/schema.json +14 -7
  67. package/examples/post_request_with_query_params/single/exampleAPI.ts +1 -1
  68. package/examples/post_request_with_query_params/single/k6-script.sample.ts +11 -2
  69. package/examples/post_request_with_query_params/split/exampleAPI.schemas.ts +1 -1
  70. package/examples/post_request_with_query_params/split/exampleAPI.ts +1 -1
  71. package/examples/post_request_with_query_params/split/k6-script.sample.ts +11 -2
  72. package/examples/post_request_with_query_params/tags/default.ts +1 -1
  73. package/examples/post_request_with_query_params/tags/exampleAPI.schemas.ts +1 -1
  74. package/examples/post_request_with_query_params/tags/k6-script.sample.ts +12 -3
  75. package/examples/query_params_schema/schema.json +20 -10
  76. package/examples/query_params_schema/single/exampleAPI.ts +1 -1
  77. package/examples/query_params_schema/single/k6-script.sample.ts +8 -2
  78. package/examples/query_params_schema/split/exampleAPI.schemas.ts +1 -1
  79. package/examples/query_params_schema/split/exampleAPI.ts +1 -1
  80. package/examples/query_params_schema/split/k6-script.sample.ts +8 -2
  81. package/examples/query_params_schema/tags/default.ts +1 -1
  82. package/examples/query_params_schema/tags/exampleAPI.schemas.ts +1 -1
  83. package/examples/query_params_schema/tags/k6-script.sample.ts +9 -3
  84. package/examples/simple_post_request_schema/schema.json +30 -15
  85. package/examples/simple_post_request_schema/single/exampleAPI.ts +1 -1
  86. package/examples/simple_post_request_schema/single/k6-script.sample.ts +16 -2
  87. package/examples/simple_post_request_schema/split/exampleAPI.schemas.ts +1 -1
  88. package/examples/simple_post_request_schema/split/exampleAPI.ts +1 -1
  89. package/examples/simple_post_request_schema/split/k6-script.sample.ts +16 -2
  90. package/examples/simple_post_request_schema/tags/default.ts +1 -1
  91. package/examples/simple_post_request_schema/tags/exampleAPI.schemas.ts +1 -1
  92. package/examples/simple_post_request_schema/tags/k6-script.sample.ts +17 -3
  93. package/package.json +3 -1
  94. package/src/constants.ts +7 -3
  95. package/src/generator/k6Client.ts +3 -72
  96. package/src/generator/k6ScriptBuilder.ts +328 -0
  97. package/tests/e2e/schema.json +135 -18
  98. package/tests/functional-tests/helper.ts +16 -0
  99. package/tests/functional-tests/test-generator/generator.test.ts +154 -0
  100. package/tests/functional-tests/test-sample-k6-scripts/fixtures/schema_using_ref_models.json +394 -0
  101. package/tests/functional-tests/test-sample-k6-scripts/fixtures/schema_with_examples.json +416 -0
  102. package/tests/functional-tests/test-sample-k6-scripts/fixtures/schema_with_no_variables.json +32 -0
  103. package/tests/functional-tests/test-sample-k6-scripts/sampleK6Scripts.test.ts +248 -0
  104. package/tests/functional-tests/test-tags-filtering/tagsFiltering.test.ts +166 -0
  105. package/tests/functional-tests/generator.test.ts +0 -319
  106. /package/tests/functional-tests/{fixtures/schemas → test-generator/fixtures}/basic_schema.json +0 -0
  107. /package/tests/functional-tests/{fixtures/schemas → test-generator/fixtures}/form_data_schema.json +0 -0
  108. /package/tests/functional-tests/{fixtures/schemas → test-generator/fixtures}/form_url_encoded_data_schema.json +0 -0
  109. /package/tests/functional-tests/{fixtures/schemas → test-generator/fixtures}/form_url_encoded_data_with_query_params_schema.json +0 -0
  110. /package/tests/functional-tests/{fixtures/schemas → test-generator/fixtures}/get_request_with_path_parameters_schema.json +0 -0
  111. /package/tests/functional-tests/{fixtures/schemas → test-generator/fixtures}/headers_schema.json +0 -0
  112. /package/tests/functional-tests/{fixtures/schemas → test-generator/fixtures}/no_title_schema.json +0 -0
  113. /package/tests/functional-tests/{fixtures/schemas → test-generator/fixtures}/post_request_with_query_params.json +0 -0
  114. /package/tests/functional-tests/{fixtures/schemas → test-generator/fixtures}/query_params_schema.json +0 -0
  115. /package/tests/functional-tests/{fixtures/schemas → test-generator/fixtures}/simple_post_request_schema.json +0 -0
  116. /package/tests/functional-tests/{fixtures → test-tags-filtering/fixtures}/tags_filtering.json +0 -0
@@ -1,11 +1,20 @@
1
1
  import { FormURLEncodedAPIClient } from './formURLEncodedAPI.ts'
2
2
 
3
3
  const baseUrl = '<BASE_URL>'
4
- const client = new FormURLEncodedAPIClient({ baseUrl })
4
+ const formURLEncodedAPIClient = new FormURLEncodedAPIClient({ baseUrl })
5
5
 
6
6
  export default function () {
7
+ let postSubmitFormBody
8
+
7
9
  /**
8
10
  * Submit form data
9
11
  */
10
- const postSubmitFormResponseData = client.postSubmitForm(postSubmitFormBody)
12
+ postSubmitFormBody = {
13
+ name: 'John Doe',
14
+ age: '25',
15
+ email: 'john.doe@example.com',
16
+ }
17
+
18
+ const postSubmitFormResponseData =
19
+ formURLEncodedAPIClient.postSubmitForm(postSubmitFormBody)
11
20
  }
@@ -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.0
3
3
  * Do not edit manually.
4
4
  * Form URL Encoded API
5
5
  * Service version: 1.0.0
@@ -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.0
3
3
  * Do not edit manually.
4
4
  * Form URL Encoded API
5
5
  * Service version: 1.0.0
@@ -1,11 +1,20 @@
1
1
  import { FormURLEncodedAPIClient } from './formURLEncodedAPI.ts'
2
2
 
3
3
  const baseUrl = '<BASE_URL>'
4
- const client = new FormURLEncodedAPIClient({ baseUrl })
4
+ const formURLEncodedAPIClient = new FormURLEncodedAPIClient({ baseUrl })
5
5
 
6
6
  export default function () {
7
+ let postSubmitFormBody
8
+
7
9
  /**
8
10
  * Submit form data
9
11
  */
10
- const postSubmitFormResponseData = client.postSubmitForm(postSubmitFormBody)
12
+ postSubmitFormBody = {
13
+ name: 'John Doe',
14
+ age: '25',
15
+ email: 'john.doe@example.com',
16
+ }
17
+
18
+ const postSubmitFormResponseData =
19
+ formURLEncodedAPIClient.postSubmitForm(postSubmitFormBody)
11
20
  }
@@ -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.0
3
3
  * Do not edit manually.
4
4
  * Form URL Encoded API
5
5
  * Service version: 1.0.0
@@ -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.0
3
3
  * Do not edit manually.
4
4
  * Form URL Encoded API
5
5
  * Service version: 1.0.0
@@ -1,11 +1,20 @@
1
- import { FormURLEncodedAPIClient } from './formURLEncodedAPI.ts'
1
+ import { DefaultClient } from './default.ts'
2
2
 
3
3
  const baseUrl = '<BASE_URL>'
4
- const client = new FormURLEncodedAPIClient({ baseUrl })
4
+ const defaultClient = new DefaultClient({ baseUrl })
5
5
 
6
6
  export default function () {
7
+ let postSubmitFormBody
8
+
7
9
  /**
8
10
  * Submit form data
9
11
  */
10
- const postSubmitFormResponseData = client.postSubmitForm(postSubmitFormBody)
12
+ postSubmitFormBody = {
13
+ name: 'John Doe',
14
+ age: '25',
15
+ email: 'john.doe@example.com',
16
+ }
17
+
18
+ const postSubmitFormResponseData =
19
+ defaultClient.postSubmitForm(postSubmitFormBody)
11
20
  }
@@ -16,7 +16,8 @@
16
16
  "required": true,
17
17
  "description": "Authentication token",
18
18
  "schema": {
19
- "type": "string"
19
+ "type": "string",
20
+ "example": "Bearer abcdef12345"
20
21
  }
21
22
  },
22
23
  {
@@ -39,16 +40,19 @@
39
40
  "properties": {
40
41
  "name": {
41
42
  "type": "string",
42
- "description": "Name of the user"
43
+ "description": "Name of the user",
44
+ "example": "John Doe"
43
45
  },
44
46
  "age": {
45
47
  "type": "integer",
46
- "description": "Age of the user"
48
+ "description": "Age of the user",
49
+ "example": 25
47
50
  },
48
51
  "email": {
49
52
  "type": "string",
50
53
  "format": "email",
51
- "description": "Email address of the user"
54
+ "description": "Email address of the user",
55
+ "example": "john.doe@example.com"
52
56
  }
53
57
  },
54
58
  "required": [
@@ -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.0
3
3
  * Do not edit manually.
4
4
  * Form URL Encoded API with Query Parameters
5
5
  * Service version: 1.0.0
@@ -1,14 +1,27 @@
1
- import { FormURLEncodedAPIwithQueryParametersClient } from './formURLEncodedAPIWithQueryParameters.ts'
1
+ import { FormURLEncodedAPIWithQueryParametersClient } from './formURLEncodedAPIWithQueryParameters.ts'
2
2
 
3
3
  const baseUrl = '<BASE_URL>'
4
- const client = new FormURLEncodedAPIwithQueryParametersClient({ baseUrl })
4
+ const formURLEncodedAPIWithQueryParametersClient =
5
+ new FormURLEncodedAPIWithQueryParametersClient({ baseUrl })
5
6
 
6
7
  export default function () {
8
+ let postSubmitFormBody, params
9
+
7
10
  /**
8
11
  * Submit form data with query parameters
9
12
  */
10
- const postSubmitFormResponseData = client.postSubmitForm(
11
- postSubmitFormBody,
12
- params
13
- )
13
+ postSubmitFormBody = {
14
+ name: 'John Doe',
15
+ age: '25',
16
+ email: 'john.doe@example.com',
17
+ }
18
+ params = {
19
+ token: 'Bearer abcdef12345',
20
+ }
21
+
22
+ const postSubmitFormResponseData =
23
+ formURLEncodedAPIWithQueryParametersClient.postSubmitForm(
24
+ postSubmitFormBody,
25
+ params
26
+ )
14
27
  }
@@ -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.0
3
3
  * Do not edit manually.
4
4
  * Form URL Encoded API with Query Parameters
5
5
  * Service version: 1.0.0
@@ -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.0
3
3
  * Do not edit manually.
4
4
  * Form URL Encoded API with Query Parameters
5
5
  * Service version: 1.0.0
@@ -1,14 +1,27 @@
1
- import { FormURLEncodedAPIwithQueryParametersClient } from './formURLEncodedAPIWithQueryParameters.ts'
1
+ import { FormURLEncodedAPIWithQueryParametersClient } from './formURLEncodedAPIWithQueryParameters.ts'
2
2
 
3
3
  const baseUrl = '<BASE_URL>'
4
- const client = new FormURLEncodedAPIwithQueryParametersClient({ baseUrl })
4
+ const formURLEncodedAPIWithQueryParametersClient =
5
+ new FormURLEncodedAPIWithQueryParametersClient({ baseUrl })
5
6
 
6
7
  export default function () {
8
+ let postSubmitFormBody, params
9
+
7
10
  /**
8
11
  * Submit form data with query parameters
9
12
  */
10
- const postSubmitFormResponseData = client.postSubmitForm(
11
- postSubmitFormBody,
12
- params
13
- )
13
+ postSubmitFormBody = {
14
+ name: 'John Doe',
15
+ age: '25',
16
+ email: 'john.doe@example.com',
17
+ }
18
+ params = {
19
+ token: 'Bearer abcdef12345',
20
+ }
21
+
22
+ const postSubmitFormResponseData =
23
+ formURLEncodedAPIWithQueryParametersClient.postSubmitForm(
24
+ postSubmitFormBody,
25
+ params
26
+ )
14
27
  }
@@ -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.0
3
3
  * Do not edit manually.
4
4
  * Form URL Encoded API with Query Parameters
5
5
  * Service version: 1.0.0
@@ -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.0
3
3
  * Do not edit manually.
4
4
  * Form URL Encoded API with Query Parameters
5
5
  * Service version: 1.0.0
@@ -1,13 +1,24 @@
1
- import { FormURLEncodedAPIwithQueryParametersClient } from './formURLEncodedAPIWithQueryParameters.ts'
1
+ import { DefaultClient } from './default.ts'
2
2
 
3
3
  const baseUrl = '<BASE_URL>'
4
- const client = new FormURLEncodedAPIwithQueryParametersClient({ baseUrl })
4
+ const defaultClient = new DefaultClient({ baseUrl })
5
5
 
6
6
  export default function () {
7
+ let postSubmitFormBody, params
8
+
7
9
  /**
8
10
  * Submit form data with query parameters
9
11
  */
10
- const postSubmitFormResponseData = client.postSubmitForm(
12
+ postSubmitFormBody = {
13
+ name: 'John Doe',
14
+ age: '25',
15
+ email: 'john.doe@example.com',
16
+ }
17
+ params = {
18
+ token: 'Bearer abcdef12345',
19
+ }
20
+
21
+ const postSubmitFormResponseData = defaultClient.postSubmitForm(
11
22
  postSubmitFormBody,
12
23
  params
13
24
  )
@@ -18,7 +18,8 @@
18
18
  "required": true,
19
19
  "description": "ID of the item to retrieve",
20
20
  "schema": {
21
- "type": "string"
21
+ "type": "string",
22
+ "example": "12345"
22
23
  }
23
24
  }
24
25
  ],
@@ -1,11 +1,15 @@
1
1
  import { SimpleAPIClient } from './simpleAPI.ts'
2
2
 
3
3
  const baseUrl = '<BASE_URL>'
4
- const client = new SimpleAPIClient({ baseUrl })
4
+ const simpleAPIClient = new SimpleAPIClient({ baseUrl })
5
5
 
6
6
  export default function () {
7
+ let id
8
+
7
9
  /**
8
10
  * Get an item by its ID
9
11
  */
10
- const getItemByIdResponseData = client.getItemById(id)
12
+ id = '12345'
13
+
14
+ const getItemByIdResponseData = simpleAPIClient.getItemById(id)
11
15
  }
@@ -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.0
3
3
  * Do not edit manually.
4
4
  * Simple API
5
5
  * An API with a single GET request that takes a path parameter
@@ -1,11 +1,15 @@
1
1
  import { SimpleAPIClient } from './simpleAPI.ts'
2
2
 
3
3
  const baseUrl = '<BASE_URL>'
4
- const client = new SimpleAPIClient({ baseUrl })
4
+ const simpleAPIClient = new SimpleAPIClient({ baseUrl })
5
5
 
6
6
  export default function () {
7
+ let id
8
+
7
9
  /**
8
10
  * Get an item by its ID
9
11
  */
10
- const getItemByIdResponseData = client.getItemById(id)
12
+ id = '12345'
13
+
14
+ const getItemByIdResponseData = simpleAPIClient.getItemById(id)
11
15
  }
@@ -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.0
3
3
  * Do not edit manually.
4
4
  * Simple API
5
5
  * An API with a single GET request that takes a path parameter
@@ -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.0
3
3
  * Do not edit manually.
4
4
  * Simple API
5
5
  * An API with a single GET request that takes a path parameter
@@ -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.0
3
3
  * Do not edit manually.
4
4
  * Simple API
5
5
  * An API with a single GET request that takes a path parameter
@@ -1,11 +1,15 @@
1
- import { SimpleAPIClient } from './simpleAPI.ts'
1
+ import { DefaultClient } from './default.ts'
2
2
 
3
3
  const baseUrl = '<BASE_URL>'
4
- const client = new SimpleAPIClient({ baseUrl })
4
+ const defaultClient = new DefaultClient({ baseUrl })
5
5
 
6
6
  export default function () {
7
+ let id
8
+
7
9
  /**
8
10
  * Get an item by its ID
9
11
  */
10
- const getItemByIdResponseData = client.getItemById(id)
12
+ id = '12345'
13
+
14
+ const getItemByIdResponseData = defaultClient.getItemById(id)
11
15
  }
@@ -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.0
3
3
  * Do not edit manually.
4
4
  * Simple API
5
5
  * An API with a single GET request that takes a path parameter
@@ -74,7 +74,8 @@
74
74
  "type": "object",
75
75
  "properties": {
76
76
  "data": {
77
- "type": "string"
77
+ "type": "string",
78
+ "example": "redevelop"
78
79
  }
79
80
  }
80
81
  }
@@ -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.0
3
3
  * Do not edit manually.
4
4
  * Header Demo API
5
5
  * An API demonstrating the use of headers in different ways
@@ -1,18 +1,28 @@
1
1
  import { HeaderDemoAPIClient } from './headerDemoAPI.ts'
2
2
 
3
3
  const baseUrl = '<BASE_URL>'
4
- const client = new HeaderDemoAPIClient({ baseUrl })
4
+ const headerDemoAPIClient = new HeaderDemoAPIClient({ baseUrl })
5
5
 
6
6
  export default function () {
7
+ let postExamplePostBody, headers
8
+
7
9
  /**
8
10
  * GET request with headers
9
11
  */
10
- const getExampleGetResponseData = client.getExampleGet()
12
+
13
+ const getExampleGetResponseData = headerDemoAPIClient.getExampleGet()
11
14
 
12
15
  /**
13
16
  * POST request with security headers
14
17
  */
15
- const postExamplePostResponseData = client.postExamplePost(
18
+ postExamplePostBody = {
19
+ data: 'redevelop',
20
+ }
21
+ headers = {
22
+ Authorization: 'Bearer <token>',
23
+ }
24
+
25
+ const postExamplePostResponseData = headerDemoAPIClient.postExamplePost(
16
26
  postExamplePostBody,
17
27
  headers
18
28
  )
@@ -20,6 +30,7 @@ export default function () {
20
30
  /**
21
31
  * GET request with response headers only
22
32
  */
33
+
23
34
  const getExampleResponseHeadersResponseData =
24
- client.getExampleResponseHeaders()
35
+ headerDemoAPIClient.getExampleResponseHeaders()
25
36
  }
@@ -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.0
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.2.6
2
+ * Automatically generated by @grafana/openapi-to-k6: 0.3.0
3
3
  * Do not edit manually.
4
4
  * Header Demo API
5
5
  * An API demonstrating the use of headers in different ways
@@ -1,18 +1,28 @@
1
1
  import { HeaderDemoAPIClient } from './headerDemoAPI.ts'
2
2
 
3
3
  const baseUrl = '<BASE_URL>'
4
- const client = new HeaderDemoAPIClient({ baseUrl })
4
+ const headerDemoAPIClient = new HeaderDemoAPIClient({ baseUrl })
5
5
 
6
6
  export default function () {
7
+ let postExamplePostBody, headers
8
+
7
9
  /**
8
10
  * GET request with headers
9
11
  */
10
- const getExampleGetResponseData = client.getExampleGet()
12
+
13
+ const getExampleGetResponseData = headerDemoAPIClient.getExampleGet()
11
14
 
12
15
  /**
13
16
  * POST request with security headers
14
17
  */
15
- const postExamplePostResponseData = client.postExamplePost(
18
+ postExamplePostBody = {
19
+ data: 'redevelop',
20
+ }
21
+ headers = {
22
+ Authorization: 'Bearer <token>',
23
+ }
24
+
25
+ const postExamplePostResponseData = headerDemoAPIClient.postExamplePost(
16
26
  postExamplePostBody,
17
27
  headers
18
28
  )
@@ -20,6 +30,7 @@ export default function () {
20
30
  /**
21
31
  * GET request with response headers only
22
32
  */
33
+
23
34
  const getExampleResponseHeadersResponseData =
24
- client.getExampleResponseHeaders()
35
+ headerDemoAPIClient.getExampleResponseHeaders()
25
36
  }
@@ -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.0
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.2.6
2
+ * Automatically generated by @grafana/openapi-to-k6: 0.3.0
3
3
  * Do not edit manually.
4
4
  * Header Demo API
5
5
  * An API demonstrating the use of headers in different ways
@@ -1,18 +1,28 @@
1
- import { HeaderDemoAPIClient } from './headerDemoAPI.ts'
1
+ import { DefaultClient } from './default.ts'
2
2
 
3
3
  const baseUrl = '<BASE_URL>'
4
- const client = new HeaderDemoAPIClient({ baseUrl })
4
+ const defaultClient = new DefaultClient({ baseUrl })
5
5
 
6
6
  export default function () {
7
+ let postExamplePostBody, headers
8
+
7
9
  /**
8
10
  * GET request with headers
9
11
  */
10
- const getExampleGetResponseData = client.getExampleGet()
12
+
13
+ const getExampleGetResponseData = defaultClient.getExampleGet()
11
14
 
12
15
  /**
13
16
  * POST request with security headers
14
17
  */
15
- const postExamplePostResponseData = client.postExamplePost(
18
+ postExamplePostBody = {
19
+ data: 'redevelop',
20
+ }
21
+ headers = {
22
+ Authorization: 'Bearer <token>',
23
+ }
24
+
25
+ const postExamplePostResponseData = defaultClient.postExamplePost(
16
26
  postExamplePostBody,
17
27
  headers
18
28
  )
@@ -20,6 +30,7 @@ export default function () {
20
30
  /**
21
31
  * GET request with response headers only
22
32
  */
33
+
23
34
  const getExampleResponseHeadersResponseData =
24
- client.getExampleResponseHeaders()
35
+ defaultClient.getExampleResponseHeaders()
25
36
  }
@@ -1,11 +1,12 @@
1
1
  import { K6ClientClient } from './k6Client.ts'
2
2
 
3
3
  const baseUrl = '<BASE_URL>'
4
- const client = new K6ClientClient({ baseUrl })
4
+ const k6ClientClient = new K6ClientClient({ 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 = k6ClientClient.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.0
3
3
  * Do not edit manually.
4
4
  * K6Client
5
5
  * Service version: 1.0.0
@@ -1,11 +1,12 @@
1
1
  import { K6ClientClient } from './k6Client.ts'
2
2
 
3
3
  const baseUrl = '<BASE_URL>'
4
- const client = new K6ClientClient({ baseUrl })
4
+ const k6ClientClient = new K6ClientClient({ 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 = k6ClientClient.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.0
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.2.6
2
+ * Automatically generated by @grafana/openapi-to-k6: 0.3.0
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.2.6
2
+ * Automatically generated by @grafana/openapi-to-k6: 0.3.0
3
3
  * Do not edit manually.
4
4
  * K6Client
5
5
  * Service version: 1.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
  }