Skip to content

Comments

Application Insights: Add Analytics Items API#2608

Merged
olydis merged 10 commits intoAzure:masterfrom
yoramsinger:master
Apr 9, 2018
Merged

Application Insights: Add Analytics Items API#2608
olydis merged 10 commits intoAzure:masterfrom
yoramsinger:master

Conversation

@yoramsinger
Copy link
Contributor

@yoramsinger yoramsinger commented Mar 7, 2018

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

@AutorestCI
Copy link

AutorestCI commented Mar 7, 2018

Automation for azure-sdk-for-node

A PR has been created for you based on this PR content.

Once this PR will be merged, content will be added to your service PR:
Azure/azure-sdk-for-node#2691

@AutorestCI
Copy link

AutorestCI commented Mar 7, 2018

Automation for azure-sdk-for-python

A PR has been created for you based on this PR content.

Once this PR will be merged, content will be added to your service PR:
Azure/azure-sdk-for-python#2022

@AutorestCI
Copy link

AutorestCI commented Mar 7, 2018

Automation for azure-sdk-for-go

A PR has been created for you based on this PR content.

Once this PR will be merged, content will be added to your service PR:
Azure/azure-sdk-for-go#1554

@olydis olydis added the WaitForARMFeedback <valid label in PR review process> add this label when ARM review is required label Mar 7, 2018
@olydis
Copy link
Contributor

olydis commented Mar 7, 2018

@ravbhatnagar new Swagger

@ravbhatnagar
Copy link
Contributor

@yoramsinger - Are these existing APIs in the service that you are adding to swagger now?

@yoramsinger
Copy link
Contributor Author

Yes. Existing API.

@ravbhatnagar
Copy link
Contributor

Signing off from ARM since there are APIs in prod for a while

