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

[Azure Search] Resolve Swagger linter errors for management API #2242

Merged
merged 9 commits into from
Jan 10, 2018

Conversation

brjohnstmsft
Copy link
Member

@brjohnstmsft brjohnstmsft commented Jan 10, 2018

I recommend reviewing each commit separately.

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

@brjohnstmsft
Copy link
Member Author

"parameters": {
"searchServiceName": "mysearchservice",
"resourceGroupName": "rg1",
"key": "Query key for browser-based clients",
Copy link
Contributor

Choose a reason for hiding this comment

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

Query key for browser-based clients [](start = 16, length = 35)

since this is an examples, should we put a fake key here?

Copy link
Member Author

Choose a reason for hiding this comment

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

You found a bug in the example. Query keys are supposed to be deleted by value, not by name.

I'll use the same placeholder syntax here that I've used elsewhere. Looking at examples in other Swagger specs, I don't see any of the other Azure services using fake values. Some reasons I can think of for this include:

  1. Avoiding accidentally putting a real value in the examples.
  2. Avoiding triggering cred-scanning false positives.

Copy link
Contributor

Choose a reason for hiding this comment

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

Make sense. The two points is what I though you were trying to avoid by putting the description of what the value is supposed to be, using a placeholder is a better idea.

Copy link
Contributor

@Yahnoosh Yahnoosh left a comment

Choose a reason for hiding this comment

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

:shipit:

@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/search/resource-manager/readme.md
Before the PR: Warning(s): 0 Error(s): 12
After the PR: Warning(s): 0 Error(s): 0

AutoRest Linter Guidelines | AutoRest Linter Issues | Send feedback

Thanks for your co-operation.

@@ -969,17 +906,15 @@
"description": "Tags to help categorize the resource in the Azure portal."
}
},
"required": [
Copy link
Contributor

Choose a reason for hiding this comment

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

why is "location" not required anymore?

Copy link
Member Author

Choose a reason for hiding this comment

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

Same as above

@@ -819,29 +773,12 @@
}
}
},
"required": [
Copy link
Contributor

Choose a reason for hiding this comment

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

I think I understand the reason to remove them as required - I could be wrong, but are you trying to allow "SearchService" to be an acceptable request payload for the "patch" operation? In that case, it might help to create some type like SearchServicePatchParameters?

Copy link
Member Author

Choose a reason for hiding this comment

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

Right, I want the client programming model to be simpler by using the same type for both operations.

Copy link
Contributor

Choose a reason for hiding this comment

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

But that way "location" and "sku" are not validated in the create scenarios. @veronicagg Do you have any guidelines which is the recommended way?

Copy link
Member Author

Choose a reason for hiding this comment

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

They are still validated by the RP. This is just a tradeoff between stronger type safety on the client versus fewer classes for the customer to deal with.

Copy link
Contributor

Choose a reason for hiding this comment

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

Discussed with Veronica offline - @brjohnstmsft Do you think you can add some descriptions to "sku" property so that users will know this is required in a create scenario?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, I'll make that change.

@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/search/resource-manager/readme.md
Before the PR: Warning(s): 0 Error(s): 12
After the PR: Warning(s): 0 Error(s): 0

AutoRest Linter Guidelines | AutoRest Linter Issues | Send feedback

Thanks for your co-operation.

@shawns1 shawns1 assigned jianghaolu and unassigned jhendrixMSFT Jan 10, 2018
@jianghaolu jianghaolu merged commit 894d0d8 into Azure:master Jan 10, 2018
@brjohnstmsft brjohnstmsft deleted the update-search-mgmt-spec branch January 10, 2018 23:04
@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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants