-
Notifications
You must be signed in to change notification settings - Fork 41
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
Adding a legacy Required properties resource mix models #833
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
using TypeSpec.Http; | ||
using TypeSpec.Rest; | ||
using TypeSpec.OpenAPI; | ||
using Azure.ResourceManager.Foundations; | ||
using Azure.ResourceManager.Private; | ||
|
||
namespace Azure.ResourceManager.Legacy; | ||
|
||
//#region Standard Resource Operation Interfaces | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we supprot region in tsp? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove |
||
/** | ||
* Concrete tracked resource types can be created by aliasing this type using a specific property type. | ||
* | ||
* See more details on [different Azure Resource Manager resource type here.](https://azure.github.io/typespec-azure/docs/howtos/ARM/resource-type) | ||
* @template Properties A model containing the provider-specific properties for this resource | ||
*/ | ||
@doc("Concrete tracked resource types can be created by aliasing this type using a specific property type.") | ||
markcowl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@armResourceInternal(Properties) | ||
@includeInapplicableMetadataInPayload(false) | ||
model TrackedResourceWithRequiredProperties<Properties extends {}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we put There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel the namespace being legacy which has good separation. It is targeted for brownfield. Unless ARM has disallowed required properties (currently they don't) we probably don't want to put deprecate. |
||
extends Foundations.TrackedResource { | ||
@doc("The resource-specific required properties for this resource.") | ||
@extension("x-ms-client-flatten", true) | ||
properties: Properties; | ||
} | ||
|
||
/** | ||
* Concrete proxy resource types can be created by aliasing this type using a specific property type. | ||
* | ||
* See more details on [different Azure Resource Manager resource type here.](https://azure.github.io/typespec-azure/docs/howtos/ARM/resource-type) | ||
* @template Properties A model containing the provider-specific properties for this resource | ||
*/ | ||
@doc("Concrete proxy resource types can be created by aliasing this type using a specific property type.") | ||
@armResourceInternal(Properties) | ||
@includeInapplicableMetadataInPayload(false) | ||
model ProxyResourceWithRequiredProperties<Properties extends {}> extends Foundations.ProxyResource { | ||
@doc("The resource-specific required properties for this resource.") | ||
@extension("x-ms-client-flatten", true) | ||
properties: Properties; | ||
} | ||
|
||
/** | ||
* Concrete extension resource types can be created by aliasing this type using a specific property type. | ||
* | ||
* See more details on [different Azure Resource Manager resource type here.](https://azure.github.io/typespec-azure/docs/howtos/ARM/resource-type) | ||
* @template Properties A model containing the provider-specific properties for this resource | ||
*/ | ||
@extensionResource | ||
@doc("Concrete extension resource types can be created by aliasing this type using a specific property type.") | ||
@armResourceInternal(Properties) | ||
@includeInapplicableMetadataInPayload(false) | ||
model ExtensionResourceWithRequiredProperties<Properties extends {}> | ||
extends Foundations.ExtensionResource { | ||
@doc("The resource-specific required properties for this resource.") | ||
@extension("x-ms-client-flatten", true) | ||
properties: Properties; | ||
} | ||
//#region | ||
|
||
//#region Standard extraction models |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,7 +40,7 @@ model ResourceNameParameter< | |
@armResourceInternal(Properties) | ||
@includeInapplicableMetadataInPayload(false) | ||
model TrackedResource<Properties extends {}> extends Foundations.TrackedResource { | ||
@doc("The resource-specific properties for this resource.") | ||
@doc("The resource-specific optional properties for this resource.") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think these doc updates are necessary. The typespec and the swagger already say it is optional, adding the documentation makes swagger changes without adding any information. |
||
@visibility("read", "create") | ||
@extension("x-ms-client-flatten", true) | ||
properties?: Properties; | ||
|
@@ -56,7 +56,7 @@ model TrackedResource<Properties extends {}> extends Foundations.TrackedResource | |
@armResourceInternal(Properties) | ||
@includeInapplicableMetadataInPayload(false) | ||
model ProxyResource<Properties extends {}> extends Foundations.ProxyResource { | ||
@doc("The resource-specific properties for this resource.") | ||
@doc("The resource-specific optional properties for this resource.") | ||
@visibility("read", "create") | ||
@extension("x-ms-client-flatten", true) | ||
properties?: Properties; | ||
|
@@ -73,7 +73,7 @@ model ProxyResource<Properties extends {}> extends Foundations.ProxyResource { | |
@armResourceInternal(Properties) | ||
@includeInapplicableMetadataInPayload(false) | ||
model ExtensionResource<Properties extends {}> extends Foundations.ExtensionResource { | ||
@doc("The resource-specific properties for this resource.") | ||
@doc("The resource-specific optional properties for this resource.") | ||
@visibility("read", "create") | ||
@extension("x-ms-client-flatten", true) | ||
properties?: Properties; | ||
|
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.
For legacy, I think we are still leaving out scenarios where folks extend Resource or EntityResource. I would prefer it if we just let them extend a common-types resource type, and added a new decorator they would need to decorate the type with that is the equivalent of
@armResourceInternal
and@includeInapplicableMetadataInPayload
, and relax the rules around extension to include this case.