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

Swagger change for getting all availability sets in a subscription and StandardSSD #3302

Merged
merged 5 commits into from
Jun 30, 2018

Conversation

dochung4
Copy link
Contributor

@dochung4 dochung4 commented Jun 25, 2018

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

  • The title of the PR is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For information on cleaning up the commits in your pull request, see this page.
  • Except for special cases involving multiple contributors, the PR is started from a fork of the main repository, not a branch.
  • If applicable, the PR references the bug/issue that it fixes.
  • Swagger files are correctly named (e.g. the api-version in the path should match the api-version in the spec).

Quality of Swagger

@AutorestCI
Copy link

AutorestCI commented Jun 25, 2018

Automation for azure-sdk-for-node

The initial PR has been merged into your service PR:
Azure/azure-sdk-for-node#2710

@AutorestCI
Copy link

AutorestCI commented Jun 25, 2018

Automation for azure-sdk-for-python

The initial PR has been merged into your service PR:
Azure/azure-sdk-for-python#2487

@AutorestCI
Copy link

AutorestCI commented Jun 25, 2018

Automation for azure-sdk-for-go

Encountered a Subprocess error: (azure-sdk-for-go)

Command: ['/usr/local/bin/autorest', '/tmp/tmp2k67_1nf/rest/specification/compute/resource-manager/readme.md', '--go', '--go-sdk-folder=/tmp/tmp2k67_1nf/src/github.com/Azure/azure-sdk-for-go', '--multiapi', '--use=@microsoft.azure/autorest.go@~2.1.105', '--use-onever', '--verbose']
Finished with return code 1
and output:

AutoRest code generation utility [version: 2.0.4280; node: v7.10.1]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
   Loading AutoRest core      '/root/.autorest/@microsoft.azure_autorest-core@2.0.4280/node_modules/@microsoft.azure/autorest-core/dist' (2.0.4280)
   Loading AutoRest extension '@microsoft.azure/autorest.go' (~2.1.105->2.1.105)
   Loading AutoRest extension '@microsoft.azure/autorest.modeler' (2.3.38->2.3.38)
Processing batch task - {"tag":"package-2018-04"} .
FATAL: System.InvalidOperationException: Swagger document contains two or more x-ms-enum extensions with the same name 'StorageAccountTypes' and different values: Standard_LRS,Premium_LRS vs. Standard_LRS,Premium_LRS,StandardSSD_LRS
   at AutoRest.Modeler.ObjectBuilder.BuildServiceType(String serviceTypeName, Boolean required) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\ObjectBuilder.cs:line 147
   at AutoRest.Modeler.SchemaBuilder.ParentBuildServiceType(String serviceTypeName, Boolean required) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\SchemaBuilder.cs:line 204
   at AutoRest.Modeler.SchemaBuilder.BuildServiceType(String serviceTypeName, Boolean required) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\SchemaBuilder.cs:line 46
   at AutoRest.Modeler.SchemaBuilder.BuildServiceType(String serviceTypeName, Boolean required) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\SchemaBuilder.cs:line 131
   at AutoRest.Modeler.SchemaBuilder.BuildServiceType(String serviceTypeName, Boolean required) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\SchemaBuilder.cs:line 131
   at AutoRest.Modeler.SwaggerModeler.BuildCompositeTypes() in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\SwaggerModeler.cs:line 271
   at AutoRest.Modeler.SwaggerModeler.Build(ServiceDefinition serviceDefinition) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\SwaggerModeler.cs:line 66
   at AutoRest.Modeler.Program.<ProcessInternal>d__2.MoveNext() in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\Program.cs:line 60
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NewPlugin.<Process>d__15.MoveNext()
FATAL: go/imodeler1 - FAILED
FATAL: Error: Plugin imodeler1 reported failure.
Process() cancelled due to exception : Plugin imodeler1 reported failure.
Failure during batch task - {"tag":"package-2018-04"} -- Error: Plugin imodeler1 reported failure..
  Error: Plugin imodeler1 reported failure.

@AutorestCI
Copy link

AutorestCI commented Jun 25, 2018

Automation for azure-sdk-for-java

The initial PR has been merged into your service PR:
Azure/azure-sdk-for-java#2165

@AutorestCI
Copy link

AutorestCI commented Jun 25, 2018

Automation for azure-sdk-for-ruby

The initial PR has been merged into your service PR:
Azure/azure-sdk-for-ruby#1422

@@ -783,7 +783,8 @@
"type": "string",
"enum": [
"Standard_LRS",
"Premium_LRS"
"Premium_LRS",
"StandardSSD_LRS"
Copy link
Member

Choose a reason for hiding this comment

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

This creates invaliad Swagger:
FATAL: System.InvalidOperationException: Swagger document contains two or more x-ms-enum extensions with the same name 'StorageAccountTypes' and different values: Standard_LRS,Premium_LRS vs. Standard_LRS,Premium_LRS,StandardSSD_LRS

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I forgot to update 2018-04-01 compute.json. It is updated now.

"tags": [
"AvailabilitySets"
],
"operationId": "AvailabilitySets_ListAll",
Copy link
Member

Choose a reason for hiding this comment

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

Recommendation is ListBySubscription

…ated name to ListAll, and removed the change from 2015-06-15
}
},
"x-ms-pageable": {
"nextLinkName": "nextLink"
Copy link
Member

Choose a reason for hiding this comment

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

The provided example creates a linter error:

The property 'nextLink' specified by nextLinkName does not exist in the 200 response schema. \nPlease, specify the name of the property that provides the nextLink. If the model does not have the nextLink property then specify null.

Could you either:

  • Update the example to include an example of nextLink if server supports it
  • Update the Swagger to replace "nextLink" by null if server does not support nextLink

Whatever you do, do NOT remove "x-ms-pageable", that's the right thing to do since it's a method that has the semantic of a list.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can you please check again? I think the issue is not that nextLink is missing in the example, but that nextLink is missing AvailabilitySetListResult in compute.json.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, I see what you mean, you re-used AvailabilitySetListResult as it was defined. Let me check what should be the correct way to remove this warning then.

Copy link
Member

@lmazuel lmazuel Jun 28, 2018

Choose a reason for hiding this comment

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

@dochung4 I made an actual call to the endpoint, and didn't get a nextLink back in the JSON. But maybe I didn't have enough resource to trigger the nextLink. But if it's the truth and the endpoint always returns a unique page whatever the number of AS, then the correct definition is to use null.
Could you confirm the actual server behavior:

  • If server never returns nextLink, use null
  • If server may return nextLink, use what you did nextLink

Swagger must described accurately the server, and since I don't own the server implementation I don't know which one is the truth. Your last commit changed a lot of null to nextLink and that concerns me a bit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For which call did you not get a nextLink back? Currently we have nextLink for listing all availability sets in a subscription, but not for listing all resource groups in a resource group. But I discussed this with my team and I added nextLink to the latter too, because it will be enabled very soon.

Please let me know if you have other thoughts.

Copy link
Member

@lmazuel lmazuel Jun 28, 2018

Choose a reason for hiding this comment

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

I checked listing AS in a RG indeed. So if I understand you correctly:

  • List AS at the subscription level always returns nextLink
  • List AS at the RG level didn't have nextLink, but you're adding it live on all api-versions from 2016-04-30-preview to now soon.

Is this accurate?
If this is accurate, I'm good with the PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes that's correct.

@lmazuel
Copy link
Member

lmazuel commented Jun 29, 2018

@dochung4 LGTM.
However, I realized before merging that Compute 2018-06-01 has already a spec, and your change would not be inside. Please update 2018-06-01 as well and I merge it.

@dochung4
Copy link
Contributor Author

@lmazuel Regarding 2018-06-01, I discussed with my manager, and we agreed to not update 2018-06-01 at this point and let the next person working on Swagger change to make the 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.

3 participants