-
Notifications
You must be signed in to change notification settings - Fork 742
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resource model envelope properties #5065
base: main
Are you sure you want to change the base?
Conversation
pshao25
commented
Jan 27, 2025
- If the common type is not in v3-v6, set it to v3, otherwise we cannot extend the resource model from arm library.
- If the property in the resource model can be replaced by the envelop property from arm library, then use the envelope property, otherwise remain the same.
@@ -74,19 +74,6 @@ union ProvisioningState { | |||
Scaling: "Scaling", | |||
} | |||
|
|||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected. We changed the behavior to setting common type version v3. so that we could leverage the models from arm library.
*/ | ||
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "For backward compatibility" | ||
@visibility("read") | ||
etag?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to confirm if it could be replaced by EntityTagProperty
, since in the EntityTagProperty
, the name is eTag
. Capital "T".
@@ -13,6 +13,7 @@ namespace Azure.ResourceManager.Authorization; | |||
/** | |||
* Deny Assignment | |||
*/ | |||
@extensionResource |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected. It is extension resource.
@@ -20,8 +20,7 @@ model ArrayDefault | |||
...ResourceNameParameter< | |||
Resource = ArrayDefault, | |||
KeyName = "name", | |||
SegmentName = "arraydefaults", | |||
NamePattern = "^[a-zA-Z0-9-]{3,24}$" | |||
SegmentName = "arraydefaults" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default value for NamePattern
is "^[a-zA-Z0-9-]{3,24}$"
else return `${generateSuppressionForDocumentRequired()}\n${kv}`; | ||
else | ||
return `${generateSuppressions([ | ||
getSuppresssionWithCode("@azure-tools/typespec-azure-core/documentation-required"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider to declare a const string "@azure-tools/typespec-azure-core/documentation-required" to avoid the duplicates
let capacityFound = false; | ||
|
||
for (const property of schema.properties) { | ||
if (property.serializedName === "name" && property.required && property.schema.type === "string") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering how we define the replacement.
Here we check if schema contains all properties of Sku, but what if there is more properties in schema, can we replace it with Sku?
And also, instead of hard-code all the property name and types, is it possible to get the defined schemas and compare them instead?