Azure / Azure/typespec-rust

Codegen does not implement @clientDefaultValue decorator

Open
#898 2 comments 1 reaction 0 assignees View on GitHub
bug CodeGen
Dominant language
Rust
Stars
7
Forks
11
Avg merge
2d 5h
Merged PRs (30d)
5

Description

## Summary

The Rust emitter does not implement the `@clientDefaultValue` TypeSpec decorator. Parameters and model properties annotated with `@clientDefaultValue` are generated as plain `Option` fields with no default values applied.

## Expected behavior

- Options structs: Fields with `@clientDefaultValue` should have their defaults pre-populated in the Default trait implementation.
- Model structs: Fields with `@clientDefaultValue` (e.g. retry, tier, timeout on ModelWithDefaultValues) should be pre-populated with their default values in the Default impl.
- Client methods: When the user does not provide a value, the generated client should automatically apply the declared default before sending the request.

## Actual behavior

All `@clientDefaultValue` fields are generated as `Option` defaulting to None. Callers must manually provide the default values.

## Affected crate

`test/spector/azure/client-generator-core/client-default-value`

## Test impact

Several integration tests in this crate have been disabled with `#[ignore]` because they were working around this limitation by manually providing default values. See the test file for details.

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.