@typespec/http-client-js 0.16.1 → 0.16.2-dev.2
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/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +17 -13
- package/.github/copilot-instructions.md +0 -180
- package/.testignore +0 -19
- package/.turbo/turbo-build.log +0 -3
- package/CHANGELOG.md +0 -159
- package/eng/scripts/calculate-coverage.ts +0 -33
- package/eng/scripts/emit-e2e.ts +0 -317
- package/eng/scripts/run-e2e-tests.ts +0 -166
- package/eng/scripts/tspconfig.yaml +0 -6
- package/eng/scripts/upload-spector-results.ts +0 -139
- package/src/components/client-context/client-context-declaration.tsx +0 -26
- package/src/components/client-context/client-context-factory.tsx +0 -218
- package/src/components/client-context/client-context-options.tsx +0 -36
- package/src/components/client-context/client-context.tsx +0 -23
- package/src/components/client-context/parametrized-endpoint.tsx +0 -51
- package/src/components/client-directory.tsx +0 -51
- package/src/components/client-operation.tsx +0 -102
- package/src/components/client.tsx +0 -177
- package/src/components/encoding-provider.tsx +0 -17
- package/src/components/external-packages/ts-http-runtime.ts +0 -28
- package/src/components/external-packages/uri-template.ts +0 -11
- package/src/components/http-request-options.tsx +0 -88
- package/src/components/http-request-parameters-expression.tsx +0 -191
- package/src/components/http-request.tsx +0 -80
- package/src/components/http-response.tsx +0 -74
- package/src/components/index.ts +0 -12
- package/src/components/models.tsx +0 -26
- package/src/components/operation-handlers/index.tsx +0 -2
- package/src/components/operation-handlers/operation-pipeline.tsx +0 -33
- package/src/components/operation-handlers/paging/page-item.tsx +0 -14
- package/src/components/operation-handlers/paging/page-response.tsx +0 -57
- package/src/components/operation-handlers/paging/page-settings.tsx +0 -53
- package/src/components/operation-handlers/paging/paginated-operation-handler.tsx +0 -200
- package/src/components/operation-handlers/paging/request-send.tsx +0 -85
- package/src/components/operation-handlers/paging/response-deserialize.tsx +0 -60
- package/src/components/operation-handlers/paging/util.ts +0 -70
- package/src/components/operation-handlers/types.tsx +0 -18
- package/src/components/operation-options.tsx +0 -42
- package/src/components/operation-parameters.tsx +0 -44
- package/src/components/output.tsx +0 -32
- package/src/components/serializers.tsx +0 -74
- package/src/components/static-helpers/bytes-encoding.tsx +0 -61
- package/src/components/static-helpers/interfaces.tsx +0 -31
- package/src/components/static-helpers/multipart-helpers.tsx +0 -80
- package/src/components/static-helpers/paging-helper.tsx +0 -202
- package/src/components/static-helpers/rest-error.tsx +0 -102
- package/src/components/testing/client-options.tsx +0 -30
- package/src/components/transforms/content-type-encoding-provider.tsx +0 -26
- package/src/components/transforms/data-transform.tsx +0 -40
- package/src/components/transforms/json/json-array-transform.tsx +0 -87
- package/src/components/transforms/json/json-model-additional-properties-transform.tsx +0 -54
- package/src/components/transforms/json/json-model-base-transform.tsx +0 -24
- package/src/components/transforms/json/json-model-property-transform.tsx +0 -53
- package/src/components/transforms/json/json-model-transform.tsx +0 -115
- package/src/components/transforms/json/json-record-transform.tsx +0 -88
- package/src/components/transforms/json/json-transform-discriminator.tsx +0 -111
- package/src/components/transforms/json/json-transform.tsx +0 -120
- package/src/components/transforms/json/union-transform.tsx +0 -87
- package/src/components/transforms/json/utils/transport-namer.ts +0 -12
- package/src/components/transforms/multipart/array-part-transform.tsx +0 -44
- package/src/components/transforms/multipart/file-part-transform.tsx +0 -45
- package/src/components/transforms/multipart/multipart-transform.tsx +0 -30
- package/src/components/transforms/multipart/part-transform.tsx +0 -22
- package/src/components/transforms/multipart/simple-part-transform.tsx +0 -42
- package/src/components/transforms/operation-transform-declaration.tsx +0 -83
- package/src/components/transforms/operation-transform-expression.tsx +0 -62
- package/src/components/transforms/scalar-transform.tsx +0 -301
- package/src/components/transforms/transform-name-policy.ts +0 -134
- package/src/components/utils/unpack-model-property.ts +0 -44
- package/src/components/utils/url-template.tsx +0 -25
- package/src/context/encoding/encoding-context.tsx +0 -28
- package/src/context/encoding/types.ts +0 -6
- package/src/emitter.tsx +0 -85
- package/src/index.ts +0 -5
- package/src/lib.ts +0 -120
- package/src/testing/index.ts +0 -11
- package/src/utils/client-discovery.ts +0 -28
- package/src/utils/multipart.ts +0 -29
- package/src/utils/operations.ts +0 -112
- package/src/utils/parameters.tsx +0 -155
- package/test/e2e/assets/image.jpg +0 -0
- package/test/e2e/assets/image.png +0 -0
- package/test/e2e/http/authentication/api-key/main.test.ts +0 -38
- package/test/e2e/http/authentication/oauth2/main.test.ts +0 -31
- package/test/e2e/http/authentication/union/main.test.ts +0 -26
- package/test/e2e/http/encode/bytes/main.test.ts +0 -191
- package/test/e2e/http/encode/datetime/main.test.ts +0 -176
- package/test/e2e/http/encode/duration/main.test.ts +0 -126
- package/test/e2e/http/encode/numeric/main.test.ts +0 -26
- package/test/e2e/http/parameters/basic/main.test.ts +0 -35
- package/test/e2e/http/parameters/body-optionality/main.test.ts +0 -43
- package/test/e2e/http/parameters/collection-format/main.test.ts +0 -40
- package/test/e2e/http/parameters/spread/main.test.ts +0 -56
- package/test/e2e/http/payload/content-negotiation/main.test.ts +0 -40
- package/test/e2e/http/payload/json-merge-patch/main.test.ts +0 -122
- package/test/e2e/http/payload/media-type/main.test.ts +0 -28
- package/test/e2e/http/payload/multipart/main.test.ts +0 -200
- package/test/e2e/http/payload/pageable/main.test.ts +0 -78
- package/test/e2e/http/payload/xml/main.test.ts +0 -287
- package/test/e2e/http/routes/main.test.ts +0 -284
- package/test/e2e/http/serialization/encoded-name/json/main.test.ts +0 -20
- package/test/e2e/http/server/endpoint/not-defined/main.test.ts +0 -11
- package/test/e2e/http/server/path/multiple/main.test.ts +0 -22
- package/test/e2e/http/server/path/single/main.test.ts +0 -11
- package/test/e2e/http/server/versions/not-versioned/main.test.ts +0 -22
- package/test/e2e/http/server/versions/versioned/main.test.ts +0 -28
- package/test/e2e/http/special-headers/conditional-request/main.test.ts +0 -35
- package/test/e2e/http/special-headers/repeatability/main.test.ts +0 -18
- package/test/e2e/http/special-words/main.test.ts +0 -434
- package/test/e2e/http/type/array/array.test.ts +0 -256
- package/test/e2e/http/type/dictionary/main.test.ts +0 -229
- package/test/e2e/http/type/enum/extensible/main.test.ts +0 -34
- package/test/e2e/http/type/enum/fixed/main.test.ts +0 -29
- package/test/e2e/http/type/model/empty/main.test.ts +0 -21
- package/test/e2e/http/type/model/inheritance/enum-discriminator/main.test.ts +0 -51
- package/test/e2e/http/type/model/inheritance/nested-discriminator/main.test.ts +0 -168
- package/test/e2e/http/type/model/inheritance/not-discriminated/main.test.ts +0 -42
- package/test/e2e/http/type/model/inheritance/recursive/main.test.ts +0 -46
- package/test/e2e/http/type/model/inheritance/single-discriminator/main.test.ts +0 -99
- package/test/e2e/http/type/model/visibility/main.test.ts +0 -64
- package/test/e2e/http/type/property/additional-properties/main.test.ts +0 -185
- package/test/e2e/http/type/property/additional-properties/spreads.test.ts +0 -448
- package/test/e2e/http/type/property/nullable/main.test.ts +0 -275
- package/test/e2e/http/type/property/optionality/main.test.ts +0 -256
- package/test/e2e/http/type/property/value-types/main.test.ts +0 -193
- package/test/e2e/http/type/scalar/main.test.ts +0 -133
- package/test/e2e/http/type/scalar/scalar.test.ts +0 -95
- package/test/e2e/http/type/union/main.test.ts +0 -207
- package/test/e2e/http/versioning/added/main.test.ts +0 -60
- package/test/e2e/http/versioning/madeOptional/main.test.ts +0 -34
- package/test/e2e/http/versioning/removed/main.test.ts +0 -75
- package/test/e2e/http/versioning/renamedFrom/main.test.ts +0 -52
- package/test/e2e/http/versioning/returnTypeChangedFrom/main.test.ts +0 -22
- package/test/e2e/http/versioning/typeChangedFrom/main.test.ts +0 -31
- package/test/scenarios/additional-properties/extends.md +0 -67
- package/test/scenarios/additional-properties/is.md +0 -42
- package/test/scenarios/additional-properties/spread.md +0 -68
- package/test/scenarios/auth/basic_auth.md +0 -68
- package/test/scenarios/auth/bearer.md +0 -68
- package/test/scenarios/auth/client_parameters.md +0 -78
- package/test/scenarios/auth/client_structure.md +0 -36
- package/test/scenarios/auth/key_credential.md +0 -69
- package/test/scenarios/auth/oauth2.md +0 -90
- package/test/scenarios/auth/sub_client_override.md +0 -114
- package/test/scenarios/client/client_context.md +0 -34
- package/test/scenarios/client/dotted_namespace.md +0 -27
- package/test/scenarios/client/global_namespace.md +0 -69
- package/test/scenarios/client/multiple_top_level_clients.md +0 -72
- package/test/scenarios/client/nested_client.md +0 -102
- package/test/scenarios/client/wrapping_namespace.md +0 -41
- package/test/scenarios/encoding/bytes_body.md +0 -44
- package/test/scenarios/encoding/bytes_json_property.md +0 -55
- package/test/scenarios/encoding/bytes_nullable.md +0 -139
- package/test/scenarios/encoding/header_bytes.md +0 -130
- package/test/scenarios/encoding/header_date.md +0 -216
- package/test/scenarios/encoding/model_with_bytes_property.md +0 -45
- package/test/scenarios/encoding/query_bytes.md +0 -42
- package/test/scenarios/encoding/query_date.md +0 -216
- package/test/scenarios/http-operations/basic-request.md +0 -144
- package/test/scenarios/http-operations/basic-response.md +0 -219
- package/test/scenarios/http-operations/basic.md +0 -128
- package/test/scenarios/http-operations/constant-header.md +0 -33
- package/test/scenarios/http-operations/create-operation.md +0 -58
- package/test/scenarios/http-operations/on_response.md +0 -52
- package/test/scenarios/http-operations/optional-request-body.md +0 -50
- package/test/scenarios/http-operations/paging.md +0 -242
- package/test/scenarios/http-operations/path-parameter-in-model.md +0 -53
- package/test/scenarios/http-operations/path-parameter.md +0 -48
- package/test/scenarios/http-operations/query-parameter.md +0 -41
- package/test/scenarios/http-operations/scalar-payload.md +0 -57
- package/test/scenarios/http-operations/with-parameters.md +0 -78
- package/test/scenarios/models/array-properties.md +0 -47
- package/test/scenarios/models/basic.md +0 -118
- package/test/scenarios/models/dictionary-properties.md +0 -44
- package/test/scenarios/models/inheritance_2_discriminators.md +0 -346
- package/test/scenarios/models/inheritance_discriminator.md +0 -88
- package/test/scenarios/models/inline-models.md +0 -29
- package/test/scenarios/models/model_additional_properties.md +0 -75
- package/test/scenarios/models/model_extends.md +0 -97
- package/test/scenarios/models/model_spread.md +0 -63
- package/test/scenarios/models/nested_property.md +0 -41
- package/test/scenarios/models/property_references_property.md +0 -150
- package/test/scenarios/multipart/anonymous_part.md +0 -53
- package/test/scenarios/multipart/file.md +0 -154
- package/test/scenarios/multipart/file_content_type.md +0 -92
- package/test/scenarios/multipart/non-string-float.md +0 -55
- package/test/scenarios/multipart/simple_part.md +0 -65
- package/test/scenarios/operation-parameters/body_root_anonymous.md +0 -87
- package/test/scenarios/operation-parameters/constant_as_optional.md +0 -54
- package/test/scenarios/operation-parameters/default_value_as_optional.md +0 -54
- package/test/scenarios/operation-parameters/no_content_type.md +0 -62
- package/test/scenarios/operation-parameters/no_parameters.md +0 -50
- package/test/scenarios/operation-parameters/only_optional.md +0 -62
- package/test/scenarios/operation-parameters/only_required.md +0 -58
- package/test/scenarios/operation-parameters/reserved_names.md +0 -60
- package/test/scenarios/operation-parameters/spread_body.md +0 -70
- package/test/scenarios/operation-parameters/spread_with_nested.md +0 -82
- package/test/scenarios/operation-parameters/union_body.md +0 -86
- package/test/scenarios/operation-parameters/with_body_property.md +0 -67
- package/test/scenarios/operation-parameters/with_body_root.md +0 -69
- package/test/scenarios/serializers/arrays.md +0 -191
- package/test/scenarios/serializers/basic_model.md +0 -111
- package/test/scenarios/serializers/basic_model_wire_name.md +0 -48
- package/test/scenarios/serializers/discriminated_union.md +0 -86
- package/test/scenarios/serializers/discriminated_union_spread.md +0 -115
- package/test/scenarios/serializers/file.md +0 -67
- package/test/scenarios/serializers/model_date_time.md +0 -65
- package/test/scenarios/serializers/multipart.md +0 -62
- package/test/scenarios/serializers/polymorphic_single_level_inheritance.md +0 -157
- package/test/scenarios/serializers/property_references_property.md +0 -72
- package/test/scenarios/serializers/record.md +0 -97
- package/test/scenarios/serializers/scalars.md +0 -34
- package/test/scenarios/serializers/spread.md +0 -69
- package/test/scenarios/serializers/string_union.md +0 -55
- package/test/scenarios/server/default_url.md +0 -45
- package/test/scenarios/server/multiple-parameters.md +0 -55
- package/test/scenarios/server/no-server.md +0 -37
- package/test/scenarios/server/parametrized-endpoint.md +0 -51
- package/test/scenarios.test.ts +0 -24
- package/test/test-host.ts +0 -22
- package/tsconfig.json +0 -16
- package/tsconfig.test.json +0 -9
- package/vitest.config.e2e.ts +0 -16
- package/vitest.config.ts +0 -15
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import {
|
|
3
|
-
HeaderClient,
|
|
4
|
-
PropertyClient,
|
|
5
|
-
QueryClient,
|
|
6
|
-
} from "../../../generated/encode/duration/src/index.js";
|
|
7
|
-
|
|
8
|
-
describe("Encode.Duration", () => {
|
|
9
|
-
describe("QueryClient", () => {
|
|
10
|
-
const queryClient = new QueryClient({ allowInsecureConnection: true });
|
|
11
|
-
|
|
12
|
-
it("should test default encode for a duration parameter", async () => {
|
|
13
|
-
await queryClient.default_("P40D");
|
|
14
|
-
// Assert successful request
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
it("should test iso8601 encode for a duration parameter", async () => {
|
|
18
|
-
await queryClient.iso8601("P40D");
|
|
19
|
-
// Assert successful request
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it.skip("should test int32 seconds encode for a duration parameter", async () => {
|
|
23
|
-
await queryClient.int32Seconds("P40D");
|
|
24
|
-
// Assert successful request
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it.skip("should test float seconds encode for a duration parameter", async () => {
|
|
28
|
-
await queryClient.floatSeconds("PT35.625S");
|
|
29
|
-
// Assert successful request
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it.skip("should test float64 seconds encode for a duration parameter", async () => {
|
|
33
|
-
await queryClient.float64Seconds("PT35.625S");
|
|
34
|
-
// Assert successful request
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it.skip("should test int32 seconds encode for a duration array parameter", async () => {
|
|
38
|
-
await queryClient.int32SecondsArray(["P36D", "P47D"]);
|
|
39
|
-
// Assert successful request
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
describe("PropertyClient", () => {
|
|
44
|
-
const propertyClient = new PropertyClient({
|
|
45
|
-
allowInsecureConnection: true,
|
|
46
|
-
retryOptions: {
|
|
47
|
-
maxRetries: 1,
|
|
48
|
-
},
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it("should test default encode for a duration property", async () => {
|
|
52
|
-
const requestBody = { value: "P40D" };
|
|
53
|
-
const response = await propertyClient.default_(requestBody);
|
|
54
|
-
expect(response).toEqual({ value: "P40D" });
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
it("should test iso8601 encode for a duration property", async () => {
|
|
58
|
-
const requestBody = { value: "P40D" };
|
|
59
|
-
const response = await propertyClient.iso8601(requestBody);
|
|
60
|
-
expect(response).toEqual({ value: "P40D" });
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
it.skip("should test int32 seconds encode for a duration property", async () => {
|
|
64
|
-
const requestBody = { value: "PT36S" };
|
|
65
|
-
const response = await propertyClient.int32Seconds(requestBody);
|
|
66
|
-
expect(response).toEqual({ value: 36 });
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it.skip("should test float seconds encode for a duration property", async () => {
|
|
70
|
-
const requestBody = { value: "PT35.625S" };
|
|
71
|
-
const response = await propertyClient.floatSeconds(requestBody);
|
|
72
|
-
expect(response).toEqual({ value: 35.625 });
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it.skip("should test float64 seconds encode for a duration property", async () => {
|
|
76
|
-
const requestBody = { value: "PT35.625S" };
|
|
77
|
-
const response = await propertyClient.float64Seconds(requestBody);
|
|
78
|
-
expect(response).toEqual({ value: 35.625 });
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
it.skip("should test float seconds encode for a duration array property", async () => {
|
|
82
|
-
const requestBody = { value: ["PT35.625S", "PT46.75S"] };
|
|
83
|
-
const response = await propertyClient.floatSecondsArray(requestBody);
|
|
84
|
-
expect(response).toEqual({ value: [35.625, 46.75] });
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
describe("HeaderClient", () => {
|
|
89
|
-
const headerClient = new HeaderClient({
|
|
90
|
-
allowInsecureConnection: true,
|
|
91
|
-
retryOptions: {
|
|
92
|
-
maxRetries: 1,
|
|
93
|
-
},
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
it("should test default encode for a duration header", async () => {
|
|
97
|
-
await headerClient.default_("P40D");
|
|
98
|
-
// Assert successful request
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
it("should test iso8601 encode for a duration header", async () => {
|
|
102
|
-
await headerClient.iso8601("P40D");
|
|
103
|
-
// Assert successful request
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
it("should test iso8601 encode for a duration array header", async () => {
|
|
107
|
-
await headerClient.iso8601Array(["P40D", "P50D"]);
|
|
108
|
-
// Assert successful request
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
it.skip("should test int32 seconds encode for a duration header", async () => {
|
|
112
|
-
await headerClient.int32Seconds("P40D");
|
|
113
|
-
// Assert successful request
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
it.skip("should test float seconds encode for a duration header", async () => {
|
|
117
|
-
await headerClient.floatSeconds("PT35.625S");
|
|
118
|
-
// Assert successful request
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
it.skip("should test float64 seconds encode for a duration header", async () => {
|
|
122
|
-
await headerClient.float64Seconds("PT35.625S");
|
|
123
|
-
// Assert successful request
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { PropertyClient } from "../../../generated/encode/numeric/src/index.js";
|
|
3
|
-
|
|
4
|
-
describe("Encode.Numeric", () => {
|
|
5
|
-
describe("PropertyClient", () => {
|
|
6
|
-
const client = new PropertyClient({ allowInsecureConnection: true });
|
|
7
|
-
|
|
8
|
-
it.skip("should send and receive safeint as string", async () => {
|
|
9
|
-
const payload = { value: 10000000000 };
|
|
10
|
-
const response = await client.safeintAsString(payload);
|
|
11
|
-
expect(response).toEqual(payload); // Mock API expected value
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it.skip("should send and receive optional uint32 as string", async () => {
|
|
15
|
-
const payload = { value: 1 };
|
|
16
|
-
const response = await client.uint32AsStringOptional(payload);
|
|
17
|
-
expect(response).toEqual(payload); // Mock API expected value
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it.skip("should send and receive uint8 as string", async () => {
|
|
21
|
-
const payload = { value: 255 };
|
|
22
|
-
const response = await client.uint8AsString(payload);
|
|
23
|
-
expect(response).toEqual(payload); // Mock API expected value
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
});
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { describe, it } from "vitest";
|
|
2
|
-
import {
|
|
3
|
-
ExplicitBodyClient,
|
|
4
|
-
ImplicitBodyClient,
|
|
5
|
-
} from "../../../generated/parameters/basic/src/index.js";
|
|
6
|
-
|
|
7
|
-
describe("Parameters.Basic", () => {
|
|
8
|
-
describe("ExplicitBodyClient", () => {
|
|
9
|
-
const client = new ExplicitBodyClient({
|
|
10
|
-
allowInsecureConnection: true,
|
|
11
|
-
retryOptions: {
|
|
12
|
-
maxRetries: 1,
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it("should handle a simple explicit body", async () => {
|
|
17
|
-
await client.simple({ name: "foo" });
|
|
18
|
-
// Assert successful request
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
describe("ImplicitBodyClient", () => {
|
|
23
|
-
const client = new ImplicitBodyClient({
|
|
24
|
-
allowInsecureConnection: true,
|
|
25
|
-
retryOptions: {
|
|
26
|
-
maxRetries: 1,
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it("should handle a simple implicit body", async () => {
|
|
31
|
-
await client.simple("foo");
|
|
32
|
-
// Assert successful request
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
});
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { describe, it } from "vitest";
|
|
2
|
-
import {
|
|
3
|
-
BodyOptionalityClient,
|
|
4
|
-
OptionalExplicitClient,
|
|
5
|
-
} from "../../../generated/parameters/body-optionality/src/index.js";
|
|
6
|
-
|
|
7
|
-
describe("Parameters.BodyOptionality", () => {
|
|
8
|
-
const client = new BodyOptionalityClient({
|
|
9
|
-
allowInsecureConnection: true,
|
|
10
|
-
retryOptions: {
|
|
11
|
-
maxRetries: 1,
|
|
12
|
-
},
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it("should handle required explicit body parameter", async () => {
|
|
16
|
-
await client.requiredExplicit({ name: "foo" });
|
|
17
|
-
// Assert successful request
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
describe("OptionalExplicitClient", () => {
|
|
21
|
-
const optionalExplicitClient = new OptionalExplicitClient({
|
|
22
|
-
allowInsecureConnection: true,
|
|
23
|
-
retryOptions: {
|
|
24
|
-
maxRetries: 1,
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it("should handle explicit optional body parameter (set case)", async () => {
|
|
29
|
-
await optionalExplicitClient.set({ body: { name: "foo" } });
|
|
30
|
-
// Assert successful request
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it("should handle explicit optional body parameter (omit case)", async () => {
|
|
34
|
-
await optionalExplicitClient.omit();
|
|
35
|
-
// Assert successful request
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it("should handle implicit required body parameter", async () => {
|
|
40
|
-
await client.requiredImplicit("foo");
|
|
41
|
-
// Assert successful request
|
|
42
|
-
});
|
|
43
|
-
});
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { describe, it } from "vitest";
|
|
2
|
-
import {
|
|
3
|
-
HeaderClient,
|
|
4
|
-
QueryClient,
|
|
5
|
-
} from "../../../generated/parameters/collection-format/src/index.js";
|
|
6
|
-
|
|
7
|
-
describe("Parameters.CollectionFormat", () => {
|
|
8
|
-
describe("QueryClient", () => {
|
|
9
|
-
const client = new QueryClient({ allowInsecureConnection: true });
|
|
10
|
-
|
|
11
|
-
it("should test sending a multi collection format array query parameters", async () => {
|
|
12
|
-
await client.multi(["blue", "red", "green"]);
|
|
13
|
-
// Assert successful request
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it.skip("should test sending an ssv collection format array query parameters", async () => {
|
|
17
|
-
await client.ssv(["blue", "red", "green"]);
|
|
18
|
-
// Assert successful request
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it.skip("should test sending a pipes collection format array query parameters", async () => {
|
|
22
|
-
await client.pipes(["blue", "red", "green"]);
|
|
23
|
-
// Assert successful request
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it("should test sending a csv collection format array query parameters", async () => {
|
|
27
|
-
await client.csv(["blue", "red", "green"]);
|
|
28
|
-
// Assert successful request
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
describe("HeaderClient", () => {
|
|
33
|
-
const client = new HeaderClient({ allowInsecureConnection: true });
|
|
34
|
-
|
|
35
|
-
it("should test sending a csv collection format array header parameters", async () => {
|
|
36
|
-
await client.csv(["blue", "red", "green"]);
|
|
37
|
-
// Assert successful request
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
});
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { describe, it } from "vitest";
|
|
2
|
-
import { AliasClient, ModelClient } from "../../../generated/parameters/spread/src/index.js";
|
|
3
|
-
|
|
4
|
-
describe("Parameters.Spread", () => {
|
|
5
|
-
describe("ModelClient", () => {
|
|
6
|
-
const client = new ModelClient({ allowInsecureConnection: true });
|
|
7
|
-
|
|
8
|
-
it("should handle spread named model in request body", async () => {
|
|
9
|
-
await client.spreadAsRequestBody("foo");
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
it("should handle spread model with only @body property", async () => {
|
|
13
|
-
await client.spreadCompositeRequestOnlyWithBody({ name: "foo" });
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it("should handle spread model without @body property", async () => {
|
|
17
|
-
await client.spreadCompositeRequestWithoutBody("foo", "bar");
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it("should handle spread model with all HTTP request decorators", async () => {
|
|
21
|
-
await client.spreadCompositeRequest("foo", "bar", { name: "foo" });
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it("should handle spread model with non-body HTTP request decorators", async () => {
|
|
25
|
-
await client.spreadCompositeRequestMix("foo", "bar", "foo");
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
describe("AliasClient", () => {
|
|
30
|
-
const client = new AliasClient({ allowInsecureConnection: true });
|
|
31
|
-
|
|
32
|
-
it("should handle spread alias in request body", async () => {
|
|
33
|
-
await client.spreadAsRequestBody("foo");
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it("should handle spread alias with inner model in parameters", async () => {
|
|
37
|
-
await client.spreadParameterWithInnerModel("1", "foo", "bar");
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it("should handle spread alias with path and header parameters", async () => {
|
|
41
|
-
await client.spreadAsRequestParameter("1", "bar", "foo");
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it("should handle spread alias including multiple parameters, optional and required", async () => {
|
|
45
|
-
// Required parameters are positional and optional parameters are within the options bag
|
|
46
|
-
await client.spreadWithMultipleParameters("1", "bar", "foo", [1, 2], {
|
|
47
|
-
optionalInt: 1,
|
|
48
|
-
optionalStringList: ["foo", "bar"],
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it("should handle spread alias containing another alias property as body", async () => {
|
|
53
|
-
await client.spreadParameterWithInnerAlias("1", "foo", 1, "bar");
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
});
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import {
|
|
3
|
-
DifferentBodyClient,
|
|
4
|
-
SameBodyClient,
|
|
5
|
-
} from "../../../generated/payload/content-negotiation/src/index.js";
|
|
6
|
-
|
|
7
|
-
describe("Payload.ContentNegotiation", () => {
|
|
8
|
-
describe("SameBodyClient", () => {
|
|
9
|
-
const client = new SameBodyClient({ allowInsecureConnection: true });
|
|
10
|
-
|
|
11
|
-
it.skip("should return a PNG image when 'Accept: image/png' is sent", async () => {
|
|
12
|
-
const response = await client.getAvatarAsPng();
|
|
13
|
-
expect(response).toBeInstanceOf(Uint8Array); // Mock API expected binary result
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it.skip("should return a JPEG image when 'Accept: image/jpeg' is sent", async () => {
|
|
17
|
-
const response = await client.getAvatarAsJpeg();
|
|
18
|
-
expect(response).toBeInstanceOf(Uint8Array); // Mock API expected binary result
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
describe("DifferentBodyClient", () => {
|
|
23
|
-
const client = new DifferentBodyClient({
|
|
24
|
-
allowInsecureConnection: true,
|
|
25
|
-
retryOptions: {
|
|
26
|
-
maxRetries: 1,
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it.skip("should return a PNG image when 'Accept: image/png' is sent", async () => {
|
|
31
|
-
const response = await client.getAvatarAsPng();
|
|
32
|
-
expect(response).toBeInstanceOf(Uint8Array); // Mock API expected binary result
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it.skip("should return a JSON object containing a PNG image when 'Accept: application/json' is sent", async () => {
|
|
36
|
-
const response = await client.getAvatarAsJson();
|
|
37
|
-
expect(response.content).toBeInstanceOf(Uint8Array); // Mock API expected binary result
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
});
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { JsonMergePatchClient } from "../../../generated/payload/json-merge-patch/src/index.js";
|
|
3
|
-
|
|
4
|
-
describe("Payload.JsonMergePatch", () => {
|
|
5
|
-
const client = new JsonMergePatchClient({
|
|
6
|
-
allowInsecureConnection: true,
|
|
7
|
-
retryOptions: {
|
|
8
|
-
maxRetries: 1,
|
|
9
|
-
},
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
it("should handle createResource operation with application/merge-patch+json content type", async () => {
|
|
13
|
-
const requestBody = {
|
|
14
|
-
name: "Madge",
|
|
15
|
-
description: "desc",
|
|
16
|
-
map: {
|
|
17
|
-
key: {
|
|
18
|
-
name: "InnerMadge",
|
|
19
|
-
description: "innerDesc",
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
array: [
|
|
23
|
-
{
|
|
24
|
-
name: "InnerMadge",
|
|
25
|
-
description: "innerDesc",
|
|
26
|
-
},
|
|
27
|
-
],
|
|
28
|
-
intValue: 1,
|
|
29
|
-
floatValue: 1.25,
|
|
30
|
-
innerModel: {
|
|
31
|
-
name: "InnerMadge",
|
|
32
|
-
description: "innerDesc",
|
|
33
|
-
},
|
|
34
|
-
intArray: [1, 2, 3],
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const expectedResponse = {
|
|
38
|
-
name: "Madge",
|
|
39
|
-
description: "desc",
|
|
40
|
-
map: {
|
|
41
|
-
key: {
|
|
42
|
-
name: "InnerMadge",
|
|
43
|
-
description: "innerDesc",
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
array: [
|
|
47
|
-
{
|
|
48
|
-
name: "InnerMadge",
|
|
49
|
-
description: "innerDesc",
|
|
50
|
-
},
|
|
51
|
-
],
|
|
52
|
-
intValue: 1,
|
|
53
|
-
floatValue: 1.25,
|
|
54
|
-
innerModel: {
|
|
55
|
-
name: "InnerMadge",
|
|
56
|
-
description: "innerDesc",
|
|
57
|
-
},
|
|
58
|
-
intArray: [1, 2, 3],
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const response = await client.createResource(requestBody);
|
|
62
|
-
expect(response).toEqual(expectedResponse);
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it("should handle updateResource operation with application/merge-patch+json content type", async () => {
|
|
66
|
-
const requestBody = {
|
|
67
|
-
description: null,
|
|
68
|
-
map: {
|
|
69
|
-
key: {
|
|
70
|
-
description: null,
|
|
71
|
-
},
|
|
72
|
-
key2: null,
|
|
73
|
-
},
|
|
74
|
-
array: null,
|
|
75
|
-
intValue: null,
|
|
76
|
-
floatValue: null,
|
|
77
|
-
innerModel: null,
|
|
78
|
-
intArray: null,
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
const expectedResponse = {
|
|
82
|
-
name: "Madge",
|
|
83
|
-
map: {
|
|
84
|
-
key: {
|
|
85
|
-
name: "InnerMadge",
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
const response = await client.updateResource(requestBody as any);
|
|
91
|
-
expect(response).toEqual(expectedResponse);
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
it.skip("should handle updateOptionalResource operation with application/merge-patch+json content type and body provided", async () => {
|
|
95
|
-
const requestBody = {
|
|
96
|
-
description: null,
|
|
97
|
-
map: {
|
|
98
|
-
key: {
|
|
99
|
-
description: null,
|
|
100
|
-
},
|
|
101
|
-
key2: null,
|
|
102
|
-
},
|
|
103
|
-
array: null,
|
|
104
|
-
intValue: null,
|
|
105
|
-
floatValue: null,
|
|
106
|
-
innerModel: null,
|
|
107
|
-
intArray: null,
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
const expectedResponse = {
|
|
111
|
-
name: "Madge",
|
|
112
|
-
map: {
|
|
113
|
-
key: {
|
|
114
|
-
name: "InnerMadge",
|
|
115
|
-
},
|
|
116
|
-
},
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
const response = await client.updateOptionalResource(requestBody as any);
|
|
120
|
-
expect(response).toEqual(expectedResponse);
|
|
121
|
-
});
|
|
122
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { StringBodyClient } from "../../../generated/payload/media-type/src/index.js";
|
|
3
|
-
|
|
4
|
-
describe("Payload.MediaType", () => {
|
|
5
|
-
describe("StringBodyClient", () => {
|
|
6
|
-
const client = new StringBodyClient({ allowInsecureConnection: true });
|
|
7
|
-
|
|
8
|
-
it.skip("should send a string body as text/plain", async () => {
|
|
9
|
-
await client.sendAsText("cat");
|
|
10
|
-
// Assert successful request
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it.skip("should get a string body as text/plain", async () => {
|
|
14
|
-
const response = await client.getAsText();
|
|
15
|
-
expect(response).toBe("cat"); // Mock API expected value
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it("should send a string body as application/json", async () => {
|
|
19
|
-
await client.sendAsJson("foo");
|
|
20
|
-
// Assert successful request
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it("should get a string body as application/json", async () => {
|
|
24
|
-
const response = await client.getAsJson();
|
|
25
|
-
expect(response).toBe("foo"); // Mock API expected value
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
});
|