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

Fixing global parameters for siterecovery and resourcehealth #1753

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14122,14 +14122,16 @@
"in": "path",
"description": "The name of the resource group where the recovery services vault is present.",
"required": true,
"type": "string"
"type": "string",
"x-ms-parameter-location": "method"
Copy link
Contributor

Choose a reason for hiding this comment

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

what issue was not having this causing? what's the breaking change on generated code due to this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

new SiteRecoveryManagementClient(credentials, subscriptionId, resourceGroupName, resourceName);
This makes the client require resourceGroupName and resourceName in the client constructor. Both of these become client properties and that is incorrect. I had filed an issue in the linter repo about this. If it is management-plane swagger then the linter should warn if it sees anything else apart from subscriptionId and apiVersion and does not have x-ms-parameter-location set to method. Azure/azure-openapi-validator#84

Choose a reason for hiding this comment

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

As responded over the mail thread:

As per our scenarios, customers are more likely to work in the context of a single ResourceName, so, It makes more sense to have ResourceGroupName and ResourceName in global parameters section for recoveryservicessiterecovery specification. For more context we have:

  1. https://github.com/Azure/azure-rest-api-specs/blob/current/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/2016-06-01/vaults.json which defines CRUD on ResourceName and hence, ResourceGroupName and ResourceName are already method parameters.
  2. However, specification at https://github.com/Azure/azure-rest-api-specs/tree/current/specification/recoveryservicessiterecovery/resource-manager is mostly sused by customer in the context of a single ResourceName. So, initializing ResourceGroupName and ResourceName at the time of client initialization aligns better to our customer scenario.

Moreover, any change as suggested in the thread would be a breaking change for our existing clients like PowerShell and Ibiza (requires passing ResourceGroupName and ResourceName explicitly as input to every call rather than just once at sdk client initialization) as I can understand, which we would not be able to take at this point.
Let us know if we are missing some point to understand here.

Thanks,
Avneesh

},
"ResourceName": {
"name": "resourceName",
"in": "path",
"description": "The name of the recovery services vault.",
"required": true,
"type": "string"
"type": "string",
"x-ms-parameter-location": "method"
},
"ApiVersion": {
"name": "api-version",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -548,13 +548,6 @@
"description": "The name of the resource group.",
"x-ms-parameter-location": "method"
},
"ResourceTypeParameter": {
Copy link
Contributor

Choose a reason for hiding this comment

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

it appears this wasn't been used in the spec or any others in the repo, right? so removing it shouldn't cause any harm.

Copy link
Contributor Author

@amarzavery amarzavery Sep 27, 2017

Choose a reason for hiding this comment

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

it was not being used and having it in the global parameters section was causing this to be a client property.

"name": "resourceType",
"in": "path",
"required": true,
"type": "string",
"description": "The name of the resource type."
},
"FilterParameter": {
"name": "$filter",
"in": "query",
Expand All @@ -572,4 +565,4 @@
"x-ms-parameter-location": "method"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -564,13 +564,6 @@
"description": "The name of the resource group.",
"x-ms-parameter-location": "method"
},
"ResourceTypeParameter": {
Copy link
Contributor

Choose a reason for hiding this comment

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

same situation as above here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yup

"name": "resourceType",
"in": "path",
"required": true,
"type": "string",
"description": "The name of the resource type."
},
"FilterParameter": {
"name": "$filter",
"in": "query",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3130,25 +3130,23 @@
"in": "query",
"description": "The version of the API. This is a required parameter and it's value must be \"2016-09-01\".",
"required": true,
"type": "string",
"enum": [
"2016-09-01"
],
"default": "2016-09-01"
"type": "string"
Copy link
Contributor Author

@amarzavery amarzavery Sep 28, 2017

Choose a reason for hiding this comment

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

@samedder - Can you please take a look at changes I made in the service fabric resource-manager spec.

  • Some of the global parameters missed the "x-ms-parameter-location": "method" extension.
  • The enum array is not required in the first place and it had an incorrect value as well. If the value has to be present then it should be in sync with the api-version in the file path that is "2017-07-01-preview" in this case.

Copy link
Contributor

Choose a reason for hiding this comment

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

@chingchenmsft needs to sign off on this. I believe this may break our clients so he should verify.

Copy link
Contributor Author

@amarzavery amarzavery Sep 28, 2017

Choose a reason for hiding this comment

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

@juhacket - I believe these changes were made by you and merged in the PR #1717. Can you please take a look?

Copy link
Member

Choose a reason for hiding this comment

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

Can you fix the description as well? "This is a required parameter and it's value must be "2016-09-01"."

},
"applicationName": {
"name": "applicationName",
"in": "path",
"description": "The name of the application resource.",
"required": true,
"type": "string"
"type": "string",
"x-ms-parameter-location": "method"
},
"applicationTypeName": {
"name": "applicationTypeName",
"in": "path",
"description": "The name of the application type name resource",
"required": true,
"type": "string"
"type": "string",
"x-ms-parameter-location": "method"
},
"clusterNameParameter": {
"name": "clusterName",
Expand Down Expand Up @@ -3199,7 +3197,8 @@
"in": "path",
"description": "The name of the service resource in the format of {applicationName}~{serviceName}.",
"required": true,
"type": "string"
"type": "string",
"x-ms-parameter-location": "method"
},
"subscriptionId": {
"name": "subscriptionId",
Expand All @@ -3213,7 +3212,8 @@
"in": "path",
"description": "The application type version.",
"required": true,
"type": "string"
"type": "string",
"x-ms-parameter-location": "method"
},
"clusterBodyParam": {
"name": "Cluster",
Expand All @@ -3222,7 +3222,8 @@
"required": true,
"schema": {
"$ref": "#/definitions/Cluster"
}
},
"x-ms-parameter-location": "method"
},
"clusterUpdateParameterBody": {
"name": "ClusterUpdateParameters",
Expand All @@ -3231,7 +3232,8 @@
"required": true,
"schema": {
"$ref": "#/definitions/ClusterUpdateParameters"
}
},
"x-ms-parameter-location": "method"
}
}
}