Skip to content
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

Remove restrictions armresourcelist #1674

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

AlitzelMendez
Copy link
Member

@AlitzelMendez AlitzelMendez commented Oct 11, 2024

issue: #262

@azure-sdk
Copy link
Collaborator

All changed packages have been documented.

  • @azure-tools/typespec-azure-resource-manager
Show changes

@azure-tools/typespec-azure-resource-manager - feature ✏️

Remove restrictions requiring Foundation.Resource in ArmResourceListByParent. This will allow using the template for non-standard resources / collection actions that return a list.

@azure-sdk
Copy link
Collaborator

You can try these changes here

🛝 Playground 🌐 Website 📚 Next docs

@@ -293,7 +293,7 @@ model ResourceKindProperty {
*/
@doc("The response of a {name} list operation.", Resource)
@friendlyName("{name}ListResult", Resource)
model ResourceListResult<Resource extends Foundations.Resource> is Azure.Core.Page<Resource>;
model ResourceListResult<Resource extends {}> is Azure.Core.Page<Resource>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is some issue with this. If the intension has been to support scalar or array types, it would not work. Playground. In addition, Azure.Core.Page<T extends Model>, making this would fail in Azure.Core as well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{} and Model are equivalent constraints. Also, this handles most list cases. If we want to open up the paged data to be any type (or scalar and model types), we can use our own custom page. Here is a playground showing the definition for ResourceListResult working with Page<T> and a completely custom paged result.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mark for this approach, are you thinking on creating a new operation or do we still see this as an update on ArmResourceListByParent operation?
if we update on ArmResourceListByParent, is there a way to do it without being a breaking change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove restrictions requiring 'id' and 'type' properties in ArmResourceListByParent
4 participants