From ba8a155830bb3ada1eb44de5f079dbde15ab9eb6 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Mon, 9 Feb 2026 15:59:08 +0800 Subject: [PATCH 1/5] fall back to wire type for unknown encode --- .../http-client-python/emitter/src/types.ts | 42 ++++++++++++++----- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/packages/http-client-python/emitter/src/types.ts b/packages/http-client-python/emitter/src/types.ts index 4bffbdbb2c6..592ec0b3f3e 100644 --- a/packages/http-client-python/emitter/src/types.ts +++ b/packages/http-client-python/emitter/src/types.ts @@ -463,18 +463,38 @@ const sdkScalarKindToPythonKind: Record = { function emitBuiltInType( type: SdkBuiltInType | SdkDurationType | SdkDateTimeType, ): Record { - if (type.kind === "duration" && type.encode === "seconds") { - return getSimpleTypeResult({ - type: sdkScalarKindToPythonKind[type.wireType.kind], - encode: type.encode, - }); - } - if (type.encode === "unixTimestamp") { - return getSimpleTypeResult({ - type: "unixtime", - encode: type.encode, - }); + if (type.encode) { + if (type.kind === "duration") { + if (type.encode === "seconds") { + return getSimpleTypeResult({ + type: sdkScalarKindToPythonKind[type.wireType.kind], + encode: type.encode, + }); + } else if (type.encode === "ISO8601") { + return getSimpleTypeResult({ + type: "duration", + encode: type.encode, + }); + } + } + if (type.kind === "utcDateTime" || type.kind === "offsetDateTime") { + if (type.encode === "unixTimestamp") { + return getSimpleTypeResult({ + type: "unixtime", + encode: type.encode, + }); + } + } + + // fallback to wire type for unknown or unsupported encode + if ("wireType" in type && type.wireType !== undefined) { + return getSimpleTypeResult({ + type: sdkScalarKindToPythonKind[type.wireType.kind] || type.wireType.kind, + encode: type.encode, + }); + } } + return getSimpleTypeResult({ type: sdkScalarKindToPythonKind[type.kind] || type.kind, // TODO: switch to kind encode: type.encode, From 7ac2e8412b5b81b072e4985a0c6b03c17e8c886c Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Tue, 10 Feb 2026 02:34:19 +0000 Subject: [PATCH 2/5] Fix encoding handling for duration and datetime types in emitter --- ...allback-wire-type-unknown-encode-2026-1-9-0-0-0.md | 7 +++++++ packages/http-client-python/emitter/src/types.ts | 11 +++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 .chronus/changes/python-fallback-wire-type-unknown-encode-2026-1-9-0-0-0.md diff --git a/.chronus/changes/python-fallback-wire-type-unknown-encode-2026-1-9-0-0-0.md b/.chronus/changes/python-fallback-wire-type-unknown-encode-2026-1-9-0-0-0.md new file mode 100644 index 00000000000..31c31c780f9 --- /dev/null +++ b/.chronus/changes/python-fallback-wire-type-unknown-encode-2026-1-9-0-0-0.md @@ -0,0 +1,7 @@ +--- +changeKind: fix +packages: + - "@typespec/http-client-python" +--- + +Fall back to wire type for unknown or unsupported encode in the emitter diff --git a/packages/http-client-python/emitter/src/types.ts b/packages/http-client-python/emitter/src/types.ts index 592ec0b3f3e..ee1f514678b 100644 --- a/packages/http-client-python/emitter/src/types.ts +++ b/packages/http-client-python/emitter/src/types.ts @@ -470,9 +470,10 @@ function emitBuiltInType( type: sdkScalarKindToPythonKind[type.wireType.kind], encode: type.encode, }); - } else if (type.encode === "ISO8601") { + } + if (type.encode === "ISO8601") { return getSimpleTypeResult({ - type: "duration", + type: type.kind, encode: type.encode, }); } @@ -484,6 +485,12 @@ function emitBuiltInType( encode: type.encode, }); } + if (type.encode === "rfc3339" || type.encode === "rfc7231") { + return getSimpleTypeResult({ + type: type.kind, + encode: type.encode, + }); + } } // fallback to wire type for unknown or unsupported encode From 6bd9753748ed3b9acfb09caa2f0c53769db509d8 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Tue, 10 Feb 2026 10:34:51 +0800 Subject: [PATCH 3/5] Update python-fallback-wire-type-unknown-encode-2026-1-9-0-0-0.md --- .../python-fallback-wire-type-unknown-encode-2026-1-9-0-0-0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.chronus/changes/python-fallback-wire-type-unknown-encode-2026-1-9-0-0-0.md b/.chronus/changes/python-fallback-wire-type-unknown-encode-2026-1-9-0-0-0.md index 31c31c780f9..7b70ad24f39 100644 --- a/.chronus/changes/python-fallback-wire-type-unknown-encode-2026-1-9-0-0-0.md +++ b/.chronus/changes/python-fallback-wire-type-unknown-encode-2026-1-9-0-0-0.md @@ -4,4 +4,4 @@ packages: - "@typespec/http-client-python" --- -Fall back to wire type for unknown or unsupported encode in the emitter +Fall back to wire type for unknown or unsupported encode From 16f33a82a97d09d6b5ba03b310aa46b8ad1f7235 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Tue, 10 Feb 2026 03:59:49 +0000 Subject: [PATCH 4/5] Update http-client-python types and add alpha config --- packages/http-client-python/alpha/client.tsp | 334 ++++++++++++++++++ packages/http-client-python/alpha/output.yaml | 83 +++++ .../http-client-python/alpha/tspconfig.yaml | 2 + .../http-client-python/emitter/src/types.ts | 6 - 4 files changed, 419 insertions(+), 6 deletions(-) create mode 100644 packages/http-client-python/alpha/client.tsp create mode 100644 packages/http-client-python/alpha/output.yaml create mode 100644 packages/http-client-python/alpha/tspconfig.yaml diff --git a/packages/http-client-python/alpha/client.tsp b/packages/http-client-python/alpha/client.tsp new file mode 100644 index 00000000000..c78fd9afbf1 --- /dev/null +++ b/packages/http-client-python/alpha/client.tsp @@ -0,0 +1,334 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +@doc("Test for encode decorator on datetime.") +@scenarioService("/encode/datetime") +namespace Encode.Datetime; + +@encode(DateTimeKnownEncoding.unixTimestamp, int64) +scalar unixTimestampDatetime extends utcDateTime; + +@route("/query") +namespace Query { + @route("/default") + @scenario + @scenarioDoc(""" + Test default encode (rfc3339) for datetime query parameter. + Expected query parameter: + value=2022-08-26T18:38:00.000Z + """) + op default( + @query + value: utcDateTime, + ): NoContentResponse; + + @route("/rfc3339") + @scenario + @scenarioDoc(""" + Test rfc3339 encode for datetime query parameter. + Expected query parameter: + value=2022-08-26T18:38:00.000Z + """) + op rfc3339( + @query + @encode(DateTimeKnownEncoding.rfc3339) + value: utcDateTime, + ): NoContentResponse; + + @route("/rfc7231") + @scenario + @scenarioDoc(""" + Test rfc7231 encode for datetime query parameter. + Expected query parameter: + value=Fri, 26 Aug 2022 14:38:00 GMT + """) + op rfc7231( + @query + @encode(DateTimeKnownEncoding.rfc7231) + value: utcDateTime, + ): NoContentResponse; + + @route("/unix-timestamp") + @scenario + @scenarioDoc(""" + Test unixTimestamp encode for datetime query parameter. + Expected query parameter: + value=1686566864 + """) + op unixTimestamp( + @query + @encode(DateTimeKnownEncoding.unixTimestamp, int64) + value: utcDateTime, + ): NoContentResponse; + + @route("/unix-timestamp-array") + @scenario + @scenarioDoc(""" + Test unixTimestamp encode for datetime array query parameter. + Expected query parameter: + value=1686566864, 1686734256 + """) + op unixTimestampArray( + @query + value: unixTimestampDatetime[], + ): NoContentResponse; +} + +model DefaultDatetimeProperty { + value: utcDateTime; +} + +model Rfc3339DatetimeProperty { + @encode(DateTimeKnownEncoding.rfc3339) + value: utcDateTime; +} + +model Rfc7231DatetimeProperty { + @encode(DateTimeKnownEncoding.rfc7231) + value: utcDateTime; +} + +model UnixTimestampDatetimeProperty { + @encode(DateTimeKnownEncoding.unixTimestamp, int64) + value: utcDateTime; +} + +model UnixTimestampArrayDatetimeProperty { + value: unixTimestampDatetime[]; +} + +@route("/property") +namespace Property { + @route("/default") + @scenario + @scenarioDoc(""" + Test operation with request and response model contains datetime property with default encode (rfc3339). + Expected request body: + ```json + { + "value": "2022-08-26T18:38:00.000Z" + } + ``` + Expected response body: + ```json + { + "value": "2022-08-26T18:38:00.000Z" + } + ``` + """) + @post + op default(@body body: DefaultDatetimeProperty): DefaultDatetimeProperty; + + @route("/rfc3339") + @scenario + @scenarioDoc(""" + Test operation with request and response model contains datetime property with rfc3339 encode. + Expected request body: + ```json + { + "value": "2022-08-26T18:38:00.000Z" + } + ``` + Expected response body: + ```json + { + "value": "2022-08-26T18:38:00.000Z" + } + ``` + """) + @post + op rfc3339(@body body: Rfc3339DatetimeProperty): Rfc3339DatetimeProperty; + + @route("/rfc7231") + @scenario + @scenarioDoc(""" + Test operation with request and response model contains datetime property with rfc7231 encode. + Expected request body: + ```json + { + "value": "Fri, 26 Aug 2022 14:38:00 GMT" + } + ``` + Expected response body: + ```json + { + "value": "Fri, 26 Aug 2022 14:38:00 GMT" + } + ``` + """) + @post + op rfc7231(@body body: Rfc7231DatetimeProperty): Rfc7231DatetimeProperty; + + @route("/unix-timestamp") + @scenario + @scenarioDoc(""" + Test operation with request and response model contains datetime property with unixTimestamp encode. + Expected request body: + ```json + { + "value": 1686566864 + } + ``` + Expected response body: + ```json + { + "value": 1686566864 + } + ``` + """) + @post + op unixTimestamp(@body body: UnixTimestampDatetimeProperty): UnixTimestampDatetimeProperty; + + @route("/unix-timestamp-array") + @scenario + @scenarioDoc(""" + Test operation with request and response model contains datetime array property with unixTimestamp encode. + Expected request body:f + ```json + { + "value": [1686566864, 1686734256] + } + ``` + Expected response body: + ```json + { + "value": [1686566864, 1686734256] + } + ``` + """) + @post + op unixTimestampArray( + @body body: UnixTimestampArrayDatetimeProperty, + ): UnixTimestampArrayDatetimeProperty; +} + +@route("/header") +namespace Header { + @route("/default") + @scenario + @scenarioDoc(""" + Test default encode (rfc7231) for datetime header. + Expected header: + value=Fri, 26 Aug 2022 14:38:00 GMT + """) + op default( + @header + value: utcDateTime, + ): NoContentResponse; + + @route("/rfc3339") + @scenario + @scenarioDoc(""" + Test rfc3339 encode for datetime header. + Expected header: + value=2022-08-26T18:38:00.000Z + """) + op rfc3339( + @header + @encode(DateTimeKnownEncoding.rfc3339) + value: utcDateTime, + ): NoContentResponse; + + @route("/rfc7231") + @scenario + @scenarioDoc(""" + Test rfc7231 encode for datetime header. + Expected header: + value=Fri, 26 Aug 2022 14:38:00 GMT + """) + op rfc7231( + @header + @encode(DateTimeKnownEncoding.rfc7231) + value: utcDateTime, + ): NoContentResponse; + + @route("/unix-timestamp") + @scenario + @scenarioDoc(""" + Test unixTimestamp encode for datetime header. + Expected header: + value=1686566864 + """) + op unixTimestamp( + @header + @encode(DateTimeKnownEncoding.unixTimestamp, int64) + value: utcDateTime, + ): NoContentResponse; + + @route("/unix-timestamp-array") + @scenario + @scenarioDoc(""" + Test unixTimestamp encode for datetime array header. + Expected header: + value=1686566864,1686734256 + """) + op unixTimestampArray( + @header + value: unixTimestampDatetime[], + ): NoContentResponse; +} + +model DefaultDatetimeHeader { + @header + value: utcDateTime; +} + +model Rfc3339DatetimeHeader { + @encode(DateTimeKnownEncoding.rfc3339) + @header + value: utcDateTime; +} + +model Rfc7231DatetimeHeader { + @encode(DateTimeKnownEncoding.rfc7231) + @header + value: utcDateTime; +} + +model UnixTimestampDatetimeHeader { + @encode(DateTimeKnownEncoding.unixTimestamp, int64) + @header + value: utcDateTime; +} + +@route("/responseheader") +namespace ResponseHeader { + @route("/default") + @scenario + @scenarioDoc(""" + Test default encode (rfc7231) for datetime header. + Expected response header: + value=Fri, 26 Aug 2022 14:38:00 GMT + """) + op default(): NoContentResponse & DefaultDatetimeHeader; + + @route("/rfc3339") + @scenario + @scenarioDoc(""" + Test rfc3339 encode for datetime header. + Expected response header: + value=2022-08-26T18:38:00.000Z + """) + op rfc3339(): NoContentResponse & Rfc3339DatetimeHeader; + + @route("/rfc7231") + @scenario + @scenarioDoc(""" + Test rfc7231 encode for datetime header. + Expected response header: + value=Fri, 26 Aug 2022 14:38:00 GMT + """) + op rfc7231(): NoContentResponse & Rfc7231DatetimeHeader; + + @route("/unix-timestamp") + @scenario + @scenarioDoc(""" + Test unixTimestamp encode for datetime header. + Expected response header: + value=1686566864 + """) + op unixTimestamp(): NoContentResponse & UnixTimestampDatetimeHeader; +} diff --git a/packages/http-client-python/alpha/output.yaml b/packages/http-client-python/alpha/output.yaml new file mode 100644 index 00000000000..37babd7d56f --- /dev/null +++ b/packages/http-client-python/alpha/output.yaml @@ -0,0 +1,83 @@ +namespace: type.file +clients: + - name: FileClient + description: Test for File type usage in request and response bodies + parameters: + - &ref_0 + optional: true + description: Service host + clientName: endpoint + inOverload: false + isApiVersion: false + isContinuationToken: false + type: &ref_1 + type: string + apiVersions: &ref_3 [] + wireName: endpoint + location: endpointPath + implementation: Client + clientDefaultValue: http://localhost:3000 + skipUrlEncoding: true + operationGroups: + - name: Body + className: Body + propertyName: Body + operations: + - url: /type/file/body/response/json-content-type + method: GET + parameters: + - *ref_0 + - optional: false + description: "" + clientName: accept + inOverload: false + isApiVersion: false + isContinuationToken: false + type: &ref_5 + type: constant + value: application/json + valueType: *ref_1 + apiVersions: &ref_2 [] + wireName: Accept + location: header + implementation: Method + explode: false + responses: + - headers: [] + statusCodes: + - 200 + discriminator: basic + type: &ref_4 + type: bytes + referredByOperationType: 2 + contentTypes: + - application/json + defaultContentType: application/json + exceptions: [] + groupName: Body + discriminator: basic + isOverload: false + overloads: [] + apiVersions: *ref_2 + wantTracing: true + exposeStreamKeyword: true + crossLanguageDefinitionId: Type.File.Body.downloadFileJsonContentType + samples: {} + internal: false + abstract: false + name: download_file_json_content_type + description: "" + clientNamespace: type.file.body + clientNamespace: type.file.body + url: "{endpoint}" + apiVersions: *ref_3 + arm: false + clientNamespace: type.file +types: + - type: string + - type: any-object + - type: any + - *ref_1 + - *ref_4 + - *ref_5 +crossLanguagePackageId: Type.File diff --git a/packages/http-client-python/alpha/tspconfig.yaml b/packages/http-client-python/alpha/tspconfig.yaml new file mode 100644 index 00000000000..7ebc55ac393 --- /dev/null +++ b/packages/http-client-python/alpha/tspconfig.yaml @@ -0,0 +1,2 @@ +emit: + - "@typespec/http-client-python" diff --git a/packages/http-client-python/emitter/src/types.ts b/packages/http-client-python/emitter/src/types.ts index ee1f514678b..b7f6f579106 100644 --- a/packages/http-client-python/emitter/src/types.ts +++ b/packages/http-client-python/emitter/src/types.ts @@ -465,12 +465,6 @@ function emitBuiltInType( ): Record { if (type.encode) { if (type.kind === "duration") { - if (type.encode === "seconds") { - return getSimpleTypeResult({ - type: sdkScalarKindToPythonKind[type.wireType.kind], - encode: type.encode, - }); - } if (type.encode === "ISO8601") { return getSimpleTypeResult({ type: type.kind, From adbd97aa6c3bea26dc50ba13c13161cff9607980 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Tue, 10 Feb 2026 04:01:11 +0000 Subject: [PATCH 5/5] update --- packages/http-client-python/alpha/client.tsp | 334 ------------------ packages/http-client-python/alpha/output.yaml | 83 ----- .../http-client-python/alpha/tspconfig.yaml | 2 - 3 files changed, 419 deletions(-) delete mode 100644 packages/http-client-python/alpha/client.tsp delete mode 100644 packages/http-client-python/alpha/output.yaml delete mode 100644 packages/http-client-python/alpha/tspconfig.yaml diff --git a/packages/http-client-python/alpha/client.tsp b/packages/http-client-python/alpha/client.tsp deleted file mode 100644 index c78fd9afbf1..00000000000 --- a/packages/http-client-python/alpha/client.tsp +++ /dev/null @@ -1,334 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -@doc("Test for encode decorator on datetime.") -@scenarioService("/encode/datetime") -namespace Encode.Datetime; - -@encode(DateTimeKnownEncoding.unixTimestamp, int64) -scalar unixTimestampDatetime extends utcDateTime; - -@route("/query") -namespace Query { - @route("/default") - @scenario - @scenarioDoc(""" - Test default encode (rfc3339) for datetime query parameter. - Expected query parameter: - value=2022-08-26T18:38:00.000Z - """) - op default( - @query - value: utcDateTime, - ): NoContentResponse; - - @route("/rfc3339") - @scenario - @scenarioDoc(""" - Test rfc3339 encode for datetime query parameter. - Expected query parameter: - value=2022-08-26T18:38:00.000Z - """) - op rfc3339( - @query - @encode(DateTimeKnownEncoding.rfc3339) - value: utcDateTime, - ): NoContentResponse; - - @route("/rfc7231") - @scenario - @scenarioDoc(""" - Test rfc7231 encode for datetime query parameter. - Expected query parameter: - value=Fri, 26 Aug 2022 14:38:00 GMT - """) - op rfc7231( - @query - @encode(DateTimeKnownEncoding.rfc7231) - value: utcDateTime, - ): NoContentResponse; - - @route("/unix-timestamp") - @scenario - @scenarioDoc(""" - Test unixTimestamp encode for datetime query parameter. - Expected query parameter: - value=1686566864 - """) - op unixTimestamp( - @query - @encode(DateTimeKnownEncoding.unixTimestamp, int64) - value: utcDateTime, - ): NoContentResponse; - - @route("/unix-timestamp-array") - @scenario - @scenarioDoc(""" - Test unixTimestamp encode for datetime array query parameter. - Expected query parameter: - value=1686566864, 1686734256 - """) - op unixTimestampArray( - @query - value: unixTimestampDatetime[], - ): NoContentResponse; -} - -model DefaultDatetimeProperty { - value: utcDateTime; -} - -model Rfc3339DatetimeProperty { - @encode(DateTimeKnownEncoding.rfc3339) - value: utcDateTime; -} - -model Rfc7231DatetimeProperty { - @encode(DateTimeKnownEncoding.rfc7231) - value: utcDateTime; -} - -model UnixTimestampDatetimeProperty { - @encode(DateTimeKnownEncoding.unixTimestamp, int64) - value: utcDateTime; -} - -model UnixTimestampArrayDatetimeProperty { - value: unixTimestampDatetime[]; -} - -@route("/property") -namespace Property { - @route("/default") - @scenario - @scenarioDoc(""" - Test operation with request and response model contains datetime property with default encode (rfc3339). - Expected request body: - ```json - { - "value": "2022-08-26T18:38:00.000Z" - } - ``` - Expected response body: - ```json - { - "value": "2022-08-26T18:38:00.000Z" - } - ``` - """) - @post - op default(@body body: DefaultDatetimeProperty): DefaultDatetimeProperty; - - @route("/rfc3339") - @scenario - @scenarioDoc(""" - Test operation with request and response model contains datetime property with rfc3339 encode. - Expected request body: - ```json - { - "value": "2022-08-26T18:38:00.000Z" - } - ``` - Expected response body: - ```json - { - "value": "2022-08-26T18:38:00.000Z" - } - ``` - """) - @post - op rfc3339(@body body: Rfc3339DatetimeProperty): Rfc3339DatetimeProperty; - - @route("/rfc7231") - @scenario - @scenarioDoc(""" - Test operation with request and response model contains datetime property with rfc7231 encode. - Expected request body: - ```json - { - "value": "Fri, 26 Aug 2022 14:38:00 GMT" - } - ``` - Expected response body: - ```json - { - "value": "Fri, 26 Aug 2022 14:38:00 GMT" - } - ``` - """) - @post - op rfc7231(@body body: Rfc7231DatetimeProperty): Rfc7231DatetimeProperty; - - @route("/unix-timestamp") - @scenario - @scenarioDoc(""" - Test operation with request and response model contains datetime property with unixTimestamp encode. - Expected request body: - ```json - { - "value": 1686566864 - } - ``` - Expected response body: - ```json - { - "value": 1686566864 - } - ``` - """) - @post - op unixTimestamp(@body body: UnixTimestampDatetimeProperty): UnixTimestampDatetimeProperty; - - @route("/unix-timestamp-array") - @scenario - @scenarioDoc(""" - Test operation with request and response model contains datetime array property with unixTimestamp encode. - Expected request body:f - ```json - { - "value": [1686566864, 1686734256] - } - ``` - Expected response body: - ```json - { - "value": [1686566864, 1686734256] - } - ``` - """) - @post - op unixTimestampArray( - @body body: UnixTimestampArrayDatetimeProperty, - ): UnixTimestampArrayDatetimeProperty; -} - -@route("/header") -namespace Header { - @route("/default") - @scenario - @scenarioDoc(""" - Test default encode (rfc7231) for datetime header. - Expected header: - value=Fri, 26 Aug 2022 14:38:00 GMT - """) - op default( - @header - value: utcDateTime, - ): NoContentResponse; - - @route("/rfc3339") - @scenario - @scenarioDoc(""" - Test rfc3339 encode for datetime header. - Expected header: - value=2022-08-26T18:38:00.000Z - """) - op rfc3339( - @header - @encode(DateTimeKnownEncoding.rfc3339) - value: utcDateTime, - ): NoContentResponse; - - @route("/rfc7231") - @scenario - @scenarioDoc(""" - Test rfc7231 encode for datetime header. - Expected header: - value=Fri, 26 Aug 2022 14:38:00 GMT - """) - op rfc7231( - @header - @encode(DateTimeKnownEncoding.rfc7231) - value: utcDateTime, - ): NoContentResponse; - - @route("/unix-timestamp") - @scenario - @scenarioDoc(""" - Test unixTimestamp encode for datetime header. - Expected header: - value=1686566864 - """) - op unixTimestamp( - @header - @encode(DateTimeKnownEncoding.unixTimestamp, int64) - value: utcDateTime, - ): NoContentResponse; - - @route("/unix-timestamp-array") - @scenario - @scenarioDoc(""" - Test unixTimestamp encode for datetime array header. - Expected header: - value=1686566864,1686734256 - """) - op unixTimestampArray( - @header - value: unixTimestampDatetime[], - ): NoContentResponse; -} - -model DefaultDatetimeHeader { - @header - value: utcDateTime; -} - -model Rfc3339DatetimeHeader { - @encode(DateTimeKnownEncoding.rfc3339) - @header - value: utcDateTime; -} - -model Rfc7231DatetimeHeader { - @encode(DateTimeKnownEncoding.rfc7231) - @header - value: utcDateTime; -} - -model UnixTimestampDatetimeHeader { - @encode(DateTimeKnownEncoding.unixTimestamp, int64) - @header - value: utcDateTime; -} - -@route("/responseheader") -namespace ResponseHeader { - @route("/default") - @scenario - @scenarioDoc(""" - Test default encode (rfc7231) for datetime header. - Expected response header: - value=Fri, 26 Aug 2022 14:38:00 GMT - """) - op default(): NoContentResponse & DefaultDatetimeHeader; - - @route("/rfc3339") - @scenario - @scenarioDoc(""" - Test rfc3339 encode for datetime header. - Expected response header: - value=2022-08-26T18:38:00.000Z - """) - op rfc3339(): NoContentResponse & Rfc3339DatetimeHeader; - - @route("/rfc7231") - @scenario - @scenarioDoc(""" - Test rfc7231 encode for datetime header. - Expected response header: - value=Fri, 26 Aug 2022 14:38:00 GMT - """) - op rfc7231(): NoContentResponse & Rfc7231DatetimeHeader; - - @route("/unix-timestamp") - @scenario - @scenarioDoc(""" - Test unixTimestamp encode for datetime header. - Expected response header: - value=1686566864 - """) - op unixTimestamp(): NoContentResponse & UnixTimestampDatetimeHeader; -} diff --git a/packages/http-client-python/alpha/output.yaml b/packages/http-client-python/alpha/output.yaml deleted file mode 100644 index 37babd7d56f..00000000000 --- a/packages/http-client-python/alpha/output.yaml +++ /dev/null @@ -1,83 +0,0 @@ -namespace: type.file -clients: - - name: FileClient - description: Test for File type usage in request and response bodies - parameters: - - &ref_0 - optional: true - description: Service host - clientName: endpoint - inOverload: false - isApiVersion: false - isContinuationToken: false - type: &ref_1 - type: string - apiVersions: &ref_3 [] - wireName: endpoint - location: endpointPath - implementation: Client - clientDefaultValue: http://localhost:3000 - skipUrlEncoding: true - operationGroups: - - name: Body - className: Body - propertyName: Body - operations: - - url: /type/file/body/response/json-content-type - method: GET - parameters: - - *ref_0 - - optional: false - description: "" - clientName: accept - inOverload: false - isApiVersion: false - isContinuationToken: false - type: &ref_5 - type: constant - value: application/json - valueType: *ref_1 - apiVersions: &ref_2 [] - wireName: Accept - location: header - implementation: Method - explode: false - responses: - - headers: [] - statusCodes: - - 200 - discriminator: basic - type: &ref_4 - type: bytes - referredByOperationType: 2 - contentTypes: - - application/json - defaultContentType: application/json - exceptions: [] - groupName: Body - discriminator: basic - isOverload: false - overloads: [] - apiVersions: *ref_2 - wantTracing: true - exposeStreamKeyword: true - crossLanguageDefinitionId: Type.File.Body.downloadFileJsonContentType - samples: {} - internal: false - abstract: false - name: download_file_json_content_type - description: "" - clientNamespace: type.file.body - clientNamespace: type.file.body - url: "{endpoint}" - apiVersions: *ref_3 - arm: false - clientNamespace: type.file -types: - - type: string - - type: any-object - - type: any - - *ref_1 - - *ref_4 - - *ref_5 -crossLanguagePackageId: Type.File diff --git a/packages/http-client-python/alpha/tspconfig.yaml b/packages/http-client-python/alpha/tspconfig.yaml deleted file mode 100644 index 7ebc55ac393..00000000000 --- a/packages/http-client-python/alpha/tspconfig.yaml +++ /dev/null @@ -1,2 +0,0 @@ -emit: - - "@typespec/http-client-python"