Skip to content

update RA calls to new version#2031

Merged
mcardosos merged 17 commits intoAzure:currentfrom
darshanhs90:current
Nov 22, 2017
Merged

update RA calls to new version#2031
mcardosos merged 17 commits intoAzure:currentfrom
darshanhs90:current

Conversation

@darshanhs90
Copy link
Contributor

@darshanhs90 darshanhs90 commented Nov 17, 2017

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

@mcardosos
Copy link
Contributor

If code is regenerated using this tag, code will have breaking changes. This problem can be avoided if a new tag for package-2017-10-preview is added, and the tag for package-2015-07 is left as it originally was.


Refers to: specification/authorization/resource-manager/readme.md:34 in 2996419. [](commit_id = 2996419, deletion_comment = False)

},
"description": "Provider operations metadata list"
},
"RoleAssignmentPropertiesWithScope": {
Copy link
Contributor

Choose a reason for hiding this comment

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

RoleAssignmentPropertiesWithScope [](start = 5, length = 33)

Removing operations from an existing API version will cause breaking changes on generated code.
It is better to create a file with the operations that will be modified in the next API version, so the tag for 2015 version calls this two files (operations that wont change, and operations that will change), and the tag for 2017 version calls the other two files (the one with the unmodified operations and the one with the modified operations).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since we would need the 2017 tag's[as per above] generated files for sdk-for-net.How would this work if we have two tags?
which generated files will be used by sdk-for net then?

Copy link
Contributor

Choose a reason for hiding this comment

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

In the Basic Information section you can specify which tag is the default one to generate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks,will update the pr as per the comments then

@darshanhs90
Copy link
Contributor Author

darshanhs90 commented Nov 18, 2017

@mcardosos Also since there wasnt any examples files before,is it mandatory in this pr to include those files for the build to pass?
or can i create a separate pr for this alone #Resolved

@mcardosos
Copy link
Contributor

mcardosos commented Nov 18, 2017

@darshanhs90 I would prefer for the examples to be included here.

@darshanhs90
Copy link
Contributor Author

darshanhs90 commented Nov 20, 2017

@mcardosos Have added the examples for all,but there seems to be some error in the build stating message: 'Equivalent path already exists: /{roleDefinitionId}',even though there is only one path like that.
Could you let me know on what needs to be done to fix the build issue #Resolved

@darshanhs90
Copy link
Contributor Author

darshanhs90 commented Nov 21, 2017

@mcardosos DO let me know if there is anything else that needs to be done for the PR to get merged #Resolved

"description": "Role definition properties."
},
"RoleDefinition": {
"properties": {
Copy link
Contributor

Choose a reason for hiding this comment

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

Are id, name and type properties readonly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no,made the changes in the specs

Copy link
Contributor

Choose a reason for hiding this comment

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

What I mean here, because of ARM rules on APIs, this 3 properties shouls be marked as "readonly": true

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay did that

"description": "Role assignment properties with scope."
},
"RoleAssignment": {
"properties": {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here:
Are id, name and type properties readonly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no,made the changes in the specs

@mcardosos
Copy link
Contributor

Added some more comments about readonly properties.
There are model validation errors to be fixed. They can be fixed on the examples files.
This error on x-ms-paths can be safely igonred in this case :)

@darshanhs90
Copy link
Contributor Author

darshanhs90 commented Nov 22, 2017

@mcardosos updated the examples,so that the model validation errors are fixed.Also the readonly field has been modified as per the comments

@mcardosos
Copy link
Contributor

@darshanhs90
I am not sure exactly why, but CI didn't run the linter on the 2017-10-01-preview files.
I just ran the linter on your changes so we can actually take a look into this issues in the new API swagger.
If you also want to run the linter on your machine so you also can look at this issues locally, you can do it like this...

cd azure-rest-api-specs\specification\authorization\resource-manager
npx autorest@2.0.4152 --validation --azure-validator --message-format=json

I will add more comments on the new API swaggers based on this errors found by the linter.

{
  "type": "Error",
  "code": "OperationsAPIImplementation",
  "message": "Operations API must be implemented for '/providers/Microsoft.Authorization/operations'.",
  "id": "R3023",
  "validationCategory": "RPCViolation",
  "providerNamespace": null,
  "resourceType": null,
  "sources": [
    "file:///C:/azure-rest-api-specs/specification/authorization/resource-manager/Microsoft.Authorization/2017-10-01-preview/authorization-RACalls.json:38: 2 ($.paths)",
    "file:///C:/azure-rest-api-specs/specification/authorization/resource-manager/Microsoft.Authorization/2017-10-01-preview/authorization.json:38: 2 ($.paths)"
  ]
}
{
  "type": "Warning",
  "code": "NonApplicationJsonType",
  "message": "Only 'application/json' content-type is supported by ARM.",
  "id": "R2004",
  "validationCategory": "RPCViolation",
  "providerNamespace": null,
  "resourceType": null,
  "sources": [
    "file:///C:/azure-rest-api-specs/specification/authorization/resource-manager/Microsoft.Authorization/2017-10-01-preview/authorization.json:14: 4 ($.consumes[1])"
  ]
}
{
  "type": "Warning",
  "code": "NonApplicationJsonType",
  "message": "Only 'application/json' content-type is supported by ARM.",
  "id": "R2004",
  "validationCategory": "RPCViolation",
  "providerNamespace": null,
  "resourceType": null,
  "sources": [
    "file:///C:/azure-rest-api-specs/specification/authorization/resource-manager/Microsoft.Authorization/2017-10-01-preview/authorization.json:18: 4 ($.produces[1])"
  ]
}
{
  "type": "Warning",
  "code": "OperationIdNounConflictingModelNames",
  "message": "OperationId has a noun that conflicts with one of the model names in definitions section. The model name will be disambiguated to 'ProviderOperationsMetadataModel'. Consider using the plural form of 'ProviderOperationsMetadata' to avoid this. Note: If you have already shipped an SDK on top of this spec, fixing this warning may introduce a breaking change.",
  "id": "R2063",
  "validationCategory": "SDKViolation",
  "providerNamespace": "Microsoft.Authorization",
  "resourceType": "providerOperations",
  "sources": [
    "file:///C:/azure-rest-api-specs/specification/authorization/resource-manager/Microsoft.Authorization/2017-10-01-preview/authorization.json:191: 8 ($.paths[\"/providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}\"].get.operationId)"
  ]
}
{
  "type": "Warning",
  "code": "OperationIdNounConflictingModelNames",
  "message": "OperationId has a noun that conflicts with one of the model names in definitions section. The model name will be disambiguated to 'ProviderOperationsMetadataModel'. Consider using the plural form of 'ProviderOperationsMetadata' to avoid this. Note: If you have already shipped an SDK on top of this spec, fixing this warning may introduce a breaking change.",
  "id": "R2063",
  "validationCategory": "SDKViolation",
  "providerNamespace": "Microsoft.Authorization",
  "resourceType": null,
  "sources": [
    "file:///C:/azure-rest-api-specs/specification/authorization/resource-manager/Microsoft.Authorization/2017-10-01-preview/authorization.json:237: 8 ($.paths[\"/providers/Microsoft.Authorization/providerOperations\"].get.operationId)"
  ]
}
{
  "type": "Error",
  "code": "RequiredPropertiesMissingInResourceModel",
  "message": "Model definition 'RoleDefinition' must have the properties 'name', 'id' and 'type' in its hierarchy and these properties must be marked as readonly.",
  "id": "R2020",
  "validationCategory": "RPCViolation",
  "providerNamespace": null,
  "resourceType": null,
  "sources": [
    "file:///C:/azure-rest-api-specs/specification/authorization/resource-manager/Microsoft.Authorization/2017-10-01-preview/authorization.json:709: 4 ($.definitions.RoleDefinition)"
  ]
}
{
  "type": "Error",
  "code": "RequiredPropertiesMissingInResourceModel",
  "message": "Model definition 'RoleAssignment' must have the properties 'name', 'id' and 'type' in its hierarchy and these properties must be marked as readonly.",
  "id": "R2020",
  "validationCategory": "RPCViolation",
  "providerNamespace": null,
  "resourceType": null,
  "sources": [
    "file:///C:/azure-rest-api-specs/specification/authorization/resource-manager/Microsoft.Authorization/2017-10-01-preview/authorization-RACalls.json:529: 4 ($.definitions.RoleAssignment)"
  ]
}
{
  "type": "Warning",
  "code": "AvoidNestedProperties",
  "message": "Consider using x-ms-client-flatten to provide a better end user experience",
  "id": "R2001",
  "validationCategory": "SDKViolation",
  "providerNamespace": null,
  "resourceType": null,
  "sources": [
    "file:///C:/azure-rest-api-specs/specification/authorization/resource-manager/Microsoft.Authorization/2017-10-01-preview/authorization.json:524: 8 ($.definitions.ClassicAdministrator.properties.properties)"
  ]
}
{
  "type": "Warning",
  "code": "AvoidNestedProperties",
  "message": "Consider using x-ms-client-flatten to provide a better end user experience",
  "id": "R2001",
  "validationCategory": "SDKViolation",
  "providerNamespace": null,
  "resourceType": null,
  "sources": [
    "file:///C:/azure-rest-api-specs/specification/authorization/resource-manager/Microsoft.Authorization/2017-10-01-preview/authorization.json:600: 8 ($.definitions.ProviderOperation.properties.properties)"
  ]
}
{
  "type": "Warning",
  "code": "AvoidNestedProperties",
  "message": "Consider using x-ms-client-flatten to provide a better end user experience",
  "id": "R2001",
  "validationCategory": "SDKViolation",
  "providerNamespace": null,
  "resourceType": null,
  "sources": [
    "file:///C:/azure-rest-api-specs/specification/authorization/resource-manager/Microsoft.Authorization/2017-10-01-preview/authorization.json:726: 8 ($.definitions.RoleDefinition.properties.properties)"
  ]
}
{
  "type": "Warning",
  "code": "EnumInsteadOfBoolean",
  "message": "Booleans are not descriptive and make them hard to use. Consider using string enums with allowed set of values defined. Property: canDelegate",
  "id": "R3018",
  "validationCategory": "RPCViolation",
  "providerNamespace": null,
  "resourceType": null,
  "sources": [
    "file:///C:/azure-rest-api-specs/specification/authorization/resource-manager/Microsoft.Authorization/2017-10-01-preview/authorization-RACalls.json:501: 8 ($.definitions.RoleAssignmentFilter.properties.canDelegate)"
  ]
}
{
  "type": "Warning",
  "code": "EnumInsteadOfBoolean",
  "message": "Booleans are not descriptive and make them hard to use. Consider using string enums with allowed set of values defined. Property: canDelegate",
  "id": "R3018",
  "validationCategory": "RPCViolation",
  "providerNamespace": null,
  "resourceType": null,
  "sources": [
    "file:///C:/azure-rest-api-specs/specification/authorization/resource-manager/Microsoft.Authorization/2017-10-01-preview/authorization-RACalls.json:522: 8 ($.definitions.RoleAssignmentPropertiesWithScope.properties.canDelegate)"
  ]
}
{
  "type": "Warning",
  "code": "AvoidNestedProperties",
  "message": "Consider using x-ms-client-flatten to provide a better end user experience",
  "id": "R2001",
  "validationCategory": "SDKViolation",
  "providerNamespace": null,
  "resourceType": null,
  "sources": [
    "file:///C:/azure-rest-api-specs/specification/authorization/resource-manager/Microsoft.Authorization/2017-10-01-preview/authorization-RACalls.json:546: 8 ($.definitions.RoleAssignment.properties.properties)"
  ]
}
{
  "type": "Warning",
  "code": "EnumInsteadOfBoolean",
  "message": "Booleans are not descriptive and make them hard to use. Consider using string enums with allowed set of values defined. Property: canDelegate",
  "id": "R3018",
  "validationCategory": "RPCViolation",
  "providerNamespace": null,
  "resourceType": null,
  "sources": [
    "file:///C:/azure-rest-api-specs/specification/authorization/resource-manager/Microsoft.Authorization/2017-10-01-preview/authorization-RACalls.json:579: 8 ($.definitions.RoleAssignmentProperties.properties.canDelegate)"
  ]
}
{
  "type": "Warning",
  "code": "AvoidNestedProperties",
  "message": "Consider using x-ms-client-flatten to provide a better end user experience",
  "id": "R2001",
  "validationCategory": "SDKViolation",
  "providerNamespace": null,
  "resourceType": null,
  "sources": [
    "file:///C:/azure-rest-api-specs/specification/authorization/resource-manager/Microsoft.Authorization/2017-10-01-preview/authorization-RACalls.json:588: 8 ($.definitions.RoleAssignmentCreateParameters.properties.properties)"
  ]
}
{
  "type": "Warning",
  "code": "NonApplicationJsonType",
  "message": "Only 'application/json' content-type is supported by ARM.",
  "id": "R2004",
  "validationCategory": "RPCViolation",
  "providerNamespace": null,
  "resourceType": null,
  "sources": [
    "file:///C:/azure-rest-api-specs/specification/authorization/resource-manager/Microsoft.Authorization/2017-10-01-preview/authorization-RACalls.json:14: 4 ($.consumes[1])"
  ]
}
{
  "type": "Warning",
  "code": "NonApplicationJsonType",
  "message": "Only 'application/json' content-type is supported by ARM.",
  "id": "R2004",
  "validationCategory": "RPCViolation",
  "providerNamespace": null,
  "resourceType": null,
  "sources": [
    "file:///C:/azure-rest-api-specs/specification/authorization/resource-manager/Microsoft.Authorization/2017-10-01-preview/authorization-RACalls.json:18: 4 ($.produces[1])"
  ]
}

],
"consumes": [
"application/json",
"text/json"
Copy link
Contributor

Choose a reason for hiding this comment

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

"text/json" [](start = 4, length = 11)

According to the linter, ARM does not support consuming and producing "test/json"

"readOnly":false,
"description": "The role assignment type."
},
"properties": {
Copy link
Contributor

Choose a reason for hiding this comment

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

properties [](start = 9, length = 10)

This model could provide a better user experience if this property used x-ms-client-flatten

"type": "string",
"description": "The type of the administrator."
},
"properties": {
Copy link
Contributor

Choose a reason for hiding this comment

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

"properties": [](start = 8, length = 13)

Same comment here, if this property is marked with x-ms-client-flatten user experience on the SDK would improve

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added the x-ms-client-flatten in all the places the linter tool showed as warning

"type": "string",
"description": "The operation origin."
},
"properties": {
Copy link
Contributor

Choose a reason for hiding this comment

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

"properties" [](start = 8, length = 12)

And here too, x-ms-client-flatten can improve generated code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added the x-ms-client-flatten in all the places the linter tool showed as warning

},
"RoleAssignmentCreateParameters": {
"properties": {
"properties": {
Copy link
Contributor

Choose a reason for hiding this comment

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

properties [](start = 9, length = 10)

This property can also benefit from being flattened

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added the x-ms-client-flatten in all the places the linter tool showed as warning

],
"consumes": [
"application/json",
"text/json"
Copy link
Contributor

Choose a reason for hiding this comment

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

"text/json" [](start = 4, length = 11)

According to the linter, this is not supported by ARM

"type": "string",
"description": "Returns role assignment of the specific principal."
},
"canDelegate":{
Copy link
Contributor

Choose a reason for hiding this comment

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

canDelegate [](start = 9, length = 11)

Linter is suggesting using an enum instead of a bool here. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

since the values are either true or false which gets passed on to the service,bool is more apt in this case

}
},
"/providers/Microsoft.Authorization/providerOperations": {
"get": {
Copy link
Contributor

Choose a reason for hiding this comment

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

question for @ravbhatnagar
Is this allowed? The linter marks an error on this swaggers because they are not providing an operatin that lists all available operations in the API. I found this other operation that looks like does exactly that. Is it mandatory to use the exact same path that is provided by the linter error?

Copy link
Contributor

Choose a reason for hiding this comment

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

No, this is fine for this RP. For all other RPs, the path that linter points is correct.

@ravbhatnagar
Copy link
Contributor

Looks good. Signing Off!!

@ravbhatnagar ravbhatnagar added the ARMSignedOff <valid label in PR review process>add this label when ARM approve updates after review label Nov 22, 2017
@azuresdkciprbot
Copy link

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: specification/authorization/resource-manager/readme.md
Before the PR: Warning(s): 0 Error(s): 4
After the PR: Warning(s): 0 Error(s): 1

AutoRest Linter Guidelines | AutoRest Linter Issues | Send feedback

Thanks for your co-operation.

@azuresdkciprbot
Copy link

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: specification/authorization/resource-manager/readme.md
Before the PR: Warning(s): 0 Error(s): 4
After the PR: Warning(s): 0 Error(s): 1

AutoRest Linter Guidelines | AutoRest Linter Issues | Send feedback

Thanks for your co-operation.

@darshanhs90
Copy link
Contributor Author

darshanhs90 commented Nov 22, 2017

@mcardosos Fixed all the above issues
Currently Checking once if there are no regressions on the sdk-side.
Do let me know if everything is fine

@mcardosos mcardosos merged commit 9e9ae3c into Azure:current Nov 22, 2017
@AutorestCI
Copy link

No modification for AutorestCI/azure-sdk-for-node

@AutorestCI
Copy link

@AutorestCI
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ARMSignedOff <valid label in PR review process>add this label when ARM approve updates after review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants