Skip to content

Conversation

@oucfei
Copy link
Contributor

@oucfei oucfei commented Jun 23, 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

@msftclas
Copy link

@oucfei,
Thanks for your contribution as a Microsoft full-time employee or intern. You do not need to sign a CLA.
Thanks,
Microsoft Pull Request Bot

@oucfei oucfei changed the title Updated the 2017-01-01 version with the latest interaction API. Added 2017-04-26 version [Azure Customer Insight] Updated the 2017-01-01 version with the latest interaction API. Added 2017-04-26 version Jun 23, 2017
Copy link
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.

Please review model validation errors at https://travis-ci.org/Azure/azure-rest-api-specs/jobs/246332416#L1358
Operations API is missing from customer-insights spec: https://travis-ci.org/Azure/azure-rest-api-specs/jobs/246332414#L1364
Should 'location' be removed from parameters of PATCH operation https://travis-ci.org/Azure/azure-rest-api-specs/jobs/246332414#L1416 ? Please note that this may cause a breaking change in the SDKs, and therefore a change may not want to be done in the existing api-version but in the new one.
Please review same errors in 2017-04-26 of the spec: https://travis-ci.org/Azure/azure-rest-api-specs/jobs/246332414#L1812
Please review warnings from linter validation as well https://travis-ci.org/Azure/azure-rest-api-specs/jobs/246332414#L1428 for both specs.
For the new api-version, it'd be great if you could have an initial commit of the old version and a newer commit with the changes (see https://github.com/Azure/azure-rest-api-specs/blob/master/.github/CONTRIBUTING.md#filenames-and-folder-structure)

"type": "string",
"description": "The primary participant property name for an interaction ,This is used to logically represent the agent of the interaction, Specify the participant name here from ParticipantName."
},
"dataSources": {
Copy link
Contributor

Choose a reason for hiding this comment

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

removing/renaming a property is a breaking change (has the service made a breaking change?) and may result in SDK breaking changes, is this intentional for this api-version?
similar comment applies to other changes made to this api-version, please provide additional context on the changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi, this is intentional and it's OK because the 2017-01-01 version never get released before. Last time when we update this swagger, this part was a work-in-progress. Now that it's done and it should look like this (when you call this API with 2017-01-01 version, this is what the returned schema looks like)

Copy link
Contributor

Choose a reason for hiding this comment

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

If the current spec does not match the wire, meaning that it was initially incorrect, then it may be ok corrected (though for anyone who shipped it avoiding a breaking change is best). Regarding your statement about "201-01-01 version never get released before", what do you mean by this?
Having the swagger spec in master of this repo, means anyone could generate an SDK, I see there's an SDK for Go at https://github.com/Azure/azure-sdk-for-go/tree/master/arm/customer-insights.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hi sorry looks like it's released before. However this part was incomplete so I'm sure no one was using it. Anyway the version 2017-01-01 should look like this swagger now

{
"name": "kpiName",
"in": "path",
"requir
Copy link
Contributor

Choose a reason for hiding this comment

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

is "modelAsString: false" intentional? This will make the type an enum, see https://github.com/Azure/autorest/blob/master/docs/extensions/readme.md#x-ms-enum

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hi, sorry it's unclear which line you're referring to. the "modelAsString: false" appear many times in the swagger. But regardless, those are copied from the old api-version, and no changes in the new api version. So it's already there before this PR. Same for the other places.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm referring to targetEntityType, sourceEntityType which are new properties in this spec.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is intentional. They're indeed enum type

{
"name": "kpiName",
"in": "path",
"requir
Copy link
Contributor

Choose a reason for hiding this comment

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

similar question as previous is "modelAsString: false" intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

same as above

{
"name": "kpiName",
"in": "path",
"requir
Copy link
Contributor

Choose a reason for hiding this comment

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

should this description be different from the one below and more descriptive?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry which line is this? It doesn't show correctly above

Copy link
Contributor

Choose a reason for hiding this comment

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

descriptions of sourceEntityType and targetEntityType are the same.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed it

@veronicagg
Copy link
Contributor

veronicagg commented Jun 23, 2017

@ravbhatnagar there's a new api-version being added with some small changes, will you be looking into this review from ARM side?

@ravbhatnagar
Copy link
Contributor

@veronicagg - yes I would like to. Since its a new file it has to be reviewed using notepad++ or something similar. Any recommendations? Can a PR be sent which compares it against the older api version so that only what changed can be reviewed.

@oucfei
Copy link
Contributor Author

oucfei commented Jun 24, 2017

@veronicagg thanks for review the PR.

  1. The model validation error has been fixed.
  2. Operations API is not implemented yet in customer insight. We have a backlog item for that.
  3. 'Location' can not be removed from the PATCH operation because in the code we're explicitly checking it and throws FORBIDDEN if it changed.
  4. I understand it would be easier to review if I had an initial commit for the new api version. Sorry about that. But I can't modify the commits now, right? Maybe you should use some code compare tool to see what changed.

Question:

  1. Do we have to fix all the warnings from linter validation? Those warnings are already there before this PR.
  2. Why is the Travis CI build failed? I don't see any error message related with the swagger
    Thanks again!

@veronicagg
Copy link
Contributor

@ravbhatnagar I've been using VS Code, and comparing with the old version, see http://dailydotnettips.com/2015/06/04/how-to-compare-files-in-visual-studio-code/
We do want the old version of the spec in the first commit and then commits on top of that to make it easier for review, and I asked the author about it, see above. In the meantime, you can use VS Code.

@veronicagg
Copy link
Contributor

veronicagg commented Jun 26, 2017

@oucfei I've replied to your questions in the inline comments, please review.
Regarding your points above:

  1. Thanks, please make sure the examples are matching the wire format
  2. Ok, be aware that until fixed, it'll get reported as a violation. @ravbhatnagar - FYI this is an RPC violation.
  3. 'Location' is required in the body parameter of the PATCH operation at the moment, so are you requiring users of this API to send the property with the same value as it was originally set? @ravbhatnagar RPC violdation https://travis-ci.org/Azure/azure-rest-api-specs/jobs/246332414#L1416
  4. We prefer it this way yes. You could change your previous commits, yes, though if there are review comments they will get messed up, so you can do it after the current comments, but I wouldn't do it after @ravbhatnagar reviews the spec, or they'll get kind of lost.

RE: Questions:

  1. Linter validation: Since you're introducing a new api-version, it's a good time to review all violations. Note that "errors" will be reported for the spec, "warnings" are recommendations, you should evaluate the ones that make sense to you.

  2. Travis CI - there's an issue with one of the tools, I've reported it and the owner is working on it, it shouldn't be due to this PR, we expect it'll be resolved soon.

@oucfei
Copy link
Contributor Author

oucfei commented Jun 26, 2017

@veronicagg thanks for your reply

  1. I have ran "oav validation-example" and no error found.
  2. OK.
  3. I looked at the code again, turned out the location is not required. I have removed from the required properties in the swagger.
  4. OK I will not modify my previous commits for now.

I also looked at the warnings from linter validation and they don't make sense to me, so I will not fix those.

@veronicagg
Copy link
Contributor

veronicagg commented Jun 26, 2017

@oucfei thanks. Regarding 1. ok, the tool will compare the examples with the spec, so if the wire format matches the example, then the spec should more accurately represent the wire format.
3. Ok, I'll let @ravbhatnagar comment on it, since a "Resource" becomes a "Proxy resource" if location is not required, and I'd like to make sure from ARM perspective that's appropriate for your spec.

@ravbhatnagar please review and provide your comments/approval, on behalf of ARM team.

Copy link
Contributor

@ravbhatnagar ravbhatnagar left a comment

Choose a reason for hiding this comment

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

Please take a look at the comments I have added. Majority of those are around existing APIs.
I see in a lot of resource types you have "name" top level property and also a name property inside the properties bag. It is redundant information.

"$ref": "#/definitions/ProfileResourceFormat"
}
},
"202": {
Copy link
Contributor

Choose a reason for hiding this comment

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

Any specific reason why you use the 202 + location header async pattern here but for PUT /hubs you use the 201 + provisioningState. 201 pattern is recommended by ARM for PUT/PATCH as it enables clients provide richer experience when tracking long running operation and provide a reliable way to retrieve and show error messages when it fails.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hi, I don't know any specific reason except that this is how the API was designed and implemented. At this point we're not planning to make change to this API.

"$ref": "#/definitions/InteractionResourceFormat"
}
},
"202": {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment about long running operation as above for LRO (201?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

same as above.

{
"name": "kpiName",
"in": "path",
"requir
Copy link
Contributor

Choose a reason for hiding this comment

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

Existing API - but add the allowed values for this as you have done for other resources.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

which line is this?

{
"name": "kpiName",
"in": "path",
"requir
Copy link
Contributor

Choose a reason for hiding this comment

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

Just to make sure - secrets like keys should not be returned in the response of PUT or GET. It could be confusing to users of SDK if they see/expect these in response.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

which line is this?

}
}
},
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/authorizationPolicies/{authorizationPolicyName}/regeneratePrimaryKey": {
Copy link
Contributor

Choose a reason for hiding this comment

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

Existing API - but do you really need two separate APIs for regenerating primary and secondary keys? I think one API would have sufficed with the request body indicating which key to regenerate.

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 agree it should be sufficed with just one API, but again this is how the API was designed and implemented, and I don't know why.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok. consider changing this in the next API-version revision to make the API cleaner.

{
"name": "kpiName",
"in": "path",
"requir
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like you could have leveraged the "provisioningState" property for this. Is it because of the "expiring" state that you added the state property instead of using the provisioningState. All other states seems to be related to provisioning

Copy link
Contributor Author

Choose a reason for hiding this comment

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

which line is this?

{
"name": "kpiName",
"in": "path",
"requir
Copy link
Contributor

Choose a reason for hiding this comment

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

Existing API - but why do you need tenantId? Can the hub be in a different tenant?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in our API the "tenantId" is actually the "hubId"... we have a bad name and it is confusing...

{
"name": "kpiName",
"in": "path",
"requir
Copy link
Contributor

Choose a reason for hiding this comment

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

Existing API but still wanted to note that resource types should be pluralized - kpi

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not sure which line you're referring to

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure why it doesnt show up there. But likely you wont be able to change it now. I am referring to the resource type "kpi"

{
"name": "kpiName",
"in": "path",
"requir
Copy link
Contributor

Choose a reason for hiding this comment

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

This resource type name conflicts with the Microsoft.Authorization/roleAssignments which is a commonly known RBAC model. This should not have been named this since we dont want to confuse users with the Azure wide concepts like RBAC role assignments.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

which line is this? But anyway I don't think we can change this now.

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure why the line numbers got messed up for some comments. But likely you wont be able to change it now. I am referring to the resource type "roleAssignments"

{
"name": "kpiName",
"in": "path",
"requir
Copy link
Contributor

Choose a reason for hiding this comment

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

Segments not correct for this API. It would be working for you since ARM may be routing based on the parent. The correct segments should be /images/{imageName}/getEntityTypeImageUploadUrl. If imageName is not applicable then do you really need the "images" type? Can you invoke this action on a hubs/{hubName}

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 don't know why it doesn't have {imageName}, but it is what our API looks like and it seems working fine

Copy link
Contributor

Choose a reason for hiding this comment

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

What does this API do? Is the URL same for all images in a hubs/{hubName}. I am wondering if its working as you expect then why do you even need a /images segment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi, this api is to get the images' upload URL. As you can see in the swagger it depends on the entityType, entityTypeName, relativePath, so the URL is not the same for all images in a hub, but it has nothing to do with the imageName. This API is in the ImagesController, I think that's why the person who developed this add a /images segment

@ravbhatnagar
Copy link
Contributor

For #3 - Location should be required for Tracked resources. All this means is that your create parameters look different from your update parameters. You just have to add another model which becomes the request body of your PATCH. That way customers know what is required and what is not and also what can or cannot be updated.

@veronicagg
Copy link
Contributor

@oucfei Please review @ravbhatnagar comments, and if you confirm the resources mentioned in "3" are tracked resources, please make the corresponding updates to the spec. Thanks!

@oucfei
Copy link
Contributor Author

oucfei commented Jun 29, 2017

@ravbhatnagar thanks for your review.

  1. Most of the comment you left are on existing APIs, and I don't know how to resolve those except to tell you that this is how the API was designed and implemented. We're not going to make change to the API, nor the swagger at this point of time. Anyway this swagger was reviewed and approved before, so I think those issues should not block the PR, right?
  2. Is it just me or the same for others, that I can't see which lines of code you're referring to in some of your comments? Again this has already been approved before so I don't think there're any real issues, but if you don't agree, please leave the exact line numbers you're referring to, and I'll take a look again.
  3. I'm not 100% sure what a Tracked resources means, but the create parameters and the update parameters for this API are the same. There's no additional model for PATCH. So I guess it's not tracked resource?

@ravbhatnagar
Copy link
Contributor

Yes, you are right. Feel free to ignore the feedback around existing APIs. We will follow up with you separately on that. Tracked resource means that the "routingType" is set to "default" in the ARM manifest. Hubs is a tracked resource. Anyway location of a resource cant be changed. And so if someone tries to PATCH (change the location) which they can since the same model is being used, the operation will/should fail.

@oucfei
Copy link
Contributor Author

oucfei commented Jul 5, 2017

@veronicagg @ravbhatnagar I've resolved all the comments, and we've agreed not to fix the issues around existing API at this time. So could you please sign off this PR? Please let me know if you still have questions.

@ravbhatnagar
Copy link
Contributor

@oucfei - Only one open question - Tracked resource means that the "routingType" is set to "default" in the ARM manifest. Hubs is a tracked resource. Anyway location of a resource cant be changed. And so if someone tries to PATCH (change the location) which they can since the same model is being used, the operation will/should fail. @veronicagg - This probably is not ideal SDK experience. Please confirm.

@oucfei
Copy link
Contributor Author

oucfei commented Jul 5, 2017

@ravbhatnagar got it. Made "location" required in the PATCH operation.

@azuresdkci
Copy link
Contributor

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: arm-customer-insights/2017-01-01/swagger/customer-insights.json
Before the PR: Warning(s): 36 Error(s): 2
After the PR: Warning(s): 37 Error(s): 2

File: arm-customer-insights/2017-04-26/swagger/customer-insights.json
Before the PR: Warning(s): 0 Error(s): 0
After the PR: Warning(s): 36 Error(s): 2

Know more about AutoRest Linter Guidelines.

Send feedback and make AutoRest Linter Azure Bot smarter day by day!

Thanks for your co-operation.

@ravbhatnagar
Copy link
Contributor

@oucfei - Location of a resource cannot be updated after the resource has been created. So it cant be made required in the PATCH. Ideally, it should not be present in the request body of the PATCH.

@oucfei
Copy link
Contributor Author

oucfei commented Jul 5, 2017

@ravbhatnagar OK... sorry for my misunderstanding. But currently in the API, location is part of the patch request body, and we're explicitly checking if it's changed. So I'm not going to make change to the swagger at this time...

@azuresdkci
Copy link
Contributor

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: arm-customer-insights/2017-01-01/swagger/customer-insights.json
Before the PR: Warning(s): 36 Error(s): 2
After the PR: Warning(s): 37 Error(s): 1

File: arm-customer-insights/2017-04-26/swagger/customer-insights.json
Before the PR: Warning(s): 0 Error(s): 0
After the PR: Warning(s): 36 Error(s): 1

Know more about AutoRest Linter Guidelines.

Send feedback and make AutoRest Linter Azure Bot smarter day by day!

Thanks for your co-operation.

@oucfei
Copy link
Contributor Author

oucfei commented Jul 5, 2017

@ravbhatnagar do you agree with my above comment? can you sign off now?

@ravbhatnagar
Copy link
Contributor

Ok, but please consider updating this at some point since it will improve the client experience.
@veronicagg - ARM signs off.

@veronicagg
Copy link
Contributor

ok, thanks @ravbhatnagar .
@oucfei just so you know, from the SDK perspective, having location not required and as shared model for put and patch will result in an SDK API that won't "require" location for PUT body parameter (https://github.com/oucfei/azure-rest-api-specs/blob/9a36dc27b6b6a4470fad4c39d55f18161178f017/arm-customer-insights/2017-01-01/swagger/customer-insights.json#L75) so the consumer of the API may not send location and get a failed response from the service. For next updates to the API, you'd want to consider creating separate models for PUT or PATCH so you can more accurately represent the service.

@veronicagg veronicagg merged commit 5bb3527 into Azure:master Jul 5, 2017
@oucfei
Copy link
Contributor Author

oucfei commented Jul 5, 2017

@veronicagg thanks! I will create items for the issues mentioned above.

@AutorestCI
Copy link

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

@AutorestCI
Copy link

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

@AutorestCI
Copy link

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

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants