Skip to content

Provisioning generator: inherited properties missing from generated models #57119

@ArcturusZhang

Description

@ArcturusZhang

Description

When a TypeSpec model inherits properties from a base model (via \�aseModel), the provisioning generator only emits the model's own properties, dropping all inherited ones.

For example, \SecretAttributes\ inherits 5 properties (\Created, \Enabled, \Expires, \NotBefore, \Updated) from \SecretBaseAttributes, but the generated class has none of them.

Root Cause

Two issues:

  1. \ProvisioningModelProvider.BuildProperties()\ only iterates _inputModel.Properties, which contains only the model's own properties — not those inherited from \�aseModel.

  2. \InheritableSystemObjectModelVisitor\ (inherited from mgmt generator) strips properties matching the base model's properties. This is correct for mgmt (where C# inheritance mirrors TypeSpec), but wrong for provisioning (where all models use \ProvisionableConstruct\ as C# base).

Fix

  1. Walk the \�aseModel\ chain to collect all inherited properties.
  2. Remove \InheritableSystemObjectModelVisitor\ from provisioning generator since provisioning models don't use C# model inheritance.

Impact

Any provisioning model that inherits properties from a base model will be missing those properties.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue requires a change to an existing behavior in the product in order to be resolved.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions