@grafana/openapi-to-k6 0.2.5 → 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.
- package/.github/workflows/tests.yaml +1 -0
- package/README.md +10 -4
- package/dist/cli.js +27 -12
- package/dist/constants.js +7 -3
- package/dist/errors.js +10 -0
- package/dist/generator/index.js +50 -3
- package/dist/generator/k6Client.js +5 -55
- package/dist/generator/k6ScriptBuilder.js +256 -0
- package/dist/helper.js +32 -0
- package/examples/basic_schema/single/k6-script.sample.ts +3 -2
- package/examples/basic_schema/single/simpleAPI.ts +1 -1
- package/examples/basic_schema/split/k6-script.sample.ts +3 -2
- package/examples/basic_schema/split/simpleAPI.schemas.ts +1 -1
- package/examples/basic_schema/split/simpleAPI.ts +1 -1
- package/examples/basic_schema/tags/default.ts +1 -1
- package/examples/basic_schema/tags/k6-script.sample.ts +4 -3
- package/examples/basic_schema/tags/simpleAPI.schemas.ts +1 -1
- package/examples/form_data_schema/schema.json +6 -3
- package/examples/form_data_schema/single/formDataAPI.ts +1 -1
- package/examples/form_data_schema/single/k6-script.sample.ts +10 -2
- package/examples/form_data_schema/split/formDataAPI.schemas.ts +1 -1
- package/examples/form_data_schema/split/formDataAPI.ts +1 -1
- package/examples/form_data_schema/split/k6-script.sample.ts +10 -2
- package/examples/form_data_schema/tags/default.ts +1 -1
- package/examples/form_data_schema/tags/formDataAPI.schemas.ts +1 -1
- package/examples/form_data_schema/tags/k6-script.sample.ts +11 -3
- package/examples/form_url_encoded_data_schema/schema.json +6 -3
- package/examples/form_url_encoded_data_schema/single/formURLEncodedAPI.ts +1 -1
- package/examples/form_url_encoded_data_schema/single/k6-script.sample.ts +11 -2
- package/examples/form_url_encoded_data_schema/split/formURLEncodedAPI.schemas.ts +1 -1
- package/examples/form_url_encoded_data_schema/split/formURLEncodedAPI.ts +1 -1
- package/examples/form_url_encoded_data_schema/split/k6-script.sample.ts +11 -2
- package/examples/form_url_encoded_data_schema/tags/default.ts +1 -1
- package/examples/form_url_encoded_data_schema/tags/formURLEncodedAPI.schemas.ts +1 -1
- package/examples/form_url_encoded_data_schema/tags/k6-script.sample.ts +12 -3
- package/examples/form_url_encoded_data_with_query_params_schema/schema.json +8 -4
- package/examples/form_url_encoded_data_with_query_params_schema/single/formURLEncodedAPIWithQueryParameters.ts +1 -1
- package/examples/form_url_encoded_data_with_query_params_schema/single/k6-script.sample.ts +19 -6
- package/examples/form_url_encoded_data_with_query_params_schema/split/formURLEncodedAPIWithQueryParameters.schemas.ts +1 -1
- package/examples/form_url_encoded_data_with_query_params_schema/split/formURLEncodedAPIWithQueryParameters.ts +1 -1
- package/examples/form_url_encoded_data_with_query_params_schema/split/k6-script.sample.ts +19 -6
- package/examples/form_url_encoded_data_with_query_params_schema/tags/default.ts +1 -1
- package/examples/form_url_encoded_data_with_query_params_schema/tags/formURLEncodedAPIWithQueryParameters.schemas.ts +1 -1
- package/examples/form_url_encoded_data_with_query_params_schema/tags/k6-script.sample.ts +14 -3
- package/examples/get_request_with_path_parameters_schema/schema.json +2 -1
- package/examples/get_request_with_path_parameters_schema/single/k6-script.sample.ts +6 -2
- package/examples/get_request_with_path_parameters_schema/single/simpleAPI.ts +1 -1
- package/examples/get_request_with_path_parameters_schema/split/k6-script.sample.ts +6 -2
- package/examples/get_request_with_path_parameters_schema/split/simpleAPI.schemas.ts +1 -1
- package/examples/get_request_with_path_parameters_schema/split/simpleAPI.ts +1 -1
- package/examples/get_request_with_path_parameters_schema/tags/default.ts +1 -1
- package/examples/get_request_with_path_parameters_schema/tags/k6-script.sample.ts +7 -3
- package/examples/get_request_with_path_parameters_schema/tags/simpleAPI.schemas.ts +1 -1
- package/examples/headers_schema/schema.json +2 -1
- package/examples/headers_schema/single/headerDemoAPI.ts +1 -1
- package/examples/headers_schema/single/k6-script.sample.ts +15 -4
- package/examples/headers_schema/split/headerDemoAPI.schemas.ts +1 -1
- package/examples/headers_schema/split/headerDemoAPI.ts +1 -1
- package/examples/headers_schema/split/k6-script.sample.ts +15 -4
- package/examples/headers_schema/tags/default.ts +1 -1
- package/examples/headers_schema/tags/headerDemoAPI.schemas.ts +1 -1
- package/examples/headers_schema/tags/k6-script.sample.ts +16 -5
- package/examples/no_title_schema/single/k6-script.sample.ts +3 -2
- package/examples/no_title_schema/single/k6Client.ts +1 -1
- package/examples/no_title_schema/split/k6-script.sample.ts +3 -2
- package/examples/no_title_schema/split/k6Client.schemas.ts +1 -1
- package/examples/no_title_schema/split/k6Client.ts +1 -1
- package/examples/no_title_schema/tags/default.ts +1 -1
- package/examples/no_title_schema/tags/k6-script.sample.ts +4 -3
- package/examples/no_title_schema/tags/k6Client.schemas.ts +1 -1
- package/examples/post_request_with_query_params/schema.json +14 -7
- package/examples/post_request_with_query_params/single/exampleAPI.ts +1 -1
- package/examples/post_request_with_query_params/single/k6-script.sample.ts +11 -2
- package/examples/post_request_with_query_params/split/exampleAPI.schemas.ts +1 -1
- package/examples/post_request_with_query_params/split/exampleAPI.ts +1 -1
- package/examples/post_request_with_query_params/split/k6-script.sample.ts +11 -2
- package/examples/post_request_with_query_params/tags/default.ts +1 -1
- package/examples/post_request_with_query_params/tags/exampleAPI.schemas.ts +1 -1
- package/examples/post_request_with_query_params/tags/k6-script.sample.ts +12 -3
- package/examples/query_params_schema/schema.json +20 -10
- package/examples/query_params_schema/single/exampleAPI.ts +1 -1
- package/examples/query_params_schema/single/k6-script.sample.ts +8 -2
- package/examples/query_params_schema/split/exampleAPI.schemas.ts +1 -1
- package/examples/query_params_schema/split/exampleAPI.ts +1 -1
- package/examples/query_params_schema/split/k6-script.sample.ts +8 -2
- package/examples/query_params_schema/tags/default.ts +1 -1
- package/examples/query_params_schema/tags/exampleAPI.schemas.ts +1 -1
- package/examples/query_params_schema/tags/k6-script.sample.ts +9 -3
- package/examples/simple_post_request_schema/schema.json +30 -15
- package/examples/simple_post_request_schema/single/exampleAPI.ts +1 -1
- package/examples/simple_post_request_schema/single/k6-script.sample.ts +16 -2
- package/examples/simple_post_request_schema/split/exampleAPI.schemas.ts +1 -1
- package/examples/simple_post_request_schema/split/exampleAPI.ts +1 -1
- package/examples/simple_post_request_schema/split/k6-script.sample.ts +16 -2
- package/examples/simple_post_request_schema/tags/default.ts +1 -1
- package/examples/simple_post_request_schema/tags/exampleAPI.schemas.ts +1 -1
- package/examples/simple_post_request_schema/tags/k6-script.sample.ts +17 -3
- package/package.json +3 -1
- package/src/cli.ts +32 -14
- package/src/constants.ts +7 -3
- package/src/errors.ts +6 -0
- package/src/generator/index.ts +67 -2
- package/src/generator/k6Client.ts +3 -72
- package/src/generator/k6ScriptBuilder.ts +328 -0
- package/src/helper.ts +40 -0
- package/src/type.d.ts +1 -0
- package/tests/e2e/schema.json +136 -18
- package/tests/e2e/single-tag-filter/k6Script.ts +50 -0
- package/tests/e2e/tags/k6Script.ts +3 -3
- package/tests/functional-tests/helper.ts +16 -0
- package/tests/functional-tests/{generator.test.ts → test-generator/generator.test.ts} +12 -21
- package/tests/functional-tests/test-sample-k6-scripts/fixtures/schema_using_ref_models.json +394 -0
- package/tests/functional-tests/test-sample-k6-scripts/fixtures/schema_with_examples.json +416 -0
- package/tests/functional-tests/test-sample-k6-scripts/fixtures/schema_with_no_variables.json +32 -0
- package/tests/functional-tests/test-sample-k6-scripts/sampleK6Scripts.test.ts +248 -0
- package/tests/functional-tests/test-tags-filtering/fixtures/tags_filtering.json +141 -0
- package/tests/functional-tests/test-tags-filtering/tagsFiltering.test.ts +166 -0
- package/tests/helper.test.ts +59 -0
- /package/tests/functional-tests/{fixtures/schemas → test-generator/fixtures}/basic_schema.json +0 -0
- /package/tests/functional-tests/{fixtures/schemas → test-generator/fixtures}/form_data_schema.json +0 -0
- /package/tests/functional-tests/{fixtures/schemas → test-generator/fixtures}/form_url_encoded_data_schema.json +0 -0
- /package/tests/functional-tests/{fixtures/schemas → test-generator/fixtures}/form_url_encoded_data_with_query_params_schema.json +0 -0
- /package/tests/functional-tests/{fixtures/schemas → test-generator/fixtures}/get_request_with_path_parameters_schema.json +0 -0
- /package/tests/functional-tests/{fixtures/schemas → test-generator/fixtures}/headers_schema.json +0 -0
- /package/tests/functional-tests/{fixtures/schemas → test-generator/fixtures}/no_title_schema.json +0 -0
- /package/tests/functional-tests/{fixtures/schemas → test-generator/fixtures}/post_request_with_query_params.json +0 -0
- /package/tests/functional-tests/{fixtures/schemas → test-generator/fixtures}/query_params_schema.json +0 -0
- /package/tests/functional-tests/{fixtures/schemas → test-generator/fixtures}/simple_post_request_schema.json +0 -0
|
@@ -1,18 +1,28 @@
|
|
|
1
1
|
import { HeaderDemoAPIClient } from './headerDemoAPI.ts'
|
|
2
2
|
|
|
3
3
|
const baseUrl = '<BASE_URL>'
|
|
4
|
-
const
|
|
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
|
-
|
|
12
|
+
|
|
13
|
+
const getExampleGetResponseData = headerDemoAPIClient.getExampleGet()
|
|
11
14
|
|
|
12
15
|
/**
|
|
13
16
|
* POST request with security headers
|
|
14
17
|
*/
|
|
15
|
-
|
|
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
|
-
|
|
35
|
+
headerDemoAPIClient.getExampleResponseHeaders()
|
|
25
36
|
}
|
|
@@ -1,18 +1,28 @@
|
|
|
1
1
|
import { HeaderDemoAPIClient } from './headerDemoAPI.ts'
|
|
2
2
|
|
|
3
3
|
const baseUrl = '<BASE_URL>'
|
|
4
|
-
const
|
|
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
|
-
|
|
12
|
+
|
|
13
|
+
const getExampleGetResponseData = headerDemoAPIClient.getExampleGet()
|
|
11
14
|
|
|
12
15
|
/**
|
|
13
16
|
* POST request with security headers
|
|
14
17
|
*/
|
|
15
|
-
|
|
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
|
-
|
|
35
|
+
headerDemoAPIClient.getExampleResponseHeaders()
|
|
25
36
|
}
|
|
@@ -1,18 +1,28 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DefaultClient } from './default.ts'
|
|
2
2
|
|
|
3
3
|
const baseUrl = '<BASE_URL>'
|
|
4
|
-
const
|
|
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
|
-
|
|
12
|
+
|
|
13
|
+
const getExampleGetResponseData = defaultClient.getExampleGet()
|
|
11
14
|
|
|
12
15
|
/**
|
|
13
16
|
* POST request with security headers
|
|
14
17
|
*/
|
|
15
|
-
|
|
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
|
-
|
|
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
|
|
4
|
+
const k6ClientClient = new K6ClientClient({ baseUrl })
|
|
5
5
|
|
|
6
6
|
export default function () {
|
|
7
7
|
/**
|
|
8
8
|
* Retrieve example data
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
const getExampleResponseData = k6ClientClient.getExample()
|
|
11
12
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { K6ClientClient } from './k6Client.ts'
|
|
2
2
|
|
|
3
3
|
const baseUrl = '<BASE_URL>'
|
|
4
|
-
const
|
|
4
|
+
const k6ClientClient = new K6ClientClient({ baseUrl })
|
|
5
5
|
|
|
6
6
|
export default function () {
|
|
7
7
|
/**
|
|
8
8
|
* Retrieve example data
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
const getExampleResponseData = k6ClientClient.getExample()
|
|
11
12
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DefaultClient } from './default.ts'
|
|
2
2
|
|
|
3
3
|
const baseUrl = '<BASE_URL>'
|
|
4
|
-
const
|
|
4
|
+
const defaultClient = new DefaultClient({ baseUrl })
|
|
5
5
|
|
|
6
6
|
export default function () {
|
|
7
7
|
/**
|
|
8
8
|
* Retrieve example data
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
const getExampleResponseData = defaultClient.getExample()
|
|
11
12
|
}
|
|
@@ -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,13 +1,22 @@
|
|
|
1
1
|
import { ExampleAPIClient } from './exampleAPI.ts'
|
|
2
2
|
|
|
3
3
|
const baseUrl = '<BASE_URL>'
|
|
4
|
-
const
|
|
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
|
-
|
|
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,13 +1,22 @@
|
|
|
1
1
|
import { ExampleAPIClient } from './exampleAPI.ts'
|
|
2
2
|
|
|
3
3
|
const baseUrl = '<BASE_URL>'
|
|
4
|
-
const
|
|
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
|
-
|
|
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,13 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DefaultClient } from './default.ts'
|
|
2
2
|
|
|
3
3
|
const baseUrl = '<BASE_URL>'
|
|
4
|
-
const
|
|
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
|
-
|
|
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,11 +1,17 @@
|
|
|
1
1
|
import { ExampleAPIClient } from './exampleAPI.ts'
|
|
2
2
|
|
|
3
3
|
const baseUrl = '<BASE_URL>'
|
|
4
|
-
const
|
|
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
|
-
|
|
12
|
+
params = {
|
|
13
|
+
name: 'John Doe',
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const getExampleDataResponseData = exampleAPIClient.getExampleData(params)
|
|
11
17
|
}
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { ExampleAPIClient } from './exampleAPI.ts'
|
|
2
2
|
|
|
3
3
|
const baseUrl = '<BASE_URL>'
|
|
4
|
-
const
|
|
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
|
-
|
|
12
|
+
params = {
|
|
13
|
+
name: 'John Doe',
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const getExampleDataResponseData = exampleAPIClient.getExampleData(params)
|
|
11
17
|
}
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DefaultClient } from './default.ts'
|
|
2
2
|
|
|
3
3
|
const baseUrl = '<BASE_URL>'
|
|
4
|
-
const
|
|
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
|
-
|
|
12
|
+
params = {
|
|
13
|
+
name: 'John Doe',
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const getExampleDataResponseData = defaultClient.getExampleData(params)
|
|
11
17
|
}
|