-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
armResourceIdentifier
scalar to azure core (#407)
Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
- Loading branch information
1 parent
bf2a3a2
commit 2a6b486
Showing
22 changed files
with
401 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
# Change versionKind to one of: internal, fix, dependencies, feature, deprecation, breaking | ||
changeKind: feature | ||
packages: | ||
- "@azure-tools/typespec-autorest" | ||
--- | ||
|
||
Add support for new `Azure.Core.armResourceManager` scalar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
# Change versionKind to one of: internal, fix, dependencies, feature, deprecation, breaking | ||
changeKind: feature | ||
packages: | ||
- "@azure-tools/typespec-azure-core" | ||
--- | ||
|
||
Adding new `armResourceIdentifier` scalar to represent an Arm ID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
# Change versionKind to one of: internal, fix, dependencies, feature, deprecation, breaking | ||
changeKind: deprecation | ||
packages: | ||
- "@azure-tools/typespec-azure-resource-manager" | ||
--- | ||
|
||
Deprecate `ResourceIdentifier` in favor of new `Azure.Core.armResourceIdentifier` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { deepStrictEqual } from "assert"; | ||
import { describe, it } from "vitest"; | ||
import { openApiFor } from "./test-host.js"; | ||
|
||
const base = ` | ||
@service | ||
@useDependency(Azure.Core.Versions.v1_0_Preview_2) | ||
namespace MyService; | ||
`; | ||
|
||
describe("EmbeddingVector", () => { | ||
it("defines embedding vector models", async () => { | ||
const result = await openApiFor(` | ||
${base} | ||
model Foo is Azure.Core.EmbeddingVector<int32>; | ||
`); | ||
const model = result.definitions["Foo"]; | ||
deepStrictEqual(model, { | ||
type: "array", | ||
description: "A vector embedding frequently used in similarity search.", | ||
"x-ms-embedding-vector": true, | ||
items: { | ||
type: "integer", | ||
format: "int32", | ||
}, | ||
}); | ||
}); | ||
}); | ||
|
||
describe("armResourceIdentifier", () => { | ||
it("without config", async () => { | ||
const result = await openApiFor(` | ||
${base} | ||
scalar Foo extends Azure.Core.armResourceIdentifier; | ||
`); | ||
const model = result.definitions["Foo"]; | ||
deepStrictEqual(model, { | ||
type: "string", | ||
format: "arm-id", | ||
description: "A type definition that refers the id to an Azure Resource Manager resource.", | ||
}); | ||
}); | ||
|
||
it("with config", async () => { | ||
const result = await openApiFor(` | ||
${base} | ||
scalar Foo extends Azure.Core.armResourceIdentifier<[{type:"Microsoft.RP/type", scopes:["tenant", "resourceGroup"]}]>; | ||
`); | ||
const model = result.definitions["Foo"]; | ||
deepStrictEqual(model, { | ||
type: "string", | ||
format: "arm-id", | ||
description: "A type definition that refers the id to an Azure Resource Manager resource.", | ||
"x-ms-arm-id-details": { | ||
allowedResources: [ | ||
{ | ||
scopes: ["tenant", "resourceGroup"], | ||
type: "Microsoft.RP/type", | ||
}, | ||
], | ||
}, | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.