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

RequestSchemaForTrackedResourcesMustHaveTags is incorrectly triggered for a Proxy resource with top-level property Location #753

Open
abatishchev opened this issue Nov 19, 2024 · 0 comments

Comments

@abatishchev
Copy link

Describe the bug
To Reproduce

Given a proxy resource (such as inherited from common type ProxyResource) which has a top-level property location:

model ProxyAccount is ProxyResource<ProxyAccountProperties> {
  name: string;
  location: ProxyAccountLocation;
}

union ProxyAccountLocation {
  Global: "global",
  string,
}

@armResourceOperations
interface ProxyAccounts {
  get is ArmResourceRead<ProxyAccount>;
  create is ArmResourceCreateOrReplaceAsync<ProxyAccount>;
  update is ArmResourcePatchAsync<ProxyAccount, ProxyAccountProperties>;
  delete is ArmResourceDeleteWithoutOkAsync<ProxyAccount>;
  listByResourceGroup is ArmResourceListByParent<ProxyAccount>;
  listBySubscription is ArmListBySubscription<ProxyAccount>;
}

What results in the following swagger:

"ProxyAccount": {
  "type": "object",
  "description": "Proxy account",
  "properties": {
    "properties": {
      "$ref": "#/definitions/ProxyAccountProperties",
      "description": "The resource-specific properties for this resource."
    },
    "location": {
      "$ref": "#/definitions/ProxyAccountLocation",
      "description": "Proxy account location",
      "x-ms-mutability": [
        "read",
        "create"
      ]
    }
  },
  "required": [
    "location"
  ],
  "allOf": [
    {
      "$ref": "../../../../../common-types/resource-management/v5/types.json#/definitions/ProxyResource"
    }
  ]
}

triggers the following Linter rule RequestSchemaForTrackedResourcesMustHaveTags

A tracked resource MUST always have tags as a top level optional property. Tracked resource does not have tags in the request schema.

Steps to reproduce the behavior:

Expected behavior

The rule should not infer the resource's type (tracked vs proxy) by the presence of a top-level property location.

Instead, it should check whether the resource inherits a common type first, and only if doesn't then fall back to the current logic.

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

No branches or pull requests

1 participant