Azure / Azure/azure-rest-api-specs
[BUG] AzureActiveDirectory.CIAMResourceSKU has wrong x-ms-client-flatten on "tier"
- Dominant language
- TypeSpec
- Stars
- 3.1k
- Forks
- 5.9k
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 444
Description
### API Spec link
https://github.com/Azure/azure-rest-api-specs/blob/main/specification/cpim/resource-manager/Microsoft.AzureActiveDirectory/preview/2023-05-17-preview/externalIdentities.json#L1506
### API Spec version
2023-05-17-preview
### Describe the bug
The properties of `CIAMResourceSKU ` are defined as such:
```json
"properties": {
"name": {
"type": "string",
"description": "The name of the SKU for the tenant.",
"enum": [
"Standard",
"PremiumP1",
"PremiumP2"
],
"x-ms-enum": {
"name": "CIAMResourceSKUName",
"modelAsString": true
}
},
"tier": {
"type": "string",
"description": "The tier of the tenant.",
"enum": [
"A0"
],
"x-ms-mutability": [
"create",
"read"
],
"x-ms-client-flatten": true, // <--------
"x-ms-enum": {
"name": "CIAMResourceSKUTier",
"modelAsString": true,
"values": [
{
"value": "A0",
"description": "The SKU tier used for all Azure AD for customers tenants."
}
]
}
}
```
Note that `tier` is annotated with `x-ms-client-flatten`, while `name` is not. This annotation seems wrong because both properties are part of the SKU. The Azure portal JSON view also shows this:
```json
"sku": {
"name": "Base",
"tier": "A0"
},
```
### Expected behavior
Tools parsing the spec can correctly construct a SKU object for CIAMResource like
```json
"sku": {
"name": "Base",
"tier": "A0"
},
```
### Actual behavior
Tools parsing the spec construct a SKU object for CIAMResource with missing `tier` because it's flattened, like
```json
"sku": {
"name": "Base",
},
```
This leads to a 400 Bad Request response from Azure when creating a CIAMResource:
```json
{"additionalInfo":null,"code":"InvalidProperties","details":null,"message":"The Tier field is required.","target":"createCIAMRequest.Sku.Tier"}
```
### Reproduction Steps
To reproduce the Azure API error, run the [create example](https://github.com/Azure/azure-rest-api-specs/blob/main/specification/cpim/resource-manager/Microsoft.AzureActiveDirectory/preview/2023-05-17-preview/examples/CIAM/createCIAMTenant.json) with the `tier` property removed.
Reproducing the flattening depends on the tool used to parse the spec. For instance, Pulumi encounters this error in pulumi/pulumi-azure-native#3556.
### Environment
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.