@ravbhatnagar ravbhatnagar added ARMSignedOff <valid label in PR review process>add this label when ARM approve updates after review and removed WaitForARMFeedback <valid label in PR review process> add this label when ARM review is required labels Mar 16, 2018
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/{scopePath}": {
"get": {
"description": "Gets a list of Analytics Items defined within an Application Insights component.",
"operationId": "AnalyticsItems_List",
Copy link
Contributor

Choose a reason for hiding this comment

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

please rename to AnalyticsItem_List (operation group names should be consistent) 🙂

},
"definitions": {
"ApplicationInsightsComponentAnalyticsItem": {
"description": "Properties that define an Analytics item that is associated to an Application Insights component.",
Copy link
Contributor

Choose a reason for hiding this comment

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

please add "type": "object"

],
"x-ms-enum": {
"name": "ItemType",
"modelAsString": false
Copy link
Contributor

Choose a reason for hiding this comment

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

please set this to true and remove either the lower or upper case values from the enum list (I assume your service accepts both spellings? If a user sets with specific spelling, will the service return with same spelling or normalize internally? If it normalizes, please choose that spelling here for consistency)

],
"x-ms-enum": {
"name": "ItemScope",
"modelAsString": false
Copy link
Contributor

Choose a reason for hiding this comment

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

this enum sounds as if it could inherently change at some point in time (e.g. future api version). Please set modelAsString to true in such cases as otherwise any such change would be a breaking change 🙂

"type": "string",
"description": "Internally assigned unique id of the item definition."
},
"Name": {
Copy link
Contributor

Choose a reason for hiding this comment

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

since you're an existing service it's not unlikely but: Just wanna confirm, is PascalCasing really what your service sends over the wire?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately yes, this is how it was defined.

"readOnly": true
},
"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.

please pull this out into its own entry in schemas - that way you can control the name chosen during code generation (as is, autorest would pick some name which is usually horrible).

Also, add type: object to the schema 😉

"Properties": {
"properties": {
"functionAlias": {
"type": "string",
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: please format the entire file in the end so indentation is consistent 🙂

],
"x-ms-enum": {
"name": "ItemScopePath",
"modelAsString": false
Copy link
Contributor

Choose a reason for hiding this comment

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

also consider changing to true, see previous comment regarding breaking changes

],
"x-ms-enum": {
"name": "ItemScope",
"modelAsString": false
Copy link
Contributor

Choose a reason for hiding this comment

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

also consider changing to true, see previous comment regarding breaking changes

],
"x-ms-enum": {
"name": "ItemType",
"modelAsString": false
Copy link
Contributor

Choose a reason for hiding this comment

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

also consider changing to true, see previous comment regarding breaking changes

@olydis olydis added Reviewed-FeedbackProvided Reviewed-ChangesRequested <valid label in PR review process>add this label when assignee request changes after review and removed Reviewed-FeedbackProvided labels Mar 20, 2018
@AutorestCI
Copy link

AutorestCI commented Mar 22, 2018

Automation for azure-libraries-for-java

Encountered a Subprocess error: (azure-libraries-for-java)

Command: ['/usr/local/bin/autorest', '/tmp/tmpxa8g74qr/rest/specification/applicationinsights/resource-manager/readme.md', '--azure-libraries-for-java-folder=/tmp/tmpxa8g74qr/sdk', '--fluent', '--java', '--multiapi', '--verbose']
Finished with return code 1
and output:

AutoRest code generation utility [version: 2.0.4262; node: v7.10.1]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
   Loading AutoRest core      '/root/.autorest/@microsoft.azure_autorest-core@2.0.4272/node_modules/@microsoft.azure/autorest-core/dist' (2.0.4272)
   Loading AutoRest extension '@microsoft.azure/autorest.java' (~2.1.32->2.1.49)
   Loading AutoRest extension '@microsoft.azure/autorest.modeler' (2.3.38->2.3.38)
FATAL: System.Exception: Duplicate File Generation: src/main/java/com/microsoft/azure/management/applicationinsights/implementation/FavoritesInner.java
   at AutoRest.Core.CodeGenerator.<Write>d__13.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at AutoRest.Core.CodeGenerator.<Write>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at AutoRest.Java.Azure.Fluent.CodeGeneratorJvaf.<Generate>d__6.MoveNext() in C:\Users\autorest-ci\AppData\Local\Temp\2\PUBLISHedxhk\164_20180307T193002\autorest.java\src\azurefluent\CodeGeneratorJvaf.cs:line 57
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at AutoRest.Java.Program.<ProcessInternal>d__3.MoveNext() in C:\Users\autorest-ci\AppData\Local\Temp\2\PUBLISHedxhk\164_20180307T193002\autorest.java\src\Program.cs:line 115
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NewPlugin.<Process>d__15.MoveNext()
FATAL: java/generate - FAILED
FATAL: Error: Plugin java reported failure.
Process() cancelled due to exception : Plugin java reported failure.
  Error: Plugin java reported failure.

@yoramsinger
Copy link
Contributor Author

I updated per your review. Please verify, thanks.

@olydis olydis added In-Review and removed Reviewed-ChangesRequested <valid label in PR review process>add this label when assignee request changes after review labels Mar 22, 2018
Copy link
Contributor

@olydis olydis left a comment

Choose a reason for hiding this comment

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

looking good overall, some minor things CI tooling found

"description": "Enum indicating the type of the Analytics item.",
"type": "string",
"enum": [
"Query",
Copy link
Contributor

Choose a reason for hiding this comment

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

Your example AnalyticsItemList, AnalyticsItemGet and AnalyticsItemPut disagree with spelling here (seem to be lowercase) - please adjust either examples or Swagger, whichever is wrong 🙂

"default": "None",
"enum": [
"None",
"Query",
Copy link
Contributor

Choose a reason for hiding this comment

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

see spelling comment on other instance of this enum

Copy link
Contributor

Choose a reason for hiding this comment

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

...however, there is another issue: this enum has None has an additional value. This is a problem since both enums are named ItemType, so code-gen would not know what to do. Please either use the same list of values for both enums (if that makes any sense) or choose different names for the two enums - both may be non-ideal solutions, I'd be happy to discuss more

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately the API was not designed well. I'll use 2 separate enums here.

@olydis
Copy link
Contributor

olydis commented Mar 30, 2018

@yoramsinger please address the outstanding issues; this PR will otherwise be closed due to inactivity (but can reopened at any time, once you are ready to move forward)

@yoramsinger
Copy link
Contributor Author

I think I fixed the mentioned issues. Hope it works this time.

@olydis
Copy link
Contributor

olydis commented Apr 2, 2018

@yoramsinger Tiny bug: ItemTypeParameter still has a PascalCased default value of None 🙂

Copy link
Contributor

@olydis olydis left a comment

Choose a reason for hiding this comment

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

looking good, thanks for the fix!

@olydis olydis merged commit 98d88ad into Azure:master Apr 9, 2018
@jhendrixMSFT
Copy link
Member

@AutorestCI regenerate azure-sdk-for-go

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

AutoRest Linter Guidelines | AutoRest Linter Issues | Send feedback

Thanks for your co-operation.

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 Reviewed-FeedbackProvided

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants