RecoveryServices Identities and Usages APIs#920
Conversation
|
@dragonfly91 - Hello, thanks for sending the PR. Can you please provide (1 minimum [just the required properties/parameters for making a request] and 1 maximum [full blown request with all the required and optional properties]) examples for request and response using the extension "x-ms-examples"? This will
You can find more info about the extension and an example swagger spec over here. |
There was a problem hiding this comment.
This is not used anywhere in document, just wondering if it is required
There was a problem hiding this comment.
This was output by Swashbuckle tool by default and we can't remove it while document generation. Our previous PR also contained this object but was merged still.
There was a problem hiding this comment.
Remove it after document generation. Note that generating using Swashbuckle is supposed to be a one time thing, so editing this out should not be an issue. We will not merge (and should not have merged) it like that. SDK's providing their own (unused) Object type are super weird.
There was a problem hiding this comment.
In our team, we have a deeply integrated Swashbuckle tier with which we are aiming to generate the specs with a quality that is review ready. So it is not one time for us. Anyway, we can write a post-script to remove the Object definition manually. Will update the PR by addressing this comment.
There was a problem hiding this comment.
Consider x-ms-client-flatten to avoid nested properties
There was a problem hiding this comment.
This is a polymorphic response type and we observed previously that this structure needs to be preserved for polymorphism to work in the intended manner.
There was a problem hiding this comment.
Consider setting format to byte (for base64 as per swagger specs)
There was a problem hiding this comment.
type:string and format:byte for base64 encoding
There was a problem hiding this comment.
discriminator should be set to required
There was a problem hiding this comment.
Consider setting a min/max length and a regex all params like these
There was a problem hiding this comment.
Is this a new requirement? This was not suggested in the previous PRs. Setting such constraints for global params in each Swagger spec - isn't this a bit redundant; where every team has to add the exact same settings?
There was a problem hiding this comment.
@dragonfly91 Our set of requirements is constantly in motion, "previous PRs" always let stuff pass that won't pass now, even if it's just because a reviewer missed something.
Regarding min/max length or regex patterns: If there is a well defined and strictly enforced (by your service) contract that is most likely not going to change soon, it makes sense to specify it here. For example: Thinking of vaultName, if your service rejects empty string, please do provide a min length of 1. The client side validation will not only fail faster but also provide a better exception!
There was a problem hiding this comment.
Doesn't look like this is used anywhere
There was a problem hiding this comment.
This is output by Swashbuckle by default and we were not able to get rid of it. Can this be ignored?
|
@amarzavery, is providing x-ms-examples a blocker for the review to pass? We use Swashbuckle to auto generate the swagger specs and this new requirement is not yet supported in the tool. So we need to write extra filters and tooling to auto generate the example files. We are in the middle of a release cycle right now and this would add extra cost; we would really like to take this up in the upcoming PR. Is it fine? |
e76550c to
f44da91
Compare
There was a problem hiding this comment.
The correct convention to name operations here would be either "usages_list" or "usages_listbyvaults"
There was a problem hiding this comment.
Vault usage represents usage per vault. The guideline states that the first half of Operation ID should be noun; VaultUsage is a compound noun. What is the issue with this name?
There was a problem hiding this comment.
We are updating some of these guidelines. "Usages" should be the noun here, we plan to discourage such compound nouns moving forward. When fetching collections, the list operation should be named as either "CollectionItem_List" or "CollectionItem_ListByParent" where parent is the immediate preceding type in the url, which is "vaults" in this case
There was a problem hiding this comment.
'PUT' operations should be named as "_create" or "_update"
There was a problem hiding this comment.
An Operations API must be exposed which lists all the operations available
There was a problem hiding this comment.
An Operations API must be exposed which lists all the operations available
There was a problem hiding this comment.
ResourceCertificateDetailsResource is a tracked resource which must have a "GET" operation and a "PATCH" operation (which supports at least updating of tags)
There was a problem hiding this comment.
We don't have GET and PATCH APIs supported in our service as of now. Is this a blocking requirement? We will open a bug on our backend service to support these APIs and once they are in production, we can add the Swagger descriptions for those APIs. Will this work?
There was a problem hiding this comment.
For newer swagger specs we're considering this as a blocking requirement. @ravbhatnagar FYI
There was a problem hiding this comment.
Agreed, GET/PATCH are required. @dragonfly91 - Have these APIs gone through the ARM/Azure API review ?
There was a problem hiding this comment.
An Operations API must be exposed which lists all the operations available
There was a problem hiding this comment.
I understand that the requirement seems to be to support one ListOperations API per swagger spec. We do have Operation_List APIs for each doc, but we have not yet exposed some of the APIs in Swagger yet. So, is it okay if the Operation_List API returns more APIs than that are defined in the spec?
There was a problem hiding this comment.
After some offline discussions it seems exposing the operations API as-is would be the right thing to do.
Alternatively:
- You could expose all the right APIs in the swagger documents for completeness OR
- You could return only those APIs that are currently in swagger from the operations API
@ravbhatnagar could you chime in here?
There was a problem hiding this comment.
Yep, exposing all operations through the /operations API is required. Please fix!
|
Apart from the latest validation rules' violations, PR seems fine, @olydis / @amarzavery would appreciate if you took a cursory look |
There was a problem hiding this comment.
Looks like a result-only data type. If so, please mark all properties as readonly. Same applies to MonitoringSummary and JobsSummary. If primitive member are guaranteed to exist in server responses (if they are "required" to be sent), mark them as x-nullable: false to provide a better user experience for the resulting .Net SDK.
There was a problem hiding this comment.
uhm what is this? not used, so please remove
There was a problem hiding this comment.
Is the order of parameters intended? I have no clear expectations regarding this service, but it seems odd that vaultName is named prior to resourceGroupName, especially since this is the reverse order of how stuff appears in the path! Does this generate an intuitive method signature? (this comment may apply to other methods)
There was a problem hiding this comment.
is this an intuitive name? e.g. are both the Resource prefix and suffix crucial?
There was a problem hiding this comment.
hmmm, a property named "properties" that returns something of type "...Details". @amarzavery Is this convention regarding extending Resource types? Otherwise this mismatch feels a little counter-intuitive.
There was a problem hiding this comment.
duplicate description (or not really specific to this usage). The "encodedness" seems to be a property of the type and not this usage, so simply say that in the type's description and remove this one.
There was a problem hiding this comment.
is properties required or is your service happy about empty requests? Mark the property as required otherwise.
There was a problem hiding this comment.
This looks like a request data type, but none of the properties are marked as required. What does your service do if some of those are missing? I guess at least certificate is required, so please mark it accordingly.
There was a problem hiding this comment.
Remove it after document generation. Note that generating using Swashbuckle is supposed to be a one time thing, so editing this out should not be an issue. We will not merge (and should not have merged) it like that. SDK's providing their own (unused) Object type are super weird.
There was a problem hiding this comment.
@dragonfly91 Our set of requirements is constantly in motion, "previous PRs" always let stuff pass that won't pass now, even if it's just because a reviewer missed something.
Regarding min/max length or regex patterns: If there is a well defined and strictly enforced (by your service) contract that is most likely not going to change soon, it makes sense to specify it here. For example: Thinking of vaultName, if your service rejects empty string, please do provide a min length of 1. The client side validation will not only fail faster but also provide a better exception!
There was a problem hiding this comment.
id, type and name properties for Resource should be marked as read-only
There was a problem hiding this comment.
Paths should follow this format Subscriptions/{subscriptionId}/ResourceGroups/{resourceGroupName}/providers/namespace/typename1/{typename1type}/typename2/{typename2type}/operationname
There was a problem hiding this comment.
Our service contains this API which is in production and we can't afford to change this at time point. Can't take this change now.
There was a problem hiding this comment.
Sure, that works, please mark it as a future requirement since this might become a blocker moving forward
There was a problem hiding this comment.
patch operations should be named as '_update'
There was a problem hiding this comment.
nit: Is this an operation that could take a long time (>30 seconds) if so we might need a 202 response and x-ms-long-running-operation set to true. This applies to the delete operation as well
There was a problem hiding this comment.
This API doesn't take more than 30 seconds; we haven't modeled it as a long running operation in our back-end. So, this comment doesn't apply to us.
There was a problem hiding this comment.
Vault is a tracked resource, please expose a PATCH operation for it
There was a problem hiding this comment.
Mark resource properties "id, name, tag" as readonly
There was a problem hiding this comment.
Per @olydis comments remove this definition even if it is autogenerated by swashbuckle
|
Note that most of our CI jobs are currently failing. As far as I can tell it's due to |
| "produces": [ | ||
| "application/json" | ||
| ], | ||
| "parameters": [ |
There was a problem hiding this comment.
nit: maintain consistency, either place SubscriptionId and ApiVersion together at the beginning of the parameters section or at the end
| ], | ||
| "parameters": [ | ||
| { | ||
| "$ref": "#/parameters/ApiVersion" |
There was a problem hiding this comment.
nit: same comment as above
| "$ref": "#/parameters/ApiVersion" | ||
| }, | ||
| { | ||
| "$ref": "#/parameters/VaultName" |
There was a problem hiding this comment.
Definitely maintain parameter ordering here as it appears in the path, that makes for better user experience
| "description": "Summary of the replication monitoring data for this vault.", | ||
| "type": "object", | ||
| "properties": { | ||
| "unHealthyVmCount": { |
There was a problem hiding this comment.
nit: typo unhealthyVmCount
There was a problem hiding this comment.
Can't take this comment, as this involves changing the service contract.
| } | ||
| } | ||
| }, | ||
| "Object": { |
There was a problem hiding this comment.
Per earlier discussions please remove these Object definitions even if swashbuckle autogenerated these
| ], | ||
| "parameters": [ | ||
| { | ||
| "$ref": "#/parameters/ApiVersion" |
| ], | ||
| "parameters": [ | ||
| { | ||
| "$ref": "#/parameters/ApiVersion" |
| "type": "string", | ||
| "readOnly": true | ||
| }, | ||
| "blobDuration": { |
There was a problem hiding this comment.
Is this a string in date-time format, please confirm
There was a problem hiding this comment.
Yes, this is a string in date-time format
There was a problem hiding this comment.
Please set the format accordingly
| "readOnly": true | ||
| }, | ||
| "Properties": { | ||
| "$ref": "#/definitions/ClientDiscoveryForProperties", |
There was a problem hiding this comment.
ClientDiscoveryForProperties does not sound right semantically. Did you mean ClientDiscoveryProperties
| }, | ||
| "x-ms-discriminator-value": "AzureActiveDirectory" | ||
| }, | ||
| "ResourceCertificateAndACSDetails": { |
There was a problem hiding this comment.
Is this being used/allOfed anywhere? What is the discriminator field here given you are setting the x-ms-discriminator extension
dsgouda
left a comment
There was a problem hiding this comment.
A bunch of model definitions are being repeated across files, it's better if they are consolidated instead given we have a composite swagger here anyway
Also, if model definitions are not being used, please remove them
| ], | ||
| "parameters": [ | ||
| { | ||
| "$ref": "#/parameters/SubscriptionId" |
| ], | ||
| "parameters": [ | ||
| { | ||
| "$ref": "#/parameters/SubscriptionId" |
| ], | ||
| "parameters": [ | ||
| { | ||
| "$ref": "#/parameters/SubscriptionId" |
| ], | ||
| "parameters": [ | ||
| { | ||
| "$ref": "#/parameters/SubscriptionId" |
| ], | ||
| "parameters": [ | ||
| { | ||
| "$ref": "#/parameters/SubscriptionId" |
| } | ||
| } | ||
| }, | ||
| "ClientDiscoveryForProperties": { |
There was a problem hiding this comment.
This is being defined twice, can we define it in a single definitions section instead and refer accordingly, this applies to all model definitions being repeated here
There was a problem hiding this comment.
Do you mean to say that this is repeated across multiple JSONs? Is there a way to share definitions across swagger json files?
There was a problem hiding this comment.
Yes the model definitions are repeated across JSONs. If you believe these definitions are going to be the same for these JSONs it makes sense to put them in a common spec and refer it from there. (Given that the JSONs here belong to the same namespace i.e. Microsoft.RecoveryServices I would believe that to be the case)
Yes, you can certainly share definitions across JSONs. Here is an example
| }, | ||
| "x-ms-azure-resource": true | ||
| }, | ||
| "NonTrackedResource": { |
There was a problem hiding this comment.
NonTrackedResource cannot have the location property. Also if you wish to have tracked and proxy (non-tracked) resources do the following:
- Define a base class called
Resourcewithid, name, tag readonly properties - Define a
tracked resourcewithlocationasrequiredproperty that allOfs onResource - Define a
proxy resource (non tracked resource)that allOfs onResourceand has any additional properties you wish to add
dsgouda
left a comment
There was a problem hiding this comment.
Requesting some Minor changes and updates on some previous comments, looks good otherwise
| ], | ||
| "parameters": [ | ||
| { | ||
| "$ref": "#/parameters/SubscriptionId" |
There was a problem hiding this comment.
nit: Please maintain consistency with parameter ordering, either put SubscriptionId and ApiVersion together at the beginning or at the end of the parameters section
| ], | ||
| "parameters": [ | ||
| { | ||
| "$ref": "#/parameters/SubscriptionId" |
| "application/json" | ||
| ], | ||
| "parameters": [ | ||
| { |
| "application/json" | ||
| ], | ||
| "parameters": [ | ||
| { |
| } | ||
| } | ||
| }, | ||
| "ResourceCertificateAndAADDetails": { |
There was a problem hiding this comment.
Unless I'm mistaken there are duplicate properties in ResourceCertificateAndAADDetails and ResourceCertificateAndACSDetails, why not move them in ResourceCertificateDetails
| "application/json" | ||
| ], | ||
| "parameters": [ | ||
| { |
| } | ||
| } | ||
| }, | ||
| "Resource": { |
There was a problem hiding this comment.
Please set the extension x-ms-azure-resource to true
There was a problem hiding this comment.
We don't want to model Resource as a tracked resource. Only the "TrackedResource" should be an ARM resource and Vault derives from TrackedResource, which derives from Resource.
There was a problem hiding this comment.
You can set move the x-ms-azure-resource extension from "TrackedResource" to "Resource". The extension does not determine if a resource is "TrackedResource" or not, the required property location does that
| "$ref": "#/definitions/Vault" | ||
| } | ||
| }, | ||
| "nextLink": { |
| } | ||
| }, | ||
| "VaultExtendedInfo": { | ||
| "description": "Vault extended information.", |
There was a problem hiding this comment.
nit: This is a part of request and response objects, please ensure the right properties have been set to readonly
There was a problem hiding this comment.
Planning to take this up in the next iteration
There was a problem hiding this comment.
I don't think that is a good idea. Parameters that can be set only at the server side should be marked readonly accordingly. Not doing this would allow users to send incorrect request to the server and result in a bad developer experience.
@olydis thoughts?
There was a problem hiding this comment.
@dragonfly91 @dsgouda Indeed, we even had unusable SDK methods in the past because of that very issue. It boils down to this: readonly not only improves the developer experience, but also causes properties to not be serialized by generated clients during requests. We had RPs that rejected POST/PUT requests containing properties that are readonly from the services perspective. I'm not sure about your RP, but please be aware of this problem and make sure - not only for the developer experience, but actual basic usability - that sending those properties makes sense for your service!
There was a problem hiding this comment.
I've confirmed that none of the properties in this class are eligible for readOnly:true; all the properties can be set during Creation / Update.
There was a problem hiding this comment.
Thanks for confirming this
|
I took care of the param ordering comments and the comment about restructuring the Resource Certificate. Planning to take up remaining comments in the next iteration. |
|
@azuresdkci Test this please |
|
@sarangan12 Can you make required changes in the ruby sdk to unblock the failing CI builds |
| "description": "Composite Swagger for Recovery Services Client" | ||
| }, | ||
| "documents": [ | ||
| "./2015-11-10/swagger/replicationusages.json", |
There was a problem hiding this comment.
So, I missed this earlier. You cannot have different version references like so. What you want to do here is keep the 2015-11-10/swagger/replicationusages.json file as it is and create a new file 2016-06-01/swagger/replicationusages.json and have it referenced here.
Removed unwanted spec Updating composite json
|
Ruby builds are failing since we need to make changes in the Ruby sdk repo to reflect the files corresponding to this RP |
|
Can one of the admins verify this patch? |
|
No modification for NodeJS |
|
No modification for Python |
* MS.K8 ARM Spec * Updated readme.ruby.md * Removed azure-sdk-for-node
Adding registeredIdentities, vault extended info APIs and vault usages API. Also making this a composite client.
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