-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Adding Management Groups RP Swagger. #1671
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
Conversation
Moving Swagger under Resources
|
@muazmian, |
|
@ravbhatnagar new spec: |
ravbhatnagar
left a comment
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.
Just a couple of comments around read-only attribute for id, name and type properties. This has already been reviewed in person. So ARM signs off.
| "ManagementGroupInfo": { | ||
| "description": "The management group.", | ||
| "properties": { | ||
| "id": { |
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.
id, name and type properties should be marked as read-only.
| "ManagementGroup": { | ||
| "description": "The management group details.", | ||
| "properties": { | ||
| "id": { |
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.
id, name and type as read-only
|
Hi There, I am the AutoRest Linter Azure bot. I am here to help. My task is to analyze the situation from the AutoRest linter perspective. Please review the below analysis result: File: AutoRest Linter Guidelines | AutoRest Linter Issues Send feedback and make AutoRest Linter Azure Bot smarter day by day! Thanks for your co-operation. |
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.
@muazmian really appreciate the fact that you are providing example for each model properties, in-addition to the x-ms-example. Just a suggestion, do you think you can keep only description and merge example content with it? That way IDE intellisense can show more details and api doc would be more cleaner. Just a thought.
I mean something like The ID of the management group for e.g. /providers/Microsoft.Management/managementGroups/20000000-0000-0000-0000-000000000000
| } | ||
| }, | ||
| "nextLink": { | ||
| "description": "The link (URL) to the next page of results.", |
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.
nextLink should be readonly
| } | ||
| }, | ||
| "x-ms-pageable": { | ||
| "nextLinkName": "nextLink" |
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.
What exactly the content of nextLink property?
is it (1) fully qualified url (2) relative url (3) something else (e.g. guid)..
Asking because this operation also has a query parameter PageTokenParameter and it description says it will needs to be populated with the value of nextLink present in the current page in-order to get the next page.
Does your service requires user to follow below flow to enumerate all pages?
-
Get the first page
GET /providers/Microsoft.Management/managementGroups. The response can contain value fornextLinke.g. abcd (just a token not a url) -
Get the next page by using the original operation url
/providers/Microsoft.Management/managementGroupsand a query parametertokenwhich is populated with the value ofnextLinkfrom the previous page
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.
"x-ms-pageable": {
"nextLinkName": "nextLink"
}
I am seeing same property defined in three other swaggers.
https://github.com/Azure/azure-rest-api-specs/blob/current/specification/billing/resource-manager/Microsoft.Billing/2017-04-24-preview/billing.json
I don't think there is anything wrong with this.
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.
@muazmian there is nothing wrong here w.r.t the usage of x-ms-pagable. My question is about relationship between PageTokenParameter and nextLink and how service is expecting user to use these properties together.
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.
@anuchandy ..The RP has not yet implemented anything regarding generating NextLink or PageTokenParameter but the plan is that nextLink will be a relative url with $skiptoken.
I am renaming the PageTokenParameter to SkipToken make it more clear.
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.
@muazmian, if an operation is marked as x-ms-pagable then the code generator emits two methods, in your case it generates following two methods:
ManagementGroups {
Page<ManagementGroupInfo> List(String skipToken);
Page<ManagementGroupInfo> ListNext(String nextLinkUrl, String skipToken);
}So user will use it as
Page<ManagementGroupInfo> firstPage = client.List( /* what should be value for skipToken param?*/);
Page<ManagementGroupInfo> nextPage = client.ListNext(firstPage.nextLink, /* what should be value for skipToken param?*/);Iam trying to understand - If odata $skipToken is already present in the nextLink property when why do we need separate skipToken argument for the method?
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.
You are right, this is wrong. I have removed "x-ms-parameter-location" from $skipToken. Hopefully this will resolve the issue.
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.
In case this does not fix this, please let me know the actual fix.
I am just helping the team in publishing the Swagger and Azure PS.
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.
removal of "x-ms-parameter-location" will simply make skipTokenParameter global, it goes to client from list method. Should we just remove this property given that it is not used anywhere?
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.
What do you think about moving the $SkipToken out of parameters and only define it for that 1 api that will use it? The reason I am asking is that so skipToken is shown as a query paramter on swagger
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.
sure sounds good..
| "in": "query", | ||
| "required": false, | ||
| "type": "boolean", | ||
| "description": "The $recurse=true query string parameter allows clients to request inclusion of entire hierarchy in the response payload." |
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.
specify x-ms-parameter-location: method
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.
see above comment
| "in": "query", | ||
| "required": false, | ||
| "type": "string", | ||
| "description": "Page continuation token is only used if a previous operation returned a partial result. \nIf a previous response contains a nextLink element, the value of the nextLink element will include a token parameter that specifies a starting point to use for subsequent calls.\n" |
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.
please specify x-ms-parameter-location: method, refer https://github.com/Azure/autorest/blob/master/docs/extensions/readme.md#x-ms-parameter-location
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.
Is this a new requirement? None of our older RPs has this property defined.
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.
this is not a new requirement - if you don't apply this attribute then these become properties of the client (ManagementGroups.cs), only the global properties (e.g. apiVersion, subscriptionId) which are applicable across all operations are supposed to be in the client level.
| "enum": [ | ||
| "children" | ||
| ], | ||
| "description": "The $expand=children query string parameter allows clients to request inclusion of children in the response payload." |
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.
specify x-ms-parameter-location: method
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.
see above comment
|
Hi There, I am the AutoRest Linter Azure bot. I am here to help. My task is to analyze the situation from the AutoRest linter perspective. Please review the below analysis result: File: AutoRest Linter Guidelines | AutoRest Linter Issues Send feedback and make AutoRest Linter Azure Bot smarter day by day! Thanks for your co-operation. |
|
No modification for AutorestCI/azure-sdk-for-node |
This checklist is used to make sure that common issues in a pull request are addressed. This will expedite the process of getting your pull request merged and avoid extra work on your part to fix issues discovered during the review process.
PR information
api-versionin the path should match theapi-versionin the spec).Quality of Swagger