Skip to content

Fixed swagger issues for Cheetah assets#2368

Merged
anuchandy merged 1 commit intoAzure:masterfrom
DeveloperTommy:master
Feb 5, 2018
Merged

Fixed swagger issues for Cheetah assets#2368
anuchandy merged 1 commit intoAzure:masterfrom
DeveloperTommy:master

Conversation

@DeveloperTommy
Copy link
Contributor

@DeveloperTommy DeveloperTommy commented Jan 30, 2018

  • Added read-only properties to id, name, and type for model definitions
  • Set x-ms-azure-resource to true for corresponding models
  • Removed required parameters for PATCH request body to fix swagger issues

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

* Added read-only properties to id, name, and type for model definitions
* Set x-ms-azure-resource to true for corresponding models
* Removed name from required for PATCH request body
@AutorestCI
Copy link

Did a commit to Azure/azure-sdk-for-go:
Azure/azure-sdk-for-go@619d455

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

AutoRest Linter Guidelines | AutoRest Linter Issues | Send feedback

Thanks for your co-operation.

@AutorestCI
Copy link

Did a commit to Azure/azure-sdk-for-python:
Azure/azure-sdk-for-python@53ad053

"type": "string",
"readOnly": true,
"description": "Resource type"
},
Copy link
Member

Choose a reason for hiding this comment

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

The proper way to fix this is, to split the Resource definition into 3

    "Resource": {
      "description": "The core properties of ARM resources",
      "properties": {
        "id": {
          "readOnly": true,
          "type": "string",
          "description": "Fully qualified resource Id for the resource."
        },
        "name": {
          "readOnly": true,
          "type": "string",
          "description": "The name of the resource"
        },
        "type": {
          "readOnly": true,
          "type": "string",
          "description": "The type of the resource."
        }
      },
      "x-ms-azure-resource": true
    },
    "TrackedResource": {
      "description": "The resource model definition for a ARM tracked top level resource",
      "properties": {
        "tags": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "x-ms-mutability": [
            "read",
            "create",
            "update"
          ],
          "description": "Resource tags."
        },
        "location": {
          "type": "string",
          "x-ms-mutability": [
            "read",
            "create"
          ],
          "description": "The Azure Region where the resource lives"
        }
      },
      "allOf": [
        {
          "$ref": "#/definitions/Resource"
        }
      ]
    },
    "ProxyResource": {
      "description": "The resource model definition for a ARM proxy resource. It will have everything other than required location and tags",
      "allOf": [
        {
          "$ref": "#/definitions/Resource"
        }
      ]
    }

And all top level resource to derive from the TrackedResource and nested resource (like Certificates) to derive from ProxyResource, we shouldn't annotate arbitrary types with x-ms-azure-resource.

Copy link
Member

Choose a reason for hiding this comment

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

@johanste can you chime in and confirm whether it make sense to follow the above pattern?

Copy link
Member

Choose a reason for hiding this comment

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

Whenever possible, I would use the common type definitions - which already defines the appropriate resource types.

@anuchandy, minor clarification: proxy resource != nested resource. A nested resource may or may not be tracked.

Copy link
Member

Choose a reason for hiding this comment

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

thanks @johanste for the response and correcting the confusion around nested resource.

Since this is an existing API version, conforming to this inheritance hierarchy will cause breaking change (for the models which are based on older Resource base type).

@DeveloperTommy can you please create a work item at your end so that in the next api version we can ensure the models uses this standard hierarchy? Also make a note on the current RPCViolations and SDKViolations reported by CI, many of them will go away once you conform to this hierarchy.

Copy link
Member

Choose a reason for hiding this comment

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

From the reviewer side I will create an issue in the spec repo and ref this PR.

Copy link
Contributor Author

@DeveloperTommy DeveloperTommy Jan 31, 2018

Choose a reason for hiding this comment

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

@anuchandy Sure, I have just created the work item "Task 139186: Refactor Swagger model to follow standard hierarchy" and noted the violations from Travis.

For now, are the current changes that I have acceptable to be merged?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@anuchandy @johanste Bumping for my previous comment.

Copy link
Member

Choose a reason for hiding this comment

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

@anuchandy, do you have anything else you want to get addressed?

Copy link
Member

Choose a reason for hiding this comment

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

no, looks good.. merging this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you both for reviewing!

@anuchandy anuchandy merged commit fe627a2 into Azure:master Feb 5, 2018
mccleanp pushed a commit that referenced this pull request Mar 23, 2022
Renaming Microsoft.Mobility to Microsoft.ConnectedVehicle
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.

5 participants