Skip to content

Add Microsoft.Cache/redis/firewallRules resource operations#977

Closed
TimLovellSmith wants to merge 1 commit intoAzure:masterfrom
TimLovellSmith:firewallRules3
Closed

Add Microsoft.Cache/redis/firewallRules resource operations#977
TimLovellSmith wants to merge 1 commit intoAzure:masterfrom
TimLovellSmith:firewallRules3

Conversation

@TimLovellSmith
Copy link
Copy Markdown
Member

@TimLovellSmith TimLovellSmith commented Feb 28, 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

  • I have read the contribution guidelines.
  • My spec meets the review criteria:
    • The spec conforms to the Swagger 2.0 specification.
    • Validation errors from the Linter extension for VS Code have all been fixed for this spec. (Note: for large, previously checked in specs, there will likely be many errors shown. Please contact our team so we can set a timeframe for fixing these errors if your PR is not going to address them).
    • The spec follows the patterns described in the Swagger good patterns document unless the service API makes this impossible.

@TimLovellSmith
Copy link
Copy Markdown
Member Author

Build failed. Looks like TravisCI may have been affected by AWS. Can I get a rebuild?

@TimLovellSmith
Copy link
Copy Markdown
Member Author

Hooray - build passed!

Copy link
Copy Markdown
Contributor

@veronicagg veronicagg left a comment

Choose a reason for hiding this comment

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

Thanks @TimLovellSmith . I left some comments inline.
Please also take a look at the output of our validation tools:
https://travis-ci.org/Azure/azure-rest-api-specs/jobs/206299812#L2515
https://travis-ci.org/Azure/azure-rest-api-specs/jobs/206299814#L2522

Comment thread arm-redis/2016-04-01/swagger/redis.json Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@veronicagg Is it required? I don't think we would ever actually page the response in practice.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@TimLovellSmith - https://github.com/Azure/azure-rest-api-specs/pull/977/files#diff-785771b0c72c01e60191a5d798d6d508R1128 The model has a property named nextLink.
If you think that the server will never return more than one server page of response and the service does not have support for nextLink property in the response body then please remove nextLink as the property from the model.

However, you would still need to add the x-ms-pageable extension to the operation. The minor difference would be "nextLinkName": null in the x-ms-pageable extension. This is done explicitly to indicate AutoRest that there is no nextLink. Then AutoRest will still flatten the "value" property and return an IEnumerable<RedisFirewallRule> instead of IPage<RedisFirewallRule>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@amarzavery OK sounds simpler then to just declare x-ms-pageable now in case we ever add it - and it won't matter if server doesn't actually set the nextLink property for now right?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In this case, I think it is ok to fudge. The server always returns the first page. Whenever the server adds the capability to add a next page it wouldn't be a breaking change in the API or the sdk. IMHO, pageable is a standard pattern in all the ARM services. All the services should just copy paste that implementation all the time and make it the defacto standard. In that way there is consistency and the swagger spec is also an accurate representation of the API.

Comment thread arm-redis/2016-04-01/swagger/redis.json Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

From https://github.com/Azure/azure-rest-api-specs/blob/master/documentation/swagger-checklist.md :
M2017: The model definition for the body parameter and the response MUST be the same for a PUT operation. This ensures that the same entity will be reusable between GET and PUT.
Please evaluate whether the current definition is intentional.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

+1

Comment thread arm-redis/2016-04-01/swagger/redis.json Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

are there any readOnly properties in this definition?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

+1

Comment thread arm-redis/2016-04-01/swagger/redis.json Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is the operation returning the deleted resource for "200"?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@veronicagg Nope, we would just return 200 with no body. Is returning the deleted resource a recommended pattern?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is what the HTTP spec https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html says:

9.7 DELETE

The DELETE method requests that the origin server delete the resource identified by the Request-URI. This method MAY be overridden by human intervention (or other means) on the origin server. The client cannot be guaranteed that the operation has been carried out, even if the status code returned from the origin server indicates that the action has been completed successfully. However, the server SHOULD NOT indicate success unless, at the time the response is given, it intends to delete the resource or move it to an inaccessible location.

A successful response SHOULD be 200 (OK) if the response includes an entity describing the status, 202 (Accepted) if the action has not yet been enacted, or 204 (No Content) if the action has been enacted but the response does not include an entity.

If the request passes through a cache and the Request-URI identifies one or more currently cached entities, those entries SHOULD be treated as stale. Responses to this method are not cacheable.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

missing the body parameter, which is marked as required in swagger file: https://travis-ci.org/Azure/azure-rest-api-specs/jobs/206299814#L2546

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

+1

Comment thread arm-redis/2016-04-01/swagger/redis.json Outdated
Copy link
Copy Markdown
Contributor

@veronicagg veronicagg Mar 1, 2017

Choose a reason for hiding this comment

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

are you missing flattening for these properties?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

+1

Comment thread arm-redis/2016-04-01/swagger/redis.json Outdated
Copy link
Copy Markdown
Contributor

@veronicagg veronicagg Mar 1, 2017

Choose a reason for hiding this comment

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

should it be called "ruleName"?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@veronicagg I'm not sure. Is that a recommended pattern for nested resources?

Comment thread arm-redis/2016-04-01/swagger/redis.json Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

typo: there's ":" inside the "properties:" string.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

+1

@TimLovellSmith
Copy link
Copy Markdown
Member Author

@veronicagg Any idea why linters were thinking that 'RedisCreateParameters' was a tracked resource type?

Copy link
Copy Markdown
Contributor

@veronicagg veronicagg left a comment

Choose a reason for hiding this comment

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

@TimLovellSmith regarding "RedisCreateParameters" I believe it was wrongly categorized by the tool and we're looking into that.
Are you planning on updating the return on 200 for delete method?
There's one more thing I found, property names should follow camel case format, so some properties "RedisFirewallRuleProperties/startIP", "RedisFirewallRuleProperties/endIP", "RedistProperties/staticIP" and "RedisForceRebootResponseMessage" are being flagged by our validation tools.
For some reason, I don't see CI results for the latest commit, if you push again, I expect to see them.
It looks like the latest update was squashed with the original commit, please try not to do that, as it makes it more difficult to review changes. Thanks!

"subscriptionId": "subid",
"parameters": {
"properties": {
"startIP": "192.168.1.1",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Property names should follow camel case style: "startIp" , similarly for "endIp"

@TimLovellSmith
Copy link
Copy Markdown
Member Author

Closing this and will open new PR, since we've discussed feedbacks, and am not getting new builds...

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.

4 participants