Skip to content

Common specs fixes#1603

Merged
fearthecowboy merged 1 commit intoAzure:currentfrom
EvgenyAgafonchikov:common-fixes
Aug 31, 2017
Merged

Common specs fixes#1603
fearthecowboy merged 1 commit intoAzure:currentfrom
EvgenyAgafonchikov:common-fixes

Conversation

@EvgenyAgafonchikov
Copy link
Copy Markdown
Contributor

@EvgenyAgafonchikov EvgenyAgafonchikov commented Aug 29, 2017

  • Updated descriptions
  • CheckDnsNameAvailability.domainNameLabel.required: false -> true
  • Updated usages example, updated usages to suite current server response

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

@azuresdkciprbot
Copy link
Copy Markdown

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

AutoRest Linter Guidelines | AutoRest Linter Issues

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

Thanks for your co-operation.

Copy link
Copy Markdown
Contributor

@fearthecowboy fearthecowboy left a comment

Choose a reason for hiding this comment

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

I've got reservations here -- you're introducing breaking changes (and example data isn't matching types in the spec)

{
"name": "domainNameLabel",
"in": "query",
"required": false,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Was this a mistake previously?

If they didn't pass it in would this fail?

This shouldn't be a binary breaking change, but it is technically be a source-level-breaking change (since someone could have omitted the parameter and now would have to pass one).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

domainNameLabel is a required property on the service. If users were not passing the parameter, the service would throw an exception.

Yes, it is a breaking change on the client but it is required and i dont expect any customers to get impacted since we were anyway throwing .

This is a bug that we are fixing on the client

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I figured as much -- it's not likely to cause a breaking change in the generated code unless someone used the function without the parameter, which would have failed... works for me.

"unit": "Count",
"currentValue": 47,
"limit": 100,
"currentValue": 8.0,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I noticed these are now decimal values.

in usage.json -- these values are listed as int64 format and you're sending in non-integer values.

I don't think that this is OK -- if the values are coming back as non-integers, some deserializers will probably fail. Is there a service change?

   "Usage": {
      "properties": {
        "unit": {
          "type": "string",
          "description": "An enum describing the unit of measurement.",
          "enum": [
            "Count"
          ],
          "x-ms-enum": {
            "name": "UsageUnit",
            "modelAsString": true
          }
        },
        "currentValue": {
          "type": "integer",
          "format": "int64",
          "description": "The current value of the usage."
        },
        "limit": {
          "type": "integer",
          "format": "int64",
          "description": "The limit of usage."
        },
        "name": {
          "$ref": "#/definitions/UsageName",
          "description": "The name of the type of usage."
        }
      },

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we will not be sending non-integer values. sending non-integer values does not make sense for this api.

To be honest, the service uses this object Microsoft.Azure.Insights.Models.UsageMetric to populate the response and property definitions are as follows
private double _currentValue;
private string _id;
private double _limit;
private LocalizableString _name;
private string _nextResetTime;
private TimeSpan? _quotaPeriod;
private string _unit;

Even though it says double currentValue, it doesnt make sense to introduce a breaking change on our client (from int64 to double).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The trouble is, some deserializers may not properly handle deserializing values like 50.0 into an integer field, even if the value is actually a whole number. If your service is returning number values with dots in them, that may not be good for some clients.

I'm more concerned with what the service is returning...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

at this point, i dont know what we can do here. you might have to take it up with the insight people. All usages implementations use that i believe.

Copy link
Copy Markdown
Contributor

@DeepakRajendranMsft DeepakRajendranMsft Aug 31, 2017

Choose a reason for hiding this comment

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

i thikn the right thing to do would be to convert the clients to double but that would be a breaking change :( . do you think we ought to do that. does this warrant a breaking change for the client? i personally dont think we should introduce a breaking change for this...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we just stepped into a lose/lose situation.

If the service has been returning floating point numbers all along (even if they are whole numbers) -- that means the clients are broken already.

Which means, we're better off correcting the specification with the correct types and publishing a new version of the package, even if it means that it's a minor breaking change.

Given that the other things in this PR are corrections which may introduce minor breaking effects, my preference is that let's do the right thing and fix the spec and generate the new code.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i agree with you but the not the timing. With ignite close by, i dont want to do this now. can we do this post ignite? this would require changes in PS as well.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@fearthecowboy, i have opened an issue for this that we will get to after ignite: #1624

},
"Usage": {
"properties": {
"id": {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This will be a breaking change to a generated class.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it is a read only string right? why is that considered a breaking change? what do you suggest we do?

this is a bug fix we are trying to do

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If it's a bugfix, I'm not going to flag it-- it's about as harmless as can be, when introducing a new property into a class where it wasn't before. Likely it's not going to screw anything up.

@DeepakRajendranMsft
Copy link
Copy Markdown
Contributor

@fearthecowboy i have replied to your comments. please take a look.

@fearthecowboy fearthecowboy merged commit 93a080d into Azure:current Aug 31, 2017
@AutorestCI
Copy link
Copy Markdown

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

@AutorestCI
Copy link
Copy Markdown

@AutorestCI
Copy link
Copy Markdown

@EvgenyAgafonchikov EvgenyAgafonchikov deleted the common-fixes branch May 15, 2019 07:20
mccleanp pushed a commit that referenced this pull request Mar 23, 2022
…SaaSMaster

Update communication swagger to have async PUT and DELETE
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.

6 participants