Azure / Azure/typespec-azure

[typespec-ts] Fix sample generation for data-plane services (contentType and bytes)

Open
#4,762 0 comments 0 reactions 1 assignee Claimed by @JialinHuang803 View on GitHub
emitter:typescript
Dominant language
TypeScript
Stars
27
Forks
90
Avg merge
1d 22h
Merged PRs (30d)
156

Description

## Overview

Umbrella tracking issue for fixing **sample generation** bugs in the TypeScript emitter (`@azure-tools/typespec-ts`) when emitting samples for data-plane services (`is-modular-library: true`). Migrated from [Azure/autorest.typescript](https://github.com/Azure/autorest.typescript), which is being retired in favor of this repo.

## Work items

- [ ] **`contentType` parameter missing in generated sample client method** — for operations with a `@header("Content-Type")` parameter (e.g. App Configuration `putKeyValue`), the generated sample omits the `contentType` argument.
- Migrated from Azure/autorest.typescript#3595

- [ ] **`bytes` is an unsupported encode in sample gen** — generated samples emit invalid `Buffer.from(..., "bytes")` for `bytes`-typed parameters (e.g. Load Testing `uploadTestFile`); a valid encoding should be used.
- Migrated from Azure/autorest.typescript#3609

## Context

These surfaced while enabling `is-modular-library: true` for data-plane services. Original tracking epic: Azure/autorest.typescript#3615.

## Notes

- Test coverage is tracked as part of each fix above, not as standalone issues.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.