Skip to content

Codegen does not implement @clientDefaultValue decorator #898

@RickWinter

Description

@RickWinter

Summary

The Rust emitter does not implement the @clientDefaultValue TypeSpec decorator. Parameters and model properties annotated with @clientDefaultValue are generated as plain Option<T> 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<T> 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.

Metadata

Metadata

Assignees

Labels

CodeGenIssues that relate to code generationbugThis issue requires a change to an existing behavior in the product in order to be resolved.

Type

No type

Projects

Status

Untriaged

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions