-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial test framework for emitter (#1394)
* Initial test framework for emitter * Remove the modules folder
- Loading branch information
Showing
579 changed files
with
157,416 additions
and
1 deletion.
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,52 @@ | ||
pool: pool-windows-2019 | ||
|
||
steps: | ||
- task: NodeTool@0 | ||
displayName: 'Use Node 18' | ||
inputs: | ||
versionSpec: 18.x | ||
|
||
- task: Npm@1 | ||
displayName: 'Install @typespec/compiler@latest' | ||
inputs: | ||
command: custom | ||
verbose: false | ||
customCommand: 'install -g "@typespec/compiler"' | ||
|
||
- task: Npm@1 | ||
displayName: 'Install @microsoft/rush' | ||
inputs: | ||
command: custom | ||
verbose: false | ||
customCommand: 'install -g @microsoft/rush@5.63.1' | ||
|
||
- task: CmdLine@2 | ||
displayName: 'Rush sync-versions' | ||
inputs: | ||
script: 'rush sync-versions' | ||
|
||
- task: CmdLine@2 | ||
displayName: 'Rush Update' | ||
inputs: | ||
script: 'rush update' | ||
|
||
- task: CmdLine@2 | ||
displayName: 'Rush Rebuild' | ||
inputs: | ||
script: 'rush rebuild' | ||
|
||
- script: npm install | ||
displayName: 'Run npm install in tests-emitter' | ||
workingDirectory: 'tests-upgrade/tests-emitter' | ||
|
||
- pwsh: | | ||
./EmitterTest.ps1 -AllowList | ||
workingDirectory: 'tests-upgrade/tests-emitter' | ||
displayName: 'Verify Typespec emitter' | ||
|
||
- task: PublishPipelineArtifact@0 | ||
displayName: 'Save artifacts' | ||
inputs: | ||
artifactName: CompareResult | ||
targetPath: tests-upgrade/tests-emitter/CompareResult | ||
condition: succeededOrFailed() |
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,4 @@ | ||
import "@azure-tools/typespec-client-generator-core"; | ||
import "./main.tsp"; | ||
|
||
using Azure.ClientGenerator.Core; |
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,30 @@ | ||
import "@typespec/rest"; | ||
import "@typespec/versioning"; | ||
import "@azure-tools/typespec-azure-core"; | ||
import "@azure-tools/typespec-azure-resource-manager"; | ||
|
||
using TypeSpec.Http; | ||
using TypeSpec.Rest; | ||
using TypeSpec.Versioning; | ||
using Azure.Core; | ||
|
||
namespace Microsoft.MachineLearningServices; | ||
|
||
@doc("Metadata pertaining to creation and last modification of the resource.") | ||
model SystemData { | ||
@visibility("read") | ||
@doc("The timestamp the resource was created at.") | ||
createdAt?: utcDateTime; | ||
|
||
@visibility("read") | ||
@doc("The identity that created the resource.") | ||
createdBy?: string; | ||
|
||
@visibility("read") | ||
@doc("The identity type that created the resource.") | ||
createdByType?: string; | ||
|
||
@visibility("read") | ||
@doc("The timestamp of resource last modification (UTC)") | ||
lastModifiedAt?: utcDateTime; | ||
} |
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,56 @@ | ||
import "@typespec/http"; | ||
import "@typespec/rest"; | ||
import "@typespec/versioning"; | ||
import "@azure-tools/typespec-azure-core"; | ||
import "./routes.tsp"; | ||
|
||
using TypeSpec.Http; | ||
using TypeSpec.Rest; | ||
using TypeSpec.Versioning; | ||
using Azure.Core; | ||
using Azure.Core.Traits; | ||
|
||
@useAuth( | ||
OAuth2Auth<[ | ||
{ | ||
type: OAuth2FlowType.implicit, | ||
authorizationUrl: "https://login.microsoftonline.com/common/oauth2/v2.0/authorize", | ||
scopes: ["https://ml.azure.com/.default"], | ||
} | ||
]> | ||
) | ||
@service({ | ||
title: "Azure Machine Learning Data Plane Services", | ||
}) | ||
@server( | ||
"{endpoint}/genericasset/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}", | ||
"Machinelearning Services Asset APIs", | ||
{ | ||
@doc(""" | ||
Supported Azure-AI asset endpoints. | ||
""") | ||
endpoint: url, | ||
|
||
@doc("The ID of the target subscription.") | ||
subscriptionId: string, | ||
|
||
@doc("The name of the Resource Group.") | ||
resourceGroupName: string, | ||
|
||
@doc("The name of the AzureML workspace or AI project.") | ||
workspaceName: string, | ||
} | ||
) | ||
@versioned(Versions) | ||
namespace Microsoft.MachineLearningServices; | ||
|
||
@doc("Azure Machine Learning Services api versions.") | ||
enum Versions { | ||
@doc("Azure Machine Learning Services api version 2024-04-01-preview.") | ||
@useDependency(Azure.Core.Versions.v1_0_Preview_2) | ||
`2024-04-01-preview`, | ||
|
||
@doc("Azure Machine Learning Services api version 2024-05-01-preview.") | ||
@useDependency(Azure.Core.Versions.v1_0_Preview_2) | ||
`2024-05-01-preview`, | ||
} |
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,99 @@ | ||
import "@typespec/rest"; | ||
import "@azure-tools/typespec-autorest"; | ||
import "@typespec/versioning"; | ||
import "@azure-tools/typespec-azure-core"; | ||
import "./common.tsp"; | ||
import "@typespec/openapi"; | ||
import "@typespec/versioning"; | ||
|
||
using TypeSpec.OpenAPI; | ||
using TypeSpec.Http; | ||
using TypeSpec.Rest; | ||
using TypeSpec.Versioning; | ||
using Azure.Core; | ||
using Azure.Core.Traits; | ||
|
||
namespace Microsoft.MachineLearningServices; | ||
|
||
@doc("AssetVersion Definition") | ||
model AssetVersion { | ||
@doc("Fully qualified resource Id: azureml://workspace/{workspaceName}/indexes/{name}/versions/{version} of the index.") | ||
@visibility("read") | ||
id: string; | ||
|
||
@doc("Update stage to 'Archive' to archive the asset. Default is Development, which means the asset is under development.") | ||
stage?: string = "Development"; | ||
|
||
@doc("Description information of the asset.") | ||
description?: string; | ||
|
||
@doc("Metadata containing createdBy and modifiedBy information.") | ||
@visibility("read") | ||
systemData?: SystemData; | ||
|
||
@doc("Asset's tags. Unlike properties, tags are fully mutable.") | ||
tags?: Record<string>; | ||
|
||
@doc("Asset's properties. Unlike tags, properties are add-only. Once added, a property cannot be removed.") | ||
properties?: Record<string>; | ||
} | ||
|
||
@doc("Index resource Definition") | ||
model Index is AssetVersion { | ||
@doc("Default workspace blob storage Uri. Should work across storage types and auth scenarios.") | ||
storageUri: string; | ||
} | ||
|
||
@doc("Paged collection of IndexVersion items.") | ||
@pagedResult | ||
model PagedIndex { | ||
@doc("The list of Indexes.") | ||
@extension("x-ms-identifiers", []) | ||
@items | ||
value: Index[]; | ||
|
||
@doc("The link to the next page of items") | ||
@nextLink | ||
nextLink?: ResourceLocation<Index>; | ||
} | ||
|
||
@doc("Prompt resource definition") | ||
@added(Versions.`2024-05-01-preview`) | ||
model Prompt is AssetVersion { | ||
@doc("Default workspace blob storage Ui. Should work across storage types and auth scenarios.") | ||
dataUri: string; | ||
|
||
@doc("Relative path of the prompt data file at the dataUri location") | ||
templatePath: string; | ||
} | ||
|
||
@doc("Paged collection of PromptVersion items") | ||
@pagedResult | ||
@added(Versions.`2024-05-01-preview`) | ||
model PagedPrompt { | ||
@doc("The list of Prompts.") | ||
@extension("x-ms-identifiers", []) | ||
@items | ||
value: Prompt[]; | ||
|
||
@doc("The link to the next page of items") | ||
@nextLink | ||
nextLink?: ResourceLocation<Prompt>; | ||
} | ||
|
||
@doc("Next version definition.") | ||
model VersionInfo { | ||
@doc("Next version as defined by the server. The server keeps track of all versions that are string-representations of integers. If one exists, the nextVersion will be a string representation of the highest integer value + 1. Otherwise, the nextVersion will default to '1'.") | ||
nextVersion?: int64; | ||
|
||
@doc("Current latest version of the resource.") | ||
latestVersion: string; | ||
} | ||
|
||
#suppress "@azure-tools/typespec-providerhub/no-inline-model" "Need to create reponses correctly" | ||
alias ResourceCreatedResponse<T extends TypeSpec.Reflection.Model> = TypeSpec.Http.Response<201> & | ||
T; | ||
|
||
#suppress "@azure-tools/typespec-providerhub/no-inline-model" "Need to create reponses correctly" | ||
alias ResourceCreatedOrOkResponse<T extends TypeSpec.Reflection.Model> = ResourceCreatedResponse<T> | (TypeSpec.Http.Response<200> & | ||
T); |
Oops, something went wrong.