Skip to content

Add linter rule to suggest the scope parameter #765

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

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

Conversation

bdefoy
Copy link
Member

@bdefoy bdefoy commented Jan 25, 2025

Add a rule that helps disambiguate paths that share the same /providers suffix by suggesting the use of the scope parameter.

@bdefoy bdefoy marked this pull request as ready for review January 28, 2025 19:45
Copy link
Member

@mikeharder mikeharder left a comment

Choose a reason for hiding this comment

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

@bdefoy bdefoy requested a review from Copilot January 28, 2025 20:15
## How to fix

Remove all explicitly-scoped paths that only vary in scope and create a path with the `scope` parameter.

Copy link
Member

@rkmanda rkmanda Jan 29, 2025

Choose a reason for hiding this comment

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

This may not be a good idea from a customer viewpoint as it makes it less obvious as to what scopes are truly supported. Before we decide one way or the other, lets first check how TypeSpec generates the different API paths for this scenario and align the linter rules to work with that.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't see support in TypeSpec for the scope parameter, but I'm also not seeing how you can generate a spec with a resource at multiple scopes aside from extension resources. I might look into this a bit more and follow up

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure that there is any use of a scope parameter outside of extension resources. I have not been able to find one in the private API specs repo yet, and I'm not sure how it would fit with the RPC.

Copy link
Member Author

Choose a reason for hiding this comment

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

The scenario described in #750 is a rare case where an RP is attempting to basically duplicate endpoints. I will change the rule to look for duplicate endpoints like this.

Copy link
Member

@rkmanda rkmanda left a comment

Choose a reason for hiding this comment

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

🕐

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.

[GetCollectionResponseSchema] Does not disambiguate paths that share the same "/providers" suffix
3 participants