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

[MetricsAdvisor] Bug fix: service returns null in unexpected scenarios #17776

Merged
merged 1 commit into from
Jan 5, 2021

Conversation

kinelski
Copy link
Member

@kinelski kinelski commented Jan 5, 2021

When making a GetDataFeed request to the service, the parameters of the returned Data Source will be null if the requester doesn't have an Administrator role. The corresponding properties are not marked with x-nullable = true in the swagger, so we're throwing a NullReferenceException in these scenarios.

This PR adds transforms to autorest.md and regenerates the code to fix this issue.

@kinelski kinelski added Client This issue points to a problem in the data-plane of the library. Cognitive - Metrics Advisor labels Jan 5, 2021
@kinelski kinelski self-assigned this Jan 5, 2021
@@ -83,6 +83,113 @@ directive:
$.properties.upperBoundaryList.items["x-nullable"] = true;
```

``` yaml
Copy link
Member

Choose a reason for hiding this comment

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

Is there an Issue we can link to that tracks these issues with the swagger?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope, but I can create a new one. I think we'll never close it, though.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Is the intention to communicate to the service about this changes and make sure they address them in their swagger?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. However, based on previous experiences in which we faced literally the same issue, this tends to be treated as a very low priority issue and ends up never being fixed (specially since we can workaround it on the client side). You can see we already had a set of similar transforms in MA for the same reason (service team already aware).

@@ -43,7 +43,7 @@ internal HttpRequestDataFeedSource(HttpRequestParameter parameter)

Parameter = parameter;

Url = new Uri(parameter.Url);
Url = parameter.Url == null ? null : new Uri(parameter.Url);
Copy link
Member

Choose a reason for hiding this comment

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

Is there a test covering this change?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not yet, but we have an issue to add validation as a Viewer (which covers this change): #17767

We still need to find a way to test that, though, since we can't test a newly created data feed as a viewer since we're automatically assigned the admin role. Related: #17765

@kinelski kinelski merged commit 2caaac4 into Azure:master Jan 5, 2021
@kinelski kinelski deleted the ma-fix branch January 5, 2021 23:27
annelo-msft pushed a commit to annelo-msft/azure-sdk-for-net that referenced this pull request Feb 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. Cognitive - Metrics Advisor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants