Skip to content

docs: add Rust client emitter documentation#10974

Open
Copilot wants to merge 3 commits into
mainfrom
copilot/update-typespec-rust-documentation
Open

docs: add Rust client emitter documentation#10974
Copilot wants to merge 3 commits into
mainfrom
copilot/update-typespec-rust-documentation

Conversation

Copilot AI commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Adds Rust (@azure-tools/typespec-rust) to the client emitters introduction page and creates a dedicated http-client-rust reference subdirectory, on par with the existing JS, Python, Java, and C# sections.

Changes to website/src/content/docs/docs/emitters/clients/introduction.mdx

  • Overview — Updated intro text and emitters table to include Rust with a live npm version badge

  • Settings section — New ### Rust Client Emitter Settings subsection documenting all emitter options from lib.ts:

    Option Type Default
    crate-name string
    crate-version string
    omit-constructors boolean false
    overwrite-cargo-toml boolean false
    overwrite-lib-rs boolean false
    emit-error-traits boolean false
  • Example section — Full 3-step example (install → tspconfig.yaml → compile) parallel to the existing language examples, with version pinned to ^0.41.0:

    emit:
      - "@azure-tools/typespec-rust"
    options:
      "@azure-tools/typespec-rust":
        emitter-output-dir: "{project-root}/clients/rust"
        crate-name: "my-service-client"
        crate-version: "0.1.0"
  • Multi-emitter CLI example — Added Rust to the combined emit + options block

  • Disclaimer — Added link to the TypeSpec Rust emitter README

  • package.json snippet — Added @azure-tools/typespec-rust: "^0.41.0" to the dependency example

New: website/src/content/docs/docs/emitters/clients/http-client-rust/reference/

Three reference files parallel to the other language subdirectories:

  • index.mdx — Overview page with npm install tabs (in a spec vs in a library) and links to the emitter and decorator reference pages.

  • emitter.md — Emitter usage (CLI and tspconfig.yaml config) plus all documented options: emitter-output-dir, crate-name (required), crate-version (required), omit-constructors, overwrite-cargo-toml, overwrite-lib-rs, emit-error-traits, and temp-omit-doc-links.

  • decorators.md — Documents the decorators the Rust emitter recognizes, identified from decorator.name patterns in packages/typespec-rust/src/tcgcadapter/adapter.ts:

    • @@clientOption (TCGC) with Rust-specific named options: omitEndpointMethod (on clients), forcePageIterator (on paging operations), deserialize_with / serialize_with (on model properties)
    • @deserializeEmptyStringAsNull (TCGC) — on model properties; deserializes "" as None
    • @clientName (TCGC) — on clients/operations; overrides auto-generated Rust names
    • XML decorators (@encodedName, TypeSpec.Xml.@name, @attribute, @unwrapped) — affect XML serialization output

Changes to website/src/content/current-sidebar.ts

  • Added Rust entry using createLibraryReferenceStructure so the new reference pages appear in the website navigation under Clients with a "preview" badge.

Co-authored-by: heaths <1532486+heaths@users.noreply.github.com>
Copilot AI changed the title [WIP] Add documentation for Rust client emitter docs: add Rust client emitter documentation Jun 11, 2026
@microsoft-github-policy-service microsoft-github-policy-service Bot added the meta:website TypeSpec.io updates label Jun 11, 2026
Copilot AI requested a review from heaths June 11, 2026 22:48
@heaths heaths requested a review from jhendrixMSFT June 11, 2026 22:55

@heaths heaths left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@copilot also create an http-client-rust subdirectory next to introduction.mdx with relevant files as other languages have containing installation instructions, all documented emitter options, and decorators. You can identify decorators if you search code in https://github.com/Azure/typespec-rust under the packages/typespec-rust/src directory for patterns like decorators.filter((decorator) => decorator.name === 'Azure.ClientGenerator.Core.@clientOption') for which decorators we support. Summarize what they are for.

Besides the link, the rest of the changes to introduction.mdx are fine so leave them.

Comment thread website/src/content/docs/docs/emitters/clients/introduction.mdx Outdated
Comment thread website/src/content/docs/docs/emitters/clients/introduction.mdx Outdated
Co-authored-by: heaths <1532486+heaths@users.noreply.github.com>

Copilot AI commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

@copilot also create an http-client-rust subdirectory next to introduction.mdx with relevant files as other languages have containing installation instructions, all documented emitter options, and d...

Created website/src/content/docs/docs/emitters/clients/http-client-rust/reference/ with three files, mirroring the structure of the other language subdirectories:

  • index.mdx — Overview page with npm install tabs (spec vs library) and links to emitter/decorator docs.
  • emitter.md — Emitter usage (CLI and tspconfig.yaml config) plus all documented options: emitter-output-dir, crate-name (required), crate-version (required), omit-constructors, overwrite-cargo-toml, overwrite-lib-rs, emit-error-traits, and temp-omit-doc-links.
  • decorators.md — Summarizes the decorators the Rust emitter recognizes, found by searching for decorator.name patterns in packages/typespec-rust/src/tcgcadapter/adapter.ts:
    • @@clientOption (TCGC) — with Rust-specific named options: omitEndpointMethod (on clients), forcePageIterator (on paging operations), deserialize_with / serialize_with (on model properties).
    • @deserializeEmptyStringAsNull (TCGC) — on model properties; deserializes "" as None.
    • @clientName (TCGC) — on clients/operations; overrides auto-generated Rust names.
    • XML decorators (@encodedName, TypeSpec.Xml.@name, @attribute, @unwrapped) — affect XML serialization.

Also added Rust to current-sidebar.ts so it appears in the site navigation.

Copilot AI requested a review from heaths June 11, 2026 23:15
@heaths heaths requested a review from xirzec June 11, 2026 23:27
@heaths heaths marked this pull request as ready for review June 11, 2026 23:28
@azure-sdk-automation

Copy link
Copy Markdown

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

@timotheeguerin

timotheeguerin commented Jun 12, 2026

Copy link
Copy Markdown
Member

did you ask copilot to use tspd to generate the emitter-usage doc? it is a bit different format than the latest version(doesn't include default for example)
image

Example of how it is called for js emitter

"regen-docs": "tspd doc . --enable-experimental --output-dir ../../website/src/content/docs/docs/emitters/clients/http-client-js/reference --skip-js",

I think this also is in wrong repo as its an azure emitter we should have that in the azure docs, there is no unbranded rust right?

@heaths

heaths commented Jun 12, 2026

Copy link
Copy Markdown
Member

I gave it context to our guidelines (if needed - didn't see them linked), specific files in our emitter repo, introduction.mdx, and a couple language directories and more or less said "make it look like these" (more, actually, but that's the gist.

Rust does have unbranded crates, but I don't think the emitter support it currently.

Can you leave PR feedback next time? Makes it hard to reply to or ask of specific comments otherwise.

But I'm looking at the rendered page and see no unexpected diffs from "CSharp" (honestly, why isn't this "C#" - the actual Microsoft brand name of the language?).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

meta:website TypeSpec.io updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants