This affects specification/management/resource-manager/Microsoft.Management/ManagementGroups:
/**
* The generic properties of a management group used during creation.
*/
model CreateManagementGroupProperties {
/**
* The AAD Tenant ID associated with the management group. For example, 00000000-0000-0000-0000-000000000000
*/
@visibility(Lifecycle.Read)
tenantId?: string;
/**
* The friendly name of the management group. If no value is passed then this field will be set to the groupId.
*/
#suppress "@azure-tools/typespec-azure-core/no-nullable" "For backward compatibility"
displayName?: string | null;
/**
* The details of a management group used during creation.
*/
details?: CreateManagementGroupDetails;
/**
* The list of children.
*/
#suppress "@azure-tools/typespec-azure-core/no-nullable" "For backward compatibility"
@visibility(Lifecycle.Read)
children?: CreateManagementGroupChildInfo[] | null;
}
...
/**
* The child information of a management group used during creation.
*/
model CreateManagementGroupChildInfo {
/**
* The fully qualified resource type which includes provider namespace (e.g. Microsoft.Management/managementGroups)
*/
@visibility(Lifecycle.Read)
type?: ManagementGroupChildType;
/**
* The fully qualified ID for the child resource (management group or subscription). For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000
*/
@visibility(Lifecycle.Read)
id?: string;
/**
* The name of the child entity.
*/
@visibility(Lifecycle.Read)
name?: string;
/**
* The friendly name of the child resource.
*/
@visibility(Lifecycle.Read)
displayName?: string;
/**
* The list of children.
*/
@visibility(Lifecycle.Read)
children?: CreateManagementGroupChildInfo[];
}
it generates the following (correctly)
/// The generic properties of a management group used during creation.
#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)]
pub struct CreateManagementGroupProperties {
/// The list of children.
///
/// Operational visibility: Read
#[serde(skip_serializing_if = "Option::is_none")]
pub children: Option<Vec<CreateManagementGroupChildInfo>>, // <-- CreateManagementGroupChildInfo is nowhere to be found
/// The details of a management group used during creation.
#[serde(skip_serializing_if = "Option::is_none")]
pub details: Option<CreateManagementGroupDetails>,
/// The friendly name of the management group. If no value is passed then this field will be set to the groupId.
#[serde(rename = "displayName", skip_serializing_if = "Option::is_none")]
pub display_name: Option<String>,
/// The AAD Tenant ID associated with the management group. For example, 00000000-0000-0000-0000-000000000000
///
/// Operational visibility: Read
#[serde(rename = "tenantId", skip_serializing_if = "Option::is_none")]
pub tenant_id: Option<String>,
}
But the problem is that CreateManagementGroupChildInfo is not in the models.rs file:
error[E0412]: cannot find type `CreateManagementGroupChildInfo` in this scope
--> spec\rmMgmtGroups\src\generated\models\models.rs:96:30
|
96 | pub children: Option<Vec<CreateManagementGroupChildInfo>>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
567 | pub struct ManagementGroupChildInfo {
| ----------------------------------- similarly named struct `ManagementGroupChildInfo` defined here
|
help: a struct with a similar name exists
|
96 - pub children: Option<Vec<CreateManagementGroupChildInfo>>,
96 + pub children: Option<Vec<ManagementGroupChildInfo>>,
|
help: you might be missing a type parameter
|
91 | pub struct CreateManagementGroupProperties<CreateManagementGroupChildInfo> {
| ++++++++++++++++++++++++++++++++
Note: ManagementGroupChildInfo is a different type, described the same way:
/**
* The child information of a management group.
*/
model ManagementGroupChildInfo {
/**
* The fully qualified resource type which includes provider namespace (e.g. Microsoft.Management/managementGroups)
*/
type?: ManagementGroupChildType;
/**
* The fully qualified ID for the child resource (management group or subscription). For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000
*/
id?: string;
/**
* The name of the child entity.
*/
name?: string;
/**
* The friendly name of the child resource.
*/
displayName?: string;
/**
* The list of children.
*/
children?: ManagementGroupChildInfo[];
}
And that one does get generated:
/// The child information of a management group.
#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)]
#[non_exhaustive]
pub struct ManagementGroupChildInfo {
/// The list of children.
#[serde(skip_serializing_if = "Option::is_none")]
pub children: Option<Vec<ManagementGroupChildInfo>>,
/// The friendly name of the child resource.
#[serde(rename = "displayName", skip_serializing_if = "Option::is_none")]
pub display_name: Option<String>,
/// The fully qualified ID for the child resource (management group or subscription). For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000
#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
/// The name of the child entity.
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
/// The fully qualified resource type which includes provider namespace (e.g. Microsoft.Management/managementGroups)
#[serde(rename = "type", skip_serializing_if = "Option::is_none")]
pub type_prop: Option<ManagementGroupChildType>,
}
I was thinking that's because CreateManagementGroupChildInfo has an array of CreateManagementGroupChildInfo[] inside itself, but no - you can see that ManagementGroupChildInfo got the same, and that one does get generated.
This affects
specification/management/resource-manager/Microsoft.Management/ManagementGroups:it generates the following (correctly)
But the problem is that
CreateManagementGroupChildInfois not in themodels.rsfile:Note:
ManagementGroupChildInfois a different type, described the same way:And that one does get generated:
I was thinking that's because
CreateManagementGroupChildInfohas an array ofCreateManagementGroupChildInfo[]inside itself, but no - you can see thatManagementGroupChildInfogot the same, and that one does get generated.