Skip to content
Closed
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .chronus/changes/azure-location-2025-6-1-12-50-57.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
changeKind: fix
packages:
- "@azure-tools/typespec-azure-resource-manager"
---

`location` in `TrackedResource` should be `azureLocation` instead of `string`.
`eTag` in `EntityTagProperty` should be `eTag` instead of `string`.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ namespace Microsoft.LibraryTest;
enum Versions {
/** 2021-09-21-preview version */
@useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1)
@useDependency(Azure.Core.Versions.v1_0_Preview_1)
@armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v5)
`2021-09-21-preview`,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ namespace Microsoft.UpdateTests;
enum Versions {
/** 2023-03-01-preview version */
@useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1)
@useDependency(Azure.Core.Versions.v1_0_Preview_1)
Comment thread
markcowl marked this conversation as resolved.
Outdated
@armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v5)
`2023-03-01-preview`,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1663,7 +1663,7 @@
"x-ms-client-flatten": true
},
"eTag": {
"type": "string",
"$ref": "#/definitions/Azure.Core.eTag",
"description": "If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields.",
"readOnly": true
},
Expand Down Expand Up @@ -1765,6 +1765,10 @@
}
}
},
"Azure.Core.eTag": {
"type": "string",
"description": "The ETag (or entity tag) HTTP response header is an identifier for a specific version of a resource.\nIt lets caches be more efficient and save bandwidth, as a web server does not need to resend a full response if the content was not changed.\n\nIt is a string of ASCII characters placed between double quotes, like \"675af34563dc-tr34\"."
},
"Azure.ResourceManager.CommonTypes.ManagedServiceIdentityUpdate": {
"type": "object",
"description": "Managed service identity (system assigned and/or user assigned identities)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,10 @@
}
},
"definitions": {
"Azure.Core.eTag": {
"type": "string",
"description": "The ETag (or entity tag) HTTP response header is an identifier for a specific version of a resource.\nIt lets caches be more efficient and save bandwidth, as a web server does not need to resend a full response if the content was not changed.\n\nIt is a string of ASCII characters placed between double quotes, like \"675af34563dc-tr34\"."
},
"Azure.ResourceManager.CommonTypes.ExtendedLocation": {
"type": "object",
"description": "The complex type of the extended location.",
Expand Down Expand Up @@ -506,7 +510,7 @@
"readOnly": true
},
"eTag": {
"type": "string",
"$ref": "#/definitions/Azure.Core.eTag",
"description": "If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields.",
"readOnly": true
},
Expand Down
2 changes: 2 additions & 0 deletions packages/typespec-autorest/test/arm/arm.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ it("no x-ms-client-flatten emitted with default configuration", async () => {
it("generates PATCH bodies for custom patch of common resource envelope mixins", async () => {
const openapi: any = await compileOpenAPI(
`@useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1)
@useDependency(Azure.Core.Versions.v1_0_Preview_1)
@armProviderNamespace
@armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v5)
namespace Microsoft.PatchTest;
Expand Down Expand Up @@ -464,6 +465,7 @@ it("generates PATCH bodies for custom patch of common resource envelope mixins",
it("generates PATCH bodies for resource patch of common resource envelope mixins", async () => {
const openapi: any = await compileOpenAPI(
`@useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1)
@useDependency(Azure.Core.Versions.v1_0_Preview_1)
@armProviderNamespace
@armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v5)
namespace Microsoft.PatchTest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ model TrackedResource extends Resource {

/** The geo-location where the resource lives */
@visibility(Lifecycle.Read, Lifecycle.Create)
location: string;
location: azureLocation;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/typespec-azure-resource-manager/lib/models.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ alias EntityTag = EntityTagProperty;
model EntityTagProperty {
@doc("If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields.")
@visibility(Lifecycle.Read)
eTag?: string;
eTag?: eTag;
}

#deprecated "`ResourceKind` will be deprecated. Please use `ResourceKindProperty` instead."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -602,9 +602,9 @@ model Foo is TrackedResource<FooProperties> {

#### Properties

| Name | Type | Description |
| ----- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| eTag? | `string` | If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. |
| Name | Type | Description |
| ----- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| eTag? | `Core.eTag` | If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. |

### `ExtendedLocationProperty` {#Azure.ResourceManager.ExtendedLocationProperty}

Expand Down Expand Up @@ -2414,10 +2414,10 @@ model Azure.ResourceManager.CommonTypes.TrackedResource

#### Properties

| Name | Type | Description |
| -------- | ---------------- | ----------------------------------------- |
| tags? | `Record<string>` | Resource tags. |
| location | `string` | The geo-location where the resource lives |
| Name | Type | Description |
| -------- | -------------------- | ----------------------------------------- |
| tags? | `Record<string>` | Resource tags. |
| location | `Core.azureLocation` | The geo-location where the resource lives |

### `UserAssignedIdentities` {#Azure.ResourceManager.CommonTypes.UserAssignedIdentities}

Expand Down
Loading