Skip to content

[TCGC] Full support Http.File#3876

Merged
tadelesh merged 8 commits intomainfrom
copilot/support-file-representations
Feb 3, 2026
Merged

[TCGC] Full support Http.File#3876
tadelesh merged 8 commits intomainfrom
copilot/support-file-representations

Conversation

Copy link
Contributor

Copilot AI commented Feb 2, 2026

  • Add isText, contentTypes, and filename properties to BinarySerializationOptions
  • Change filename from string to ModelProperty type
  • Move file serialization logic from http.ts to updateSerializationOptions in types.ts
  • Skip json/xml serialization options for file types
  • Fix headers auto-generated from File type (like Content-Type, Content-Disposition) to have correct serializedName
  • Update tests for the new filename type
  • Format code
  • Update changeset
Original prompt

This section details on the original issue you should resolve

<issue_title>Support File to represent file input and output in request/response body TCGC Implementation</issue_title>
<issue_description>The file usage doc is here.

Works in TCGC:

  1. In http.ts, the serialization options set needs to be moved to type.ts. Needs to check if methodParameterSegments has correctly deal with the file type body parameter.
  2. For file binary serialization options, needs to add contentTypes, filename, isText, etc. info from HttpOperationFileBody.
  3. Ensure all the implementation in TCGC follow the file usage doc correctly.</issue_description>

<agent_instructions>Make sure build and all tests pass for TCGC. Use pnpm -w format and pnpm -w change add to format the code and add changeset.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits February 2, 2026 04:12
…for file types

Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com>
…eScript errors

Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com>
Copilot AI changed the title [WIP] Support file representation for input and output in TCGC Add isText and contentTypes to BinarySerializationOptions for file types Feb 2, 2026
Copilot AI requested a review from tadelesh February 2, 2026 04:23
Copy link
Member

@tadelesh tadelesh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot You also need to add filename.

Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 2, 2026

@copilot You also need to add filename.

Added filename property to BinarySerializationOptions in commit a4a4737. It contains the name of the property that represents the filename in the file model (e.g., "filename").

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • telemetry.astro.build
    • Triggering command: /usr/local/bin/node node /home/REDACTED/work/typespec-azure/typespec-azure/website/node_modules/.bin/../astro/astro.js build sh ical/node_modules/.bin/../@typespec/tspd/cmd/tspd.js lmstxt --output-dir ../../website/src/content/docs/docs/libraries/http/reference sh /snap/bin/node pnpm gen-extern-sh ce modules/.bin/sh node c-cl�� ../../website/src/content/docs/docs/libraries/sse/reference ./schema/autorest-openapi-schema.tsp n/node xtern-signature sh node nerator-core/reftspd doc . --enable-experimental --output-dir ../../website/src/content/docs/docs/libraries/azure-portal-core/reference sh (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from tadelesh February 2, 2026 05:37
@tadelesh tadelesh changed the title Add isText and contentTypes to BinarySerializationOptions for file types [TCGC] Full support Http.File Feb 2, 2026
@microsoft-github-policy-service microsoft-github-policy-service bot added the lib:tcgc Issues for @azure-tools/typespec-client-generator-core library label Feb 2, 2026
Copy link
Member

@tadelesh tadelesh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Resolve the comments.

…zation to types.ts

Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 2, 2026

@copilot Resolve the comments.

Resolved in commit f6dcd8d.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • telemetry.astro.build
    • Triggering command: /usr/local/bin/node node /home/REDACTED/work/typespec-azure/typespec-azure/website/node_modules/.bin/../astro/astro.js build node ical/node_modules/.bin/../@typespec/tspd/cmd/tspd.js website/src/content/docs/docs/libraries/azure-resource-manager/reference ./schema/autorest-openapi-schema.tsp .0_tmp_3816/node_modules/pnpm/dist/node-gyp-bin/node perimental gen-esh ce _modules/pnpm/ditspd doc . --enable-experimental --output-dir ../../website/src/content/docs/docs/emitters/typespec-azure-rulesets/reference sh c-cl�� l --llmstxt --output-dir ../../w--llmstxt node _modules/pnpm/dist/node-gyp-bin/node /typespec-azure-sh brary nerator-core/reftspd doc . --enable-experimental --output-dir ../../website/src/content/docs/docs/libraries/azure-portal-core/reference node (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from tadelesh February 2, 2026 06:22
@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 2, 2026

Open in StackBlitz

npm i https://pkg.pr.new/Azure/typespec-azure/@azure-tools/typespec-client-generator-core@3876

commit: db5717a

@tadelesh
Copy link
Member

tadelesh commented Feb 2, 2026

@copilot Please also fix a related bug in this PR:
When using File<"application/xml">, a content type header will be auto added. But after TCGC processing, this header does not have the serializedName, you need to deal with the header added from File type. This could also happen for Content-Disposition header.

Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 2, 2026

@copilot Please also fix a related bug in this PR:
When using File<"application/xml">, a content type header will be auto added. But after TCGC processing, this header does not have the `serialized...

Fixed in commit f2563fe. Headers auto-generated from File type (like Content-Type and Content-Disposition) now have the correct serializedName by using the header name from HttpOperationHeaderParameter when available.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • telemetry.astro.build
    • Triggering command: /usr/local/bin/node node /home/REDACTED/work/typespec-azure/typespec-azure/website/node_modules/.bin/../astro/astro.js build sed ore/node_modules/.bin/../@typespec/tspd/cmd/tspd.js lmstxt --output-dir ../../website/src/content/docs/docs/libraries/http/reference sh k/typespec-azure/typespec-azure/node_modules/.bi--filter tsp compile . --sh sh st/node-gyp-bin/tspd doc . --enable-experimental --output-dir ../../website/src/content/docs/docs/emitters/typespec-azure-rulesets/reference node c-cl�� ../../website/src/content/docs/docs/libraries/sse/reference brary /typespec-azure/website/node_modules/.bin/node /typespec-azure-sh @typespec/librar-c nerator-core/reftspd doc . --enable-experimental --output-dir ../../website/src/content/docs/docs/libraries/azure-portal-core/reference node (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com>
Copilot AI requested a review from tadelesh February 2, 2026 07:04
@tadelesh tadelesh marked this pull request as ready for review February 2, 2026 07:10
@azure-sdk
Copy link
Collaborator

All changed packages have been documented.

  • @azure-tools/typespec-client-generator-core
Show changes

@azure-tools/typespec-client-generator-core - feature ✏️

Add full support for Http.File type with BinarySerializationOptions containing isText, contentTypes, and filename properties.

@azure-sdk
Copy link
Collaborator

You can try these changes here

🛝 Playground 🌐 Website

@tadelesh tadelesh added this pull request to the merge queue Feb 3, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Feb 3, 2026
@tadelesh tadelesh added this pull request to the merge queue Feb 3, 2026
Merged via the queue into main with commit 57c7643 Feb 3, 2026
28 checks passed
@tadelesh tadelesh deleted the copilot/support-file-representations branch February 3, 2026 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lib:tcgc Issues for @azure-tools/typespec-client-generator-core library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support File to represent file input and output in request/response body TCGC Implementation

4 participants