Resolve Erroneous `additionalProperty` error on `refWithReadOnly` (#1004)

* This PR adds to the 'selective ignore' list that is maintained to bypass certain errors that we want to ignore. here's the thing. I really think that the true solution is to fix this in the schema schemaValidator, as it's error on the property we're adding to the schema. Is there such a thing as properties on the schema that are present, but totally ignored for the purposes of validation? Need to investigate. in the meantime, this is what it would look like to just ignore this specific error

* move the test with the others

* apply prettier fixes

* add the necessary package and changelog updates to reflect the PR

---------

Co-authored-by: Scott Beddall (from Dev Box) <scbedd@microsoft.com>
This commit is contained in:
Scott Beddall 2023-09-29 13:05:10 -07:00 коммит произвёл GitHub
Родитель e09eb66d08
Коммит 795eda540a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
52 изменённых файлов: 7630 добавлений и 163 удалений

Просмотреть файл

@ -1,5 +1,9 @@
# Change Log - oav
## 09-29-2023 3.2.13
- #1004 fixes an issue with the injected property refWithReadOnly causing additionalProperty error in schema validator.
## 09/25/2023 3.2.12
- #996 Allows `required` properties to be ommitted from a response if they are also marked `readonly`.

Просмотреть файл

@ -1,9 +1,9 @@
import { existsSync, writeFileSync } from "fs";
import { dirname, join, relative, resolve } from "path";
import { mkdirpSync } from "fs-extra";
import { injectable } from "inversify";
import { dump } from "js-yaml";
import _ from "lodash";
import { dirname, join, relative, resolve } from "path";
import { inversifyGetInstance } from "../../inversifyUtils";
import { JsonLoader } from "../../swagger/jsonLoader";
import { setDefaultOpts } from "../../swagger/loader";
@ -316,7 +316,7 @@ class ArmResourceDependencyGenerator {
return [this._basicScenario?.prepareSteps, this._basicScenario?.cleanUpSteps];
}
generateResourceCleanup(resource: ArmResourceManipulator, scenario: RawScenario) {
this._restlerGenerator?.addCleanupSteps(resource,scenario);
this._restlerGenerator?.addCleanupSteps(resource, scenario);
}
}
@ -493,7 +493,7 @@ export class ApiTestRuleBasedGenerator {
if (apiSenarios) {
apiSenarios.description = "[This scenario is auto-generated]" + rule.description;
dependency?.updateExampleFile(resource, apiSenarios);
dependency?.generateResourceCleanup(resource,apiSenarios);
dependency?.generateResourceCleanup(resource, apiSenarios);
definition.scenarios.push({ scenario: rule.name, ...apiSenarios });
}
}

Просмотреть файл

@ -3,9 +3,9 @@ import { URL } from "url";
import { HttpMethods } from "@azure/core-http";
import { injectable } from "inversify";
import { Loader } from "../../swagger/loader";
import { DEFAULT_ARM_ENDPOINT } from "../constants";
import { RequestTracking, SingleRequestTracking } from "./testRecordingApiScenarioGenerator";
import { parseRecordingBodyJson, transformRecordingHeaders } from "./dotnetRecordingLoader";
import { DEFAULT_ARM_ENDPOINT } from "../constants";
interface RecordingFile {
interactions: RecordingEntry[];

Просмотреть файл

@ -28,10 +28,10 @@ import {
import * as util from "../../generator/util";
import { setDefaultOpts } from "../../swagger/loader";
import Mocker from "../../generator/mocker";
import { ArmResourceManipulator } from "./ApiTestRuleBasedGenerator";
import { logger } from ".././logger";
import { xmsExamples, xmsSkipUrlEncoding } from "../../util/constants";
import { ApiScenarioYamlLoader } from "../apiScenarioYamlLoader";
import { ArmResourceManipulator } from "./ApiTestRuleBasedGenerator";
export interface ApiScenarioGeneratorOption extends ApiScenarioLoaderOption {
swaggerFilePaths: string[];

Просмотреть файл

@ -3,7 +3,7 @@ import { ApiTestGeneratorRule, ResourceManipulatorInterface } from "../ApiTestRu
export const NoChildResourceCreated: ApiTestGeneratorRule = {
name: "NoChildResourceCreated",
armRpcCodes: ["RPC-Put-V1-16","RPC-Put-V1-17"],
armRpcCodes: ["RPC-Put-V1-16", "RPC-Put-V1-17"],
description: "Check if put operation will create nested resource implicitly.",
resourceKinds: ["Tracked", "Extension"],
appliesTo: ["ARM"],
@ -13,18 +13,18 @@ export const NoChildResourceCreated: ApiTestGeneratorRule = {
if (childResources.length === 0) {
return null;
}
let hit = false
let hit = false;
for (resource of childResources) {
const listOperation = resource.getListOperations()[0]
const listOperation = resource.getListOperations()[0];
if (listOperation && listOperation.examples[0]) {
const step:RawStep = {
const step: RawStep = {
operationId: listOperation.operationId,
responses: {200: {body:{ value:[]}}}
responses: { 200: { body: { value: [] } } },
};
base.steps.push(step);
hit = true;
}
}
return hit ? base : null
return hit ? base : null;
},
};

Просмотреть файл

@ -14,7 +14,8 @@ function getResourceNameParameter(path: string) {
export const ResourceNameCaseInsensitive: ApiTestGeneratorRule = {
name: "ResourceNameCaseInSensitive",
armRpcCodes: ["RPC-V2-PUT-3"],
description: "Check if the resource name in the response has same case with resource name in the request.",
description:
"Check if the resource name in the response has same case with resource name in the request.",
resourceKinds: ["Tracked"],
appliesTo: ["ARM"],
useExample: true,
@ -27,14 +28,15 @@ export const ResourceNameCaseInsensitive: ApiTestGeneratorRule = {
// generate a mocked value
base.variables._mockedRandom = { type: "string", prefix: "r" };
// set the operation variable
const oldPrefix = (resourceNameVar as any).prefix || `${resourceName.toLocaleLowerCase().substring(0, 10)}`;
const oldPrefix =
(resourceNameVar as any).prefix || `${resourceName.toLocaleLowerCase().substring(0, 10)}`;
(resourceNameVar as any).value = `${toUpper(oldPrefix)}$(_mockedRandom)`;
delete (resourceNameVar as any).prefix;
// modify the global variable
base.variables[resourceName] = { value: `${oldPrefix}$(_mockedRandom)`, type: "string" };
variables[resourceName] = resourceNameVar;
}
const step:RawStep = { operationId: getOp.operationId ,variables};
const step: RawStep = { operationId: getOp.operationId, variables };
base.steps.push(step);
return base;
},

Просмотреть файл

@ -5,20 +5,19 @@ export const SystemDataExistsInResponse: ApiTestGeneratorRule = {
name: "SystemDataExistsInResponse",
armRpcCodes: ["RPC-SystemData-V1-01"],
description: "Check if the systemData exists in the response.",
resourceKinds: ["Tracked","Proxy","Extension"],
resourceKinds: ["Tracked", "Proxy", "Extension"],
appliesTo: ["ARM"],
useExample: true,
generator: (resource: ResourceManipulatorInterface, base: RawScenario) => {
const getOp = resource.getResourceOperation("Get");
const step:RawStep = { operationId: getOp.operationId };
const step: RawStep = { operationId: getOp.operationId };
const responses = {} as any;
if (resource.getProperty( "systemData")) {
if (resource.getProperty("systemData")) {
responses["200"] = [{ test: "/body/systemData", expression: "to.not.be.undefined" }];
step.responses = responses
}
else {
return null
step.responses = responses;
} else {
return null;
}
base.steps.push(step);
return base;

Просмотреть файл

@ -285,6 +285,14 @@ const shouldSkipError = (error: ErrorObject, cxt: SchemaValidateContext) => {
return true;
}
// If we're erroring on the added property refWithReadOnly simply ignore the error
if (
error.keyword === "additionalProperties" &&
(params as any).additionalProperty === "refWithReadOnly"
) {
return true;
}
// If a response has x-ms-mutability property and its missing the read we can skip this error
if (
cxt.isResponse &&

4
package-lock.json сгенерированный
Просмотреть файл

@ -1,12 +1,12 @@
{
"name": "oav",
"version": "3.2.9",
"version": "3.2.13",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "oav",
"version": "3.2.9",
"version": "3.2.13",
"license": "MIT",
"dependencies": {
"@apidevtools/swagger-parser": "10.0.3",

Просмотреть файл

@ -1,6 +1,6 @@
{
"name": "oav",
"version": "3.2.12",
"version": "3.2.13",
"author": {
"name": "Microsoft Corporation",
"email": "azsdkteam@microsoft.com",

Просмотреть файл

@ -1,10 +1,13 @@
import * as assert from "assert";
import { exec } from "child_process";
import { existsSync,readFileSync, writeFileSync } from "fs";
import { existsSync, readFileSync, writeFileSync } from "fs";
import { dirname, join, resolve } from "path";
import { mkdirpSync } from "fs-extra";
import glob from "glob";
import {dirname, join, resolve } from "path";
import { ApiTestGeneratorRule, ApiTestRuleBasedGenerator } from "../lib/apiScenario/gen/ApiTestRuleBasedGenerator";
import {
ApiTestGeneratorRule,
ApiTestRuleBasedGenerator,
} from "../lib/apiScenario/gen/ApiTestRuleBasedGenerator";
import { NoChildResourceCreated } from "../lib/apiScenario/gen/rules/noChildResourceCreated";
import { ResourceNameCaseInsensitive } from "../lib/apiScenario/gen/rules/resourceNameCaseInsensitive";
import { SystemDataExistsInResponse } from "../lib/apiScenario/gen/rules/systemDataExistsInResponse";
@ -18,7 +21,7 @@ jest.setTimeout(9999999);
export const testApiTestRuleBase = async (
swaggers: string[],
specFolder:string,
specFolder: string,
rules: ApiTestGeneratorRule[],
isRPaaS?: string
) => {
@ -30,46 +33,46 @@ export const testApiTestRuleBase = async (
const swaggerLoader = inversifyGetInstance(SwaggerLoader, opts);
const jsonLoader = inversifyGetInstance(JsonLoader, opts);
const generateDependencyFile = async (swaggers:string[],specFolder:string) => {
const outputDir = `.restler_output_${swaggers[0].split("/")[1]}`
const restlerConfig = {
SwaggerSpecFilePath: swaggers.map(s => join("/swagger",s)),
};
const restlerConfigFile = join("restler_config", "config.json")
if (!existsSync(dirname(join(specFolder, restlerConfigFile)))) {
mkdirpSync(dirname(join(specFolder, restlerConfigFile)));
}
writeFileSync(join(specFolder, restlerConfigFile), JSON.stringify(restlerConfig));
const { err, stderr } = (await new Promise((res) =>
exec(
`docker run --rm -v $(pwd):/swagger -w /swagger/${outputDir} mcr.microsoft.com/restlerfuzzer/restler dotnet /RESTler/restler/Restler.dll compile /swagger/${restlerConfigFile}`,
{ encoding: "utf8", maxBuffer: 1024 * 1024 * 64, cwd: specFolder },
(err: unknown, stdout: unknown, stderr: unknown) =>
res({ err: err, stderr: stderr, stdout: stdout })
)
)) as any;
if (err || stderr) {
console.log(err || stderr)
}
const dependencyFile = resolve(specFolder,outputDir,"Compile/dependencies.json")
if (existsSync(dependencyFile)) {
return dependencyFile
}
console.log(`Could not find dependency file:${dependencyFile}.`)
return null
}
const generateDependencyFile = async (swaggers: string[], specFolder: string) => {
const outputDir = `.restler_output_${swaggers[0].split("/")[1]}`;
const restlerConfig = {
SwaggerSpecFilePath: swaggers.map((s) => join("/swagger", s)),
};
const restlerConfigFile = join("restler_config", "config.json");
if (!existsSync(dirname(join(specFolder, restlerConfigFile)))) {
mkdirpSync(dirname(join(specFolder, restlerConfigFile)));
}
writeFileSync(join(specFolder, restlerConfigFile), JSON.stringify(restlerConfig));
const { err, stderr } = (await new Promise((res) =>
exec(
`docker run --rm -v $(pwd):/swagger -w /swagger/${outputDir} mcr.microsoft.com/restlerfuzzer/restler dotnet /RESTler/restler/Restler.dll compile /swagger/${restlerConfigFile}`,
{ encoding: "utf8", maxBuffer: 1024 * 1024 * 64, cwd: specFolder },
(err: unknown, stdout: unknown, stderr: unknown) =>
res({ err: err, stderr: stderr, stdout: stdout })
)
)) as any;
if (err || stderr) {
console.log(err || stderr);
}
const dependencyFile = resolve(specFolder, outputDir, "Compile/dependencies.json");
if (existsSync(dependencyFile)) {
return dependencyFile;
}
console.log(`Could not find dependency file:${dependencyFile}.`);
return null;
};
const dependencyFile = await generateDependencyFile(swaggers, specFolder);
const outputDir = `${join(specFolder,dirname(swaggers[0]))}/generatedScenarios`;
assert.ok(dependencyFile)
const outputDir = `${join(specFolder, dirname(swaggers[0]))}/generatedScenarios`;
assert.ok(dependencyFile);
const generator = new ApiTestRuleBasedGenerator(
swaggerLoader,
jsonLoader,
rules,
swaggers.map(s =>resolve(specFolder,s)),
swaggers.map((s) => resolve(specFolder, s)),
dependencyFile!
);
await generator.run(outputDir, isRPaaS ? "RPaaS" : "ARM");
const pathPattern = resolve(outputDir,"*.yaml")
const pathPattern = resolve(outputDir, "*.yaml");
return glob.sync(pathPattern, {
ignore: ["**/examples/**/*.json", "**/quickstart-templates/*.json", "**/schema/*.json"],
});
@ -84,14 +87,15 @@ async function testApiTestRuleBaseForReadme(
const inputs = (await getInputFiles(join(specFolder, readmeMd))).map((it: string) =>
join(dirname(readmeMd), it)
);
return await testApiTestRuleBase(
return await testApiTestRuleBase(
inputs.filter((spec) => !isCommonSpec(join(specFolder, spec))),
specFolder,
rules,isRPaaS
rules,
isRPaaS
);
}
function isCommonSpec(swagger:string) {
function isCommonSpec(swagger: string) {
const swaggerDefinition = JSON.parse(readFileSync(swagger).toString());
return !swaggerDefinition.paths || Object.keys(swaggerDefinition.paths).length === 0;
}
@ -108,21 +112,19 @@ describe("Api Test rule based generator test", () => {
ignore: ["**/examples/**/*.json", "**/quickstart-templates/*.json", "**/schema/*.json"],
}
);
const selectedRps = ["appconfiguration","monitor","sql","hdinsight", "resource","storage"];
const selectedRps = ["appconfiguration", "monitor", "sql", "hdinsight", "resource", "storage"];
const allSpecs = specPaths
.filter(
(p: string) => selectedRps.some((rp: string) => p.includes(`specification/${rp}/`))
)
.filter((p: string) => selectedRps.some((rp: string) => p.includes(`specification/${rp}/`)))
.map((f) => f.substring(specFolder.length + 1));
it("test rules", async () => {
for (const readmeMd of allSpecs) {
const scenarioFiles = await testApiTestRuleBaseForReadme(
readmeMd,
specFolder,
[NoChildResourceCreated,ResourceNameCaseInsensitive,SystemDataExistsInResponse]
);
const scenarioFiles = await testApiTestRuleBaseForReadme(readmeMd, specFolder, [
NoChildResourceCreated,
ResourceNameCaseInsensitive,
SystemDataExistsInResponse,
]);
assert.ok(scenarioFiles);
}
})
})
});
});

Просмотреть файл

@ -29,7 +29,7 @@ describe("Live Validator", () => {
isArmCall: false,
isPathCaseSensitive: false,
loadValidatorInBackground: true,
loadValidatorInInitialize: false
loadValidatorInInitialize: false,
};
const validator = new LiveValidator();
assert.equal(0, validator.operationSearcher.cache.size);
@ -78,7 +78,7 @@ describe("Live Validator", () => {
},
directory: path.resolve(os.homedir(), "repo"),
loadValidatorInBackground: true,
loadValidatorInInitialize: false
loadValidatorInInitialize: false,
};
const validator = new LiveValidator({ swaggerPaths });
assert.equal(0, validator.operationSearcher.cache.size);
@ -98,7 +98,7 @@ describe("Live Validator", () => {
},
directory,
loadValidatorInBackground: true,
loadValidatorInInitialize: false
loadValidatorInInitialize: false,
};
const validator = new LiveValidator({ swaggerPaths, directory });
assert.equal(0, validator.operationSearcher.cache.size);
@ -122,7 +122,7 @@ describe("Live Validator", () => {
},
directory,
loadValidatorInBackground: true,
loadValidatorInInitialize: false
loadValidatorInInitialize: false,
};
const validator = new LiveValidator({
swaggerPaths,
@ -148,7 +148,7 @@ describe("Live Validator", () => {
isArmCall: false,
isPathCaseSensitive: false,
loadValidatorInBackground: true,
loadValidatorInInitialize: false
loadValidatorInInitialize: false,
};
const validator = new LiveValidator({
swaggerPaths,
@ -1063,7 +1063,7 @@ describe("Live Validator", () => {
git: {
shouldClone: false,
},
isArmCall: true
isArmCall: true,
};
const liveValidator = new LiveValidator(options);
await liveValidator.initialize();

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,21 @@
{
"parameters": {
"api-version": "2022-10-01",
"subscriptionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"location": "westus",
"parameters": {
"subdomainName": "contosodemoapp1",
"type": "Microsoft.CognitiveServices/accounts"
}
},
"responses": {
"200": {
"body": {
"isSubdomainAvailable": false,
"reason": "Sub domain name 'contosodemoapp1' is not valid",
"subdomainName": "contosodemoapp1",
"type": "Microsoft.CognitiveServices/accounts"
}
}
}
}

Просмотреть файл

@ -0,0 +1,30 @@
{
"parameters": {
"api-version": "2022-10-01",
"subscriptionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"location": "westus",
"parameters": {
"skus": [
"S0"
],
"kind": "Face",
"type": "Microsoft.CognitiveServices/accounts"
}
},
"responses": {
"200": {
"body": {
"value": [
{
"kind": "Face",
"type": "Microsoft.CognitiveServices/accounts",
"skuName": "S0",
"skuAvailable": true,
"reason": null,
"message": null
}
]
}
}
}
}

Просмотреть файл

@ -0,0 +1,140 @@
{
"parameters": {
"api-version": "2022-10-01",
"subscriptionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"resourceGroupName": "myResourceGroup",
"accountName": "testCreate1",
"account": {
"location": "West US",
"kind": "Emotion",
"sku": {
"name": "S0"
},
"properties": {
"encryption": {
"keyVaultProperties": {
"keyName": "KeyName",
"keyVersion": "891CF236-D241-4738-9462-D506AF493DFA",
"keyVaultUri": "https://pltfrmscrts-use-pc-dev.vault.azure.net/"
},
"keySource": "Microsoft.KeyVault"
},
"userOwnedStorage": [
{
"resourceId": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"
}
]
},
"identity": {
"type": "SystemAssigned"
}
}
},
"responses": {
"200": {
"body": {
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.CognitiveServices/accounts/testCreate1",
"name": "testCreate1",
"type": "Microsoft.CognitiveServices/accounts",
"location": "West US",
"sku": {
"name": "S0"
},
"kind": "Emotion",
"etag": "W/\"datetime'2017-04-10T08%3A00%3A05.445595Z'\"",
"properties": {
"endpoint": "https://westus.api.cognitive.microsoft.com/emotion/v1.0",
"provisioningState": "Succeeded",
"encryption": {
"keySource": "Microsoft.KeyVault",
"keyVaultProperties": {
"keyName": "FakeKeyName",
"keyVersion": "891CF236-D241-4738-9462-D506AF493DFA",
"keyVaultUri": "https://pltfrmscrts-use-pc-dev.vault.azure.net/"
}
},
"userOwnedStorage": [
{
"resourceId": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"
}
]
},
"identity": {
"principalId": "b5cf119e-a5c2-42c7-802f-592e0efb169f",
"tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47",
"type": "SystemAssigned"
}
}
},
"201": {
"body": {
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.CognitiveServices/accounts/testCreate1",
"name": "testCreate1",
"type": "Microsoft.CognitiveServices/accounts",
"location": "West US",
"sku": {
"name": "S0"
},
"kind": "Emotion",
"etag": "W/\"datetime'2017-04-10T07%3A57%3A48.4582781Z'\"",
"properties": {
"endpoint": "https://westus.api.cognitive.microsoft.com/emotion/v1.0",
"provisioningState": "Succeeded",
"encryption": {
"keySource": "Microsoft.KeyVault",
"keyVaultProperties": {
"keyName": "FakeKeyName",
"keyVersion": "891CF236-D241-4738-9462-D506AF493DFA",
"keyVaultUri": "https://pltfrmscrts-use-pc-dev.vault.azure.net/"
}
},
"userOwnedStorage": [
{
"resourceId": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"
}
]
},
"identity": {
"principalId": "b5cf119e-a5c2-42c7-802f-592e0efb169f",
"tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47",
"type": "SystemAssigned"
}
}
},
"202": {
"body": {
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.CognitiveServices/accounts/testCreate1",
"name": "testCreate1",
"type": "Microsoft.CognitiveServices/accounts",
"location": "West US",
"sku": {
"name": "S0"
},
"kind": "Emotion",
"etag": "W/\"datetime'2017-04-10T07%3A57%3A48.4582781Z'\"",
"properties": {
"endpoint": "https://westus.api.cognitive.microsoft.com/emotion/v1.0",
"provisioningState": "Succeeded",
"encryption": {
"keySource": "Microsoft.KeyVault",
"keyVaultProperties": {
"keyName": "FakeKeyName",
"keyVersion": "891CF236-D241-4738-9462-D506AF493DFA",
"keyVaultUri": "https://pltfrmscrts-use-pc-dev.vault.azure.net/"
}
},
"userOwnedStorage": [
{
"resourceId": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"
}
]
},
"identity": {
"principalId": "b5cf119e-a5c2-42c7-802f-592e0efb169f",
"tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47",
"type": "SystemAssigned"
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,87 @@
{
"parameters": {
"api-version": "2022-10-01",
"subscriptionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"resourceGroupName": "myResourceGroup",
"accountName": "testCreate1",
"account": {
"location": "West US",
"kind": "CognitiveServices",
"sku": {
"name": "S0"
},
"properties": {},
"identity": {
"type": "SystemAssigned"
}
}
},
"responses": {
"200": {
"body": {
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.CognitiveServices/accounts/testCreate1",
"name": "testCreate1",
"type": "Microsoft.CognitiveServices/accounts",
"location": "West US",
"sku": {
"name": "S0"
},
"kind": "Emotion",
"etag": "W/\"datetime'2017-04-10T08%3A00%3A05.445595Z'\"",
"properties": {
"endpoint": "https://westus.api.cognitive.microsoft.com/emotion/v1.0",
"provisioningState": "Succeeded"
},
"identity": {
"principalId": "b5cf119e-a5c2-42c7-802f-592e0efb169f",
"tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47",
"type": "SystemAssigned"
}
}
},
"201": {
"body": {
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.CognitiveServices/accounts/testCreate1",
"name": "testCreate1",
"type": "Microsoft.CognitiveServices/accounts",
"location": "West US",
"sku": {
"name": "S0"
},
"kind": "Emotion",
"etag": "W/\"datetime'2017-04-10T07%3A57%3A48.4582781Z'\"",
"properties": {
"endpoint": "https://westus.api.cognitive.microsoft.com/emotion/v1.0",
"provisioningState": "Succeeded"
},
"identity": {
"principalId": "b5cf119e-a5c2-42c7-802f-592e0efb169f",
"tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47",
"type": "SystemAssigned"
}
}
},
"202": {
"body": {
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.CognitiveServices/accounts/testCreate1",
"name": "testCreate1",
"type": "Microsoft.CognitiveServices/accounts",
"location": "West US",
"sku": {
"name": "S0"
},
"kind": "Emotion",
"etag": "W/\"datetime'2017-04-10T07%3A57%3A48.4582781Z'\"",
"properties": {
"endpoint": "https://westus.api.cognitive.microsoft.com/emotion/v1.0",
"provisioningState": "Succeeded"
},
"identity": {
"principalId": "b5cf119e-a5c2-42c7-802f-592e0efb169f",
"tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47",
"type": "SystemAssigned"
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,13 @@
{
"parameters": {
"api-version": "2022-10-01",
"subscriptionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"resourceGroupName": "myResourceGroup",
"accountName": "PropTest01"
},
"responses": {
"200": {},
"202": {},
"204": {}
}
}

Просмотреть файл

@ -0,0 +1,14 @@
{
"parameters": {
"api-version": "2022-10-01",
"subscriptionId": "subscriptionId",
"resourceGroupName": "resourceGroupName",
"accountName": "accountName",
"commitmentPlanName": "commitmentPlanName"
},
"responses": {
"200": {},
"202": {},
"204": {}
}
}

Просмотреть файл

@ -0,0 +1,14 @@
{
"parameters": {
"api-version": "2022-10-01",
"subscriptionId": "subscriptionId",
"resourceGroupName": "resourceGroupName",
"accountName": "accountName",
"deploymentName": "deploymentName"
},
"responses": {
"200": {},
"202": {},
"204": {}
}
}

Просмотреть файл

@ -0,0 +1,15 @@
{
"parameters": {
"subscriptionId": "{subscription-id}",
"resourceGroupName": "res6977",
"accountName": "sto2527",
"privateEndpointConnectionName": "{privateEndpointConnectionName}",
"api-version": "2022-10-01",
"monitor": "true"
},
"responses": {
"200": {},
"202": {},
"204": {}
}
}

Просмотреть файл

@ -0,0 +1,31 @@
{
"parameters": {
"api-version": "2022-10-01",
"subscriptionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"resourceGroupName": "myResourceGroup",
"accountName": "myAccount"
},
"responses": {
"200": {
"body": {
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.CognitiveServices/accounts/myAccount",
"name": "myAccount",
"type": "Microsoft.CognitiveServices/accounts",
"location": "westus",
"sku": {
"name": "F0"
},
"kind": "Emotion",
"tags": {
"Owner": "felixwa",
"ExpiredDate": "2017/09/01"
},
"etag": "W/\"datetime'2017-04-10T04%3A42%3A19.7067387Z'\"",
"properties": {
"endpoint": "https://westus.api.cognitive.microsoft.com/emotion/v1.0",
"provisioningState": "Succeeded"
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,26 @@
{
"parameters": {
"api-version": "2022-10-01",
"subscriptionId": "subscriptionId",
"resourceGroupName": "resourceGroupName",
"accountName": "accountName",
"commitmentPlanName": "commitmentPlanName"
},
"responses": {
"200": {
"body": {
"id": "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/commitmentPlans/commitmentPlanName",
"name": "commitmentPlanName",
"type": "Microsoft.CognitiveServices/accounts/commitmentPlans",
"properties": {
"hostingModel": "Web",
"planType": "Speech2Text",
"autoRenew": true,
"current": {
"tier": "T1"
}
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,32 @@
{
"parameters": {
"api-version": "2022-10-01",
"subscriptionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"resourceGroupName": "myResourceGroup",
"accountName": "myAccount",
"location": "westus"
},
"responses": {
"200": {
"body": {
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/providers/Microsoft.CognitiveServices/locations/westus/resourceGroups/myResourceGroup/deletedAccounts/myAccount",
"name": "myAccount",
"type": "Microsoft.CognitiveServices/accounts",
"location": "westus",
"sku": {
"name": "F0"
},
"kind": "Emotion",
"tags": {
"Owner": "felixwa",
"ExpiredDate": "2017/09/01"
},
"etag": "W/\"datetime'2017-04-10T04%3A42%3A19.7067387Z'\"",
"properties": {
"endpoint": "https://westus.api.cognitive.microsoft.com/emotion/v1.0",
"provisioningState": "Succeeded"
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,30 @@
{
"parameters": {
"api-version": "2022-10-01",
"subscriptionId": "subscriptionId",
"resourceGroupName": "resourceGroupName",
"accountName": "accountName",
"deploymentName": "deploymentName"
},
"responses": {
"200": {
"body": {
"id": "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/deployments/deploymentName",
"name": "deploymentName",
"type": "Microsoft.CognitiveServices/accounts/deployments",
"properties": {
"model": {
"format": "OpenAI",
"name": "ada",
"version": "1"
},
"scaleSettings": {
"scaleType": "Manual",
"capacity": 1
},
"provisioningState": "Succeeded"
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,43 @@
{
"parameters": {
"api-version": "2022-10-01"
},
"responses": {
"200": {
"body": {
"value": [
{
"name": "Microsoft.CognitiveServices/accounts/read",
"display": {
"provider": "Microsoft Cognitive Services",
"resource": "Cognitive Services API Account",
"operation": "Read API Account",
"description": "Reads API accounts."
},
"origin": "user,system"
},
{
"name": "Microsoft.CognitiveServices/accounts/write",
"display": {
"provider": "Microsoft Cognitive Services",
"resource": "Cognitive Services API Account",
"operation": "Write API Account",
"description": "Writes API Accounts."
},
"origin": "user,system"
},
{
"name": "Microsoft.CognitiveServices/accounts/delete",
"display": {
"provider": "Microsoft Cognitive Services",
"resource": "Cognitive Services API Account",
"operation": "Delete API Account",
"description": "Deletes API accounts"
},
"origin": "user,system"
}
]
}
}
}
}

Просмотреть файл

@ -0,0 +1,29 @@
{
"parameters": {
"subscriptionId": "{subscription-id}",
"resourceGroupName": "res6977",
"accountName": "sto2527",
"privateEndpointConnectionName": "{privateEndpointConnectionName}",
"api-version": "2022-10-01",
"monitor": "true"
},
"responses": {
"200": {
"body": {
"id": "/subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.CognitiveServices/accounts/sto288/privateEndpointConnections/{privateEndpointConnectionName}",
"name": "{privateEndpointConnectionName}",
"type": "Microsoft.CognitiveServices/accounts/privateEndpointConnections",
"properties": {
"privateEndpoint": {
"id": "/subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.Network/privateEndpoints/petest01"
},
"privateLinkServiceConnectionState": {
"status": "Approved",
"description": "Auto-Approved",
"actionsRequired": "None"
}
}
}
}
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,28 @@
{
"parameters": {
"api-version": "2022-10-01",
"subscriptionId": "5a4f5c2e-6983-4ccb-bd34-2196d5b5bbd3",
"resourceGroupName": "myResourceGroup",
"accountName": "TestUsage02"
},
"responses": {
"200": {
"body": {
"value": [
{
"name": {
"value": "Face.Transactions",
"localizedValue": "Face.Transactions"
},
"status": "Included",
"currentValue": 3,
"limit": 30000,
"nextResetTime": "2018-03-28T09:33:51Z",
"quotaPeriod": "30.00:00:00",
"unit": "Count"
}
]
}
}
}
}

Просмотреть файл

@ -0,0 +1,48 @@
{
"parameters": {
"api-version": "2022-10-01",
"subscriptionId": "subscriptionId",
"resourceGroupName": "resourceGroupName",
"location": "location",
"accountName": "accountName"
},
"responses": {
"200": {
"body": {
"value": [
{
"baseModel": {
"format": "OpenAI",
"name": "ada",
"version": "1"
},
"format": "OpenAI",
"name": "ada.1",
"version": "1",
"maxCapacity": 10,
"capabilities": {
"fineTune": "true"
},
"deprecation": {
"fineTune": "2024-01-01T00:00:00Z",
"inference": "2024-01-01T00:00:00Z"
}
},
{
"format": "OpenAI",
"name": "davinci",
"version": "1",
"maxCapacity": 10,
"capabilities": {
"fineTune": "true"
},
"deprecation": {
"fineTune": "2024-01-01T00:00:00Z",
"inference": "2024-01-01T00:00:00Z"
}
}
]
}
}
}
}

Просмотреть файл

@ -0,0 +1,50 @@
{
"parameters": {
"api-version": "2022-10-01",
"subscriptionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"resourceGroupName": "myResourceGroup"
},
"responses": {
"200": {
"body": {
"value": [
{
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.CognitiveServices/accounts/myAccount",
"name": "myAccount",
"type": "Microsoft.CognitiveServices/accounts",
"location": "westus",
"sku": {
"name": "F0"
},
"kind": "Emotion",
"tags": {
"Owner": "felixwa",
"ExpiredDate": "2017/09/01"
},
"etag": "W/\"datetime'2017-04-10T04%3A42%3A19.7067387Z'\"",
"properties": {
"endpoint": "https://westus.api.cognitive.microsoft.com/emotion/v1.0",
"provisioningState": "Succeeded"
}
},
{
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.CognitiveServices/accounts/TestPropertyWU2",
"name": "TestPropertyWU2",
"type": "Microsoft.CognitiveServices/accounts",
"location": "westus",
"sku": {
"name": "S0"
},
"kind": "Face",
"tags": {},
"etag": "W/\"datetime'2017-04-07T04%3A32%3A38.9187216Z'\"",
"properties": {
"endpoint": "https://westus.api.cognitive.microsoft.com/face/v1.0",
"provisioningState": "Succeeded"
}
}
]
}
}
}
}

Просмотреть файл

@ -0,0 +1,77 @@
{
"parameters": {
"api-version": "2022-10-01",
"subscriptionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
},
"responses": {
"200": {
"body": {
"value": [
{
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/bvttest/providers/Microsoft.CognitiveServices/accounts/bingSearch",
"name": "bingSearch",
"type": "Microsoft.CognitiveServices/accounts",
"location": "global",
"sku": {
"name": "S1"
},
"kind": "Bing.Search",
"etag": "W/\"datetime'2017-03-27T11%3A19%3A08.762494Z'\"",
"properties": {
"endpoint": "https://api.cognitive.microsoft.com/bing/v5.0",
"provisioningState": "Succeeded"
}
},
{
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/bvttest/providers/Microsoft.CognitiveServices/accounts/CrisProd",
"name": "CrisProd",
"type": "Microsoft.CognitiveServices/accounts",
"location": "westus",
"sku": {
"name": "S0"
},
"kind": "CRIS",
"tags": {
"can't delete it successfully": "v-yunjin"
},
"etag": "W/\"datetime'2017-03-31T08%3A57%3A07.4499566Z'\"",
"properties": {
"endpoint": "https://westus.api.cognitive.microsoft.com/sts/v1.0",
"provisioningState": "Succeeded"
}
},
{
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/bvttest/providers/Microsoft.CognitiveServices/accounts/rayrptest0308",
"name": "rayrptest0308",
"type": "Microsoft.CognitiveServices/accounts",
"location": "westus",
"sku": {
"name": "S0"
},
"kind": "Face",
"etag": "W/\"datetime'2017-03-27T11%3A15%3A23.5232645Z'\"",
"properties": {
"endpoint": "https://westus.api.cognitive.microsoft.com/face/v1.0",
"provisioningState": "Succeeded"
}
},
{
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/bvttest/providers/Microsoft.CognitiveServices/accounts/raytest02",
"name": "raytest02",
"type": "Microsoft.CognitiveServices/accounts",
"location": "westus",
"sku": {
"name": "S0"
},
"kind": "Emotion",
"etag": "W/\"datetime'2017-04-04T02%3A07%3A07.3957572Z'\"",
"properties": {
"endpoint": "https://westus.api.cognitive.microsoft.com/emotion/v1.0",
"provisioningState": "Succeeded"
}
}
]
}
}
}
}

Просмотреть файл

@ -0,0 +1,29 @@
{
"parameters": {
"api-version": "2022-10-01",
"subscriptionId": "subscriptionId",
"resourceGroupName": "resourceGroupName",
"accountName": "accountName"
},
"responses": {
"200": {
"body": {
"value": [
{
"id": "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/commitmentPlans/commitmentPlanName",
"name": "commitmentPlanName",
"type": "Microsoft.CognitiveServices/accounts/commitmentPlans",
"properties": {
"hostingModel": "Web",
"planType": "Speech2Text",
"autoRenew": true,
"current": {
"tier": "T1"
}
}
}
]
}
}
}
}

Просмотреть файл

@ -0,0 +1,28 @@
{
"parameters": {
"api-version": "2022-10-01",
"subscriptionId": "subscriptionId",
"resourceGroupName": "resourceGroupName",
"location": "location"
},
"responses": {
"200": {
"body": {
"value": [
{
"kind": "TextAnalytics",
"skuName": "S",
"hostingModel": "Web",
"planType": "TA",
"tier": "T1",
"quota": {
"quantity": 1000000,
"unit": "Transaction"
},
"cost": {}
}
]
}
}
}
}

Просмотреть файл

@ -0,0 +1,77 @@
{
"parameters": {
"api-version": "2022-10-01",
"subscriptionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
},
"responses": {
"200": {
"body": {
"value": [
{
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/bvttest/providers/Microsoft.CognitiveServices/accounts/bingSearch",
"name": "bingSearch",
"type": "Microsoft.CognitiveServices/accounts",
"location": "global",
"sku": {
"name": "S1"
},
"kind": "Bing.Search",
"etag": "W/\"datetime'2017-03-27T11%3A19%3A08.762494Z'\"",
"properties": {
"endpoint": "https://api.cognitive.microsoft.com/bing/v5.0",
"provisioningState": "Succeeded"
}
},
{
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/bvttest/providers/Microsoft.CognitiveServices/accounts/CrisProd",
"name": "CrisProd",
"type": "Microsoft.CognitiveServices/accounts",
"location": "westus",
"sku": {
"name": "S0"
},
"kind": "CRIS",
"tags": {
"can't delete it successfully": "v-yunjin"
},
"etag": "W/\"datetime'2017-03-31T08%3A57%3A07.4499566Z'\"",
"properties": {
"endpoint": "https://westus.api.cognitive.microsoft.com/sts/v1.0",
"provisioningState": "Succeeded"
}
},
{
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/bvttest/providers/Microsoft.CognitiveServices/accounts/rayrptest0308",
"name": "rayrptest0308",
"type": "Microsoft.CognitiveServices/accounts",
"location": "westus",
"sku": {
"name": "S0"
},
"kind": "Face",
"etag": "W/\"datetime'2017-03-27T11%3A15%3A23.5232645Z'\"",
"properties": {
"endpoint": "https://westus.api.cognitive.microsoft.com/face/v1.0",
"provisioningState": "Succeeded"
}
},
{
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/bvttest/providers/Microsoft.CognitiveServices/accounts/raytest02",
"name": "raytest02",
"type": "Microsoft.CognitiveServices/accounts",
"location": "westus",
"sku": {
"name": "S0"
},
"kind": "Emotion",
"etag": "W/\"datetime'2017-04-04T02%3A07%3A07.3957572Z'\"",
"properties": {
"endpoint": "https://westus.api.cognitive.microsoft.com/emotion/v1.0",
"provisioningState": "Succeeded"
}
}
]
}
}
}
}

Просмотреть файл

@ -0,0 +1,33 @@
{
"parameters": {
"api-version": "2022-10-01",
"subscriptionId": "subscriptionId",
"resourceGroupName": "resourceGroupName",
"accountName": "accountName"
},
"responses": {
"200": {
"body": {
"value": [
{
"id": "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/deployments/deploymentName",
"name": "deploymentName",
"type": "Microsoft.CognitiveServices/accounts/deployments",
"properties": {
"model": {
"format": "OpenAI",
"name": "ada",
"version": "1"
},
"scaleSettings": {
"scaleType": "Manual",
"capacity": 1
},
"provisioningState": "Succeeded"
}
}
]
}
}
}
}

Просмотреть файл

@ -0,0 +1,16 @@
{
"parameters": {
"api-version": "2022-10-01",
"subscriptionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"resourceGroupName": "myResourceGroup",
"accountName": "myAccount"
},
"responses": {
"200": {
"body": {
"key1": "KEY1",
"key2": "KEY2"
}
}
}
}

Просмотреть файл

@ -0,0 +1,31 @@
{
"parameters": {
"subscriptionId": "{subscription-id}",
"resourceGroupName": "res6977",
"accountName": "sto2527",
"api-version": "2022-10-01"
},
"responses": {
"200": {
"body": {
"value": [
{
"id": "/subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.CognitiveServices/accounts/sto288/privateEndpointConnections/{privateEndpointConnectionName}",
"name": "{privateEndpointConnectionName}",
"type": "Microsoft.CognitiveServices/accounts/privateEndpointConnections",
"properties": {
"privateEndpoint": {
"id": "/subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.Network/privateEndpoints/petest01"
},
"privateLinkServiceConnectionState": {
"status": "Approved",
"description": "Auto-Approved",
"actionsRequired": "None"
}
}
}
]
}
}
}
}

Просмотреть файл

@ -0,0 +1,30 @@
{
"parameters": {
"subscriptionId": "{subscription-id}",
"resourceGroupName": "res6977",
"accountName": "sto2527",
"api-version": "2022-10-01"
},
"responses": {
"200": {
"body": {
"value": [
{
"id": "/subscriptions/{subscription-id}/resourceGroups/res6977/providers/Microsoft.CognitiveServices/accounts/sto2527/privateLinkResources/account",
"name": "blob",
"type": "Microsoft.CognitiveServices/accounts/privateLinkResources",
"properties": {
"groupId": "account",
"requiredMembers": [
"default"
],
"requiredZoneNames": [
"privatelink.cognitiveservices.azure.com"
]
}
}
]
}
}
}
}

Просмотреть файл

@ -0,0 +1,30 @@
{
"parameters": {
"api-version": "2022-10-01",
"subscriptionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"resourceGroupName": "myResourceGroup",
"accountName": "myAccount"
},
"responses": {
"200": {
"body": {
"value": [
{
"resourceType": "Microsoft.CognitiveServices/accounts",
"sku": {
"name": "F0",
"tier": "Free"
}
},
{
"resourceType": "Microsoft.CognitiveServices/accounts",
"sku": {
"name": "S0",
"tier": "Standard"
}
}
]
}
}
}
}

Просмотреть файл

@ -0,0 +1,14 @@
{
"parameters": {
"api-version": "2022-10-01",
"subscriptionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"resourceGroupName": "myResourceGroup",
"accountName": "PropTest01",
"location": "westus"
},
"responses": {
"200": {},
"202": {},
"204": {}
}
}

Просмотреть файл

@ -0,0 +1,51 @@
{
"parameters": {
"api-version": "2022-10-01",
"subscriptionId": "subscriptionId",
"resourceGroupName": "resourceGroupName",
"accountName": "accountName",
"commitmentPlanName": "commitmentPlanName",
"commitmentPlan": {
"properties": {
"hostingModel": "Web",
"planType": "Speech2Text",
"autoRenew": true,
"current": {
"tier": "T1"
}
}
}
},
"responses": {
"200": {
"body": {
"id": "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/commitmentPlans/commitmentPlanName",
"name": "commitmentPlanName",
"type": "Microsoft.CognitiveServices/accounts/commitmentPlans",
"properties": {
"hostingModel": "Web",
"planType": "Speech2Text",
"autoRenew": true,
"current": {
"tier": "T1"
}
}
}
},
"201": {
"body": {
"id": "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/commitmentPlans/commitmentPlanName",
"name": "commitmentPlanName",
"type": "Microsoft.CognitiveServices/accounts/commitmentPlans",
"properties": {
"hostingModel": "Web",
"planType": "Speech2Text",
"autoRenew": true,
"current": {
"tier": "T1"
}
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,62 @@
{
"parameters": {
"api-version": "2022-10-01",
"subscriptionId": "subscriptionId",
"resourceGroupName": "resourceGroupName",
"accountName": "accountName",
"deploymentName": "deploymentName",
"deployment": {
"properties": {
"model": {
"format": "OpenAI",
"name": "ada",
"version": "1"
},
"scaleSettings": {
"scaleType": "Manual",
"capacity": 1
}
}
}
},
"responses": {
"200": {
"body": {
"id": "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/deployments/deploymentName",
"name": "deploymentName",
"type": "Microsoft.CognitiveServices/accounts/deployments",
"properties": {
"model": {
"format": "OpenAI",
"name": "ada",
"version": "1"
},
"scaleSettings": {
"scaleType": "Manual",
"capacity": 1
},
"provisioningState": "Succeeded"
}
}
},
"201": {
"body": {
"id": "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/deployments/deploymentName",
"name": "deploymentName",
"type": "Microsoft.CognitiveServices/accounts/deployments",
"properties": {
"model": {
"format": "OpenAI",
"name": "ada",
"version": "1"
},
"scaleSettings": {
"scaleType": "Manual",
"capacity": 1
},
"provisioningState": "Accepted"
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,54 @@
{
"parameters": {
"subscriptionId": "{subscription-id}",
"resourceGroupName": "res7687",
"accountName": "sto9699",
"privateEndpointConnectionName": "{privateEndpointConnectionName}",
"api-version": "2022-10-01",
"monitor": "true",
"properties": {
"properties": {
"privateLinkServiceConnectionState": {
"status": "Approved",
"description": "Auto-Approved"
}
}
}
},
"responses": {
"200": {
"body": {
"id": "/subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.CognitiveServices/accounts/sto288/privateEndpointConnections/{privateEndpointConnectionName}",
"name": "{privateEndpointConnectionName}",
"type": "Microsoft.CognitiveServices/accounts/privateEndpointConnections",
"properties": {
"privateEndpoint": {
"id": "/subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.Network/privateEndpoints/petest01"
},
"privateLinkServiceConnectionState": {
"status": "Approved",
"description": "Auto-Approved",
"actionsRequired": "None"
}
}
}
},
"202": {
"body": {
"id": "/subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.CognitiveServices/accounts/sto288/privateEndpointConnections/{privateEndpointConnectionName}",
"name": "{privateEndpointConnectionName}",
"type": "Microsoft.CognitiveServices/accounts/privateEndpointConnections",
"properties": {
"privateEndpoint": {
"id": "/subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.Network/privateEndpoints/petest01"
},
"privateLinkServiceConnectionState": {
"status": "Approved",
"description": "Auto-Approved",
"actionsRequired": "None"
}
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,19 @@
{
"parameters": {
"api-version": "2022-10-01",
"subscriptionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"resourceGroupName": "myResourceGroup",
"accountName": "myAccount",
"parameters": {
"keyName": "Key2"
}
},
"responses": {
"200": {
"body": {
"key1": "KEY1",
"key2": "KEY2"
}
}
}
}

Просмотреть файл

@ -0,0 +1,58 @@
{
"parameters": {
"api-version": "2022-10-01",
"subscriptionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"resourceGroupName": "bvttest",
"accountName": "bingSearch",
"account": {
"location": "global",
"sku": {
"name": "S2"
}
}
},
"responses": {
"200": {
"headers": {
"Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CognitiveServices/locations/global/operationResults/00000000-0000-0000-0000-000000000000?api-version=2022-10-01",
"azure-AsyncOperation": "http://azure.async.operation/status"
},
"body": {
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/bvttest/providers/Microsoft.CognitiveServices/accounts/bingSearch",
"name": "bingSearch",
"type": "Microsoft.CognitiveServices/accounts",
"location": "global",
"sku": {
"name": "S2"
},
"kind": "Bing.Search",
"etag": "W/\"datetime'2017-04-10T07%3A46%3A21.5618831Z'\"",
"properties": {
"endpoint": "https://api.cognitive.microsoft.com/bing/v5.0",
"provisioningState": "Succeeded"
}
}
},
"202": {
"headers": {
"Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CognitiveServices/locations/global/operationResults/00000000-0000-0000-0000-000000000000?api-version=2022-10-01",
"azure-AsyncOperation": "http://azure.async.operation/status"
},
"body": {
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/bvttest/providers/Microsoft.CognitiveServices/accounts/bingSearch",
"name": "bingSearch",
"type": "Microsoft.CognitiveServices/accounts",
"location": "global",
"sku": {
"name": "S2"
},
"kind": "Bing.Search",
"etag": "W/\"datetime'2017-04-10T07%3A46%3A21.5618831Z'\"",
"properties": {
"endpoint": "https://api.cognitive.microsoft.com/bing/v5.0",
"provisioningState": "Succeeded"
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,182 @@
{
"swagger": "2.0",
"info": {
"version": "2.0",
"title": "Common types"
},
"paths": {},
"definitions": {
"PrivateEndpoint": {
"type": "object",
"properties": {
"id": {
"readOnly": true,
"type": "string",
"description": "The ARM identifier for Private Endpoint"
}
},
"description": "The Private Endpoint resource."
},
"PrivateEndpointConnection": {
"type": "object",
"properties": {
"properties": {
"$ref": "#/definitions/PrivateEndpointConnectionProperties",
"x-ms-client-flatten": true,
"description": "Resource properties."
}
},
"allOf": [
{
"$ref": "./types.json#/definitions/Resource"
}
],
"description": "The Private Endpoint Connection resource."
},
"PrivateEndpointConnectionProperties": {
"type": "object",
"properties": {
"privateEndpoint": {
"$ref": "#/definitions/PrivateEndpoint",
"description": "The resource of private end point."
},
"privateLinkServiceConnectionState": {
"$ref": "#/definitions/PrivateLinkServiceConnectionState",
"description": "A collection of information about the state of the connection between service consumer and provider."
},
"provisioningState": {
"$ref": "#/definitions/PrivateEndpointConnectionProvisioningState",
"description": "The provisioning state of the private endpoint connection resource."
}
},
"required": [
"privateLinkServiceConnectionState"
],
"description": "Properties of the PrivateEndpointConnectProperties."
},
"PrivateLinkServiceConnectionState": {
"type": "object",
"properties": {
"status": {
"$ref": "#/definitions/PrivateEndpointServiceConnectionStatus",
"description": "Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service."
},
"description": {
"type": "string",
"description": "The reason for approval/rejection of the connection."
},
"actionsRequired": {
"type": "string",
"description": "A message indicating if changes on the service provider require any updates on the consumer."
}
},
"description": "A collection of information about the state of the connection between service consumer and provider."
},
"PrivateEndpointServiceConnectionStatus": {
"type": "string",
"description": "The private endpoint connection status.",
"enum": [
"Pending",
"Approved",
"Rejected"
],
"x-ms-enum": {
"name": "PrivateEndpointServiceConnectionStatus",
"modelAsString": true
}
},
"PrivateEndpointConnectionProvisioningState": {
"type": "string",
"readOnly": true,
"description": "The current provisioning state.",
"enum": [
"Succeeded",
"Creating",
"Deleting",
"Failed"
],
"x-ms-enum": {
"name": "PrivateEndpointConnectionProvisioningState",
"modelAsString": true
}
},
"PrivateLinkResource": {
"type": "object",
"properties": {
"properties": {
"$ref": "#/definitions/PrivateLinkResourceProperties",
"description": "Resource properties.",
"x-ms-client-flatten": true
}
},
"allOf": [
{
"$ref": "./types.json#/definitions/Resource"
}
],
"description": "A private link resource"
},
"PrivateLinkResourceProperties": {
"type": "object",
"properties": {
"groupId": {
"description": "The private link resource group id.",
"type": "string",
"readOnly": true
},
"requiredMembers": {
"description": "The private link resource required member names.",
"type": "array",
"items": {
"type": "string"
},
"readOnly": true
},
"requiredZoneNames": {
"type": "array",
"items": {
"type": "string"
},
"description": "The private link resource Private link DNS zone name."
}
},
"description": "Properties of a private link resource."
},
"PrivateEndpointConnectionListResult": {
"type": "object",
"properties": {
"value": {
"type": "array",
"description": "Array of private endpoint connections",
"items": {
"$ref": "#/definitions/PrivateEndpointConnection"
}
}
},
"description": "List of private endpoint connection associated with the specified storage account"
},
"PrivateLinkResourceListResult": {
"type": "object",
"properties": {
"value": {
"type": "array",
"description": "Array of private link resources",
"items": {
"$ref": "#/definitions/PrivateLinkResource"
}
}
},
"description": "A list of private link resources"
}
},
"parameters": {
"PrivateEndpointConnectionName": {
"name": "privateEndpointConnectionName",
"in": "path",
"required": true,
"type": "string",
"description": "The name of the private endpoint connection associated with the Azure resource",
"x-ms-parameter-location": "method"
}
}
}

Просмотреть файл

@ -0,0 +1,694 @@
{
"swagger": "2.0",
"info": {
"version": "2.0",
"title": "Common types"
},
"paths": {},
"definitions": {
"Resource": {
"title": "Resource",
"description": "Common fields that are returned in the response for all Azure Resource Manager resources",
"type": "object",
"properties": {
"id": {
"readOnly": true,
"type": "string",
"description": "Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"
},
"name": {
"readOnly": true,
"type": "string",
"description": "The name of the resource"
},
"type": {
"readOnly": true,
"type": "string",
"description": "The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or \"Microsoft.Storage/storageAccounts\""
}
},
"x-ms-azure-resource": true
},
"AzureEntityResource": {
"x-ms-client-name": "AzureEntityResource",
"title": "Entity Resource",
"description": "The resource model definition for an Azure Resource Manager resource with an etag.",
"type": "object",
"properties": {
"etag": {
"type": "string",
"readOnly": true,
"description": "Resource Etag."
}
},
"allOf": [
{
"$ref": "#/definitions/Resource"
}
]
},
"TrackedResource": {
"title": "Tracked Resource",
"description": "The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'",
"type": "object",
"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 geo-location where the resource lives"
}
},
"required": [
"location"
],
"allOf": [
{
"$ref": "#/definitions/Resource"
}
]
},
"ProxyResource": {
"title": "Proxy Resource",
"description": "The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location",
"type": "object",
"allOf": [
{
"$ref": "#/definitions/Resource"
}
]
},
"ResourceModelWithAllowedPropertySet": {
"description": "The resource model definition containing the full set of allowed properties for a resource. Except properties bag, there cannot be a top level property outside of this set.",
"type": "object",
"properties": {
"id": {
"readOnly": true,
"type": "string",
"x-ms-mutability": [
"read"
],
"description": "Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"
},
"name": {
"readOnly": true,
"type": "string",
"description": "The name of the resource"
},
"type": {
"readOnly": true,
"type": "string",
"x-ms-mutability": [
"read"
],
"description": "The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or \"Microsoft.Storage/storageAccounts\""
},
"location": {
"type": "string",
"x-ms-mutability": [
"read",
"create"
],
"description": "The geo-location where the resource lives"
},
"managedBy": {
"type": "string",
"x-ms-mutability": [
"read",
"create",
"update"
],
"description": "The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource."
},
"kind": {
"type": "string",
"x-ms-mutability": [
"read",
"create"
],
"description": "Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value.",
"pattern": "^[-\\w\\._,\\(\\)]+$"
},
"etag": {
"readOnly": true,
"type": "string",
"description": "The etag field is *not* required. If it is provided in the response body, it must 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. "
},
"tags": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"x-ms-mutability": [
"read",
"create",
"update"
],
"description": "Resource tags."
},
"identity": {
"allOf": [
{
"$ref": "#/definitions/Identity"
}
]
},
"sku": {
"allOf": [
{
"$ref": "#/definitions/Sku"
}
]
},
"plan": {
"allOf": [
{
"$ref": "#/definitions/Plan"
}
]
}
},
"x-ms-azure-resource": true
},
"Sku": {
"description": "The resource model definition representing SKU",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The name of the SKU. Ex - P3. It is typically a letter+number code"
},
"tier": {
"type": "string",
"enum": [
"Free",
"Basic",
"Standard",
"Premium"
],
"x-ms-enum": {
"name": "SkuTier",
"modelAsString": false
},
"description": "This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT."
},
"size": {
"type": "string",
"description": "The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. "
},
"family": {
"type": "string",
"description": "If the service has different generations of hardware, for the same SKU, then that can be captured here."
},
"capacity": {
"type": "integer",
"format": "int32",
"description": "If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted."
}
},
"required": [
"name"
]
},
"Identity": {
"description": "Identity for the resource.",
"type": "object",
"properties": {
"principalId": {
"readOnly": true,
"type": "string",
"description": "The principal ID of resource identity."
},
"tenantId": {
"readOnly": true,
"type": "string",
"description": "The tenant ID of resource."
},
"type": {
"type": "string",
"description": "The identity type.",
"enum": [
"SystemAssigned"
],
"x-ms-enum": {
"name": "ResourceIdentityType",
"modelAsString": false
}
}
}
},
"Plan": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "A user defined name of the 3rd Party Artifact that is being procured."
},
"publisher": {
"type": "string",
"description": "The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic"
},
"product": {
"type": "string",
"description": "The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. "
},
"promotionCode": {
"type": "string",
"description": "A publisher provided promotion code as provisioned in Data Market for the said product/artifact."
},
"version": {
"type": "string",
"description": "The version of the desired product/artifact."
}
},
"description": "Plan for the resource.",
"required": [
"name",
"publisher",
"product"
]
},
"ErrorDetail": {
"description": "The error detail.",
"type": "object",
"properties": {
"code": {
"readOnly": true,
"type": "string",
"description": "The error code."
},
"message": {
"readOnly": true,
"type": "string",
"description": "The error message."
},
"target": {
"readOnly": true,
"type": "string",
"description": "The error target."
},
"details": {
"readOnly": true,
"type": "array",
"items": {
"$ref": "#/definitions/ErrorDetail"
},
"x-ms-identifiers": [
"message",
"target"
],
"description": "The error details."
},
"additionalInfo": {
"readOnly": true,
"type": "array",
"items": {
"$ref": "#/definitions/ErrorAdditionalInfo"
},
"x-ms-identifiers": [],
"description": "The error additional info."
}
}
},
"ErrorResponse": {
"title": "Error response",
"description": "Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.).",
"type": "object",
"properties": {
"error": {
"description": "The error object.",
"$ref": "#/definitions/ErrorDetail"
}
}
},
"ErrorAdditionalInfo": {
"type": "object",
"properties": {
"type": {
"readOnly": true,
"type": "string",
"description": "The additional info type."
},
"info": {
"readOnly": true,
"type": "object",
"description": "The additional info."
}
},
"description": "The resource management error additional info."
},
"Operation": {
"title": "REST API Operation",
"description": "Details of a REST API operation, returned from the Resource Provider Operations API",
"type": "object",
"properties": {
"name": {
"description": "The name of the operation, as per Resource-Based Access Control (RBAC). Examples: \"Microsoft.Compute/virtualMachines/write\", \"Microsoft.Compute/virtualMachines/capture/action\"",
"type": "string",
"readOnly": true
},
"isDataAction": {
"description": "Whether the operation applies to data-plane. This is \"true\" for data-plane operations and \"false\" for ARM/control-plane operations.",
"type": "boolean",
"readOnly": true
},
"display": {
"description": "Localized display information for this particular operation.",
"type": "object",
"properties": {
"provider": {
"description": "The localized friendly form of the resource provider name, e.g. \"Microsoft Monitoring Insights\" or \"Microsoft Compute\".",
"type": "string",
"readOnly": true
},
"resource": {
"description": "The localized friendly name of the resource type related to this operation. E.g. \"Virtual Machines\" or \"Job Schedule Collections\".",
"type": "string",
"readOnly": true
},
"operation": {
"description": "The concise, localized friendly name for the operation; suitable for dropdowns. E.g. \"Create or Update Virtual Machine\", \"Restart Virtual Machine\".",
"type": "string",
"readOnly": true
},
"description": {
"description": "The short, localized friendly description of the operation; suitable for tool tips and detailed views.",
"type": "string",
"readOnly": true
}
}
},
"origin": {
"description": "The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is \"user,system\"",
"type": "string",
"readOnly": true,
"enum": [
"user",
"system",
"user,system"
],
"x-ms-enum": {
"name": "Origin",
"modelAsString": true
}
},
"actionType": {
"description": "Enum. Indicates the action type. \"Internal\" refers to actions that are for internal only APIs.",
"type": "string",
"readOnly": true,
"enum": [
"Internal"
],
"x-ms-enum": {
"name": "ActionType",
"modelAsString": true
}
}
}
},
"OperationListResult": {
"description": "A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results.",
"type": "object",
"properties": {
"value": {
"type": "array",
"items": {
"$ref": "#/definitions/Operation"
},
"x-ms-identifiers": [
"name"
],
"description": "List of operations supported by the resource provider",
"readOnly": true
},
"nextLink": {
"type": "string",
"description": "URL to get the next set of operation list results (if there are any).",
"readOnly": true
}
}
},
"OperationStatusResult": {
"description": "The current status of an async operation.",
"type": "object",
"required": [
"status"
],
"properties": {
"id": {
"description": "Fully qualified ID for the async operation.",
"type": "string"
},
"name": {
"description": "Name of the async operation.",
"type": "string"
},
"status": {
"description": "Operation status.",
"type": "string"
},
"percentComplete": {
"description": "Percent of the operation that is complete.",
"type": "number",
"minimum": 0,
"maximum": 100
},
"startTime": {
"description": "The start time of the operation.",
"type": "string",
"format": "date-time"
},
"endTime": {
"description": "The end time of the operation.",
"type": "string",
"format": "date-time"
},
"operations": {
"description": "The operations list.",
"type": "array",
"items": {
"$ref": "#/definitions/OperationStatusResult"
}
},
"error": {
"description": "If present, details of the operation error.",
"$ref": "#/definitions/ErrorDetail"
}
}
},
"locationData": {
"description": "Metadata pertaining to the geographic location of the resource.",
"type": "object",
"properties": {
"name": {
"type": "string",
"maxLength": 256,
"description": "A canonical name for the geographic or physical location."
},
"city": {
"type": "string",
"description": "The city or locality where the resource is located."
},
"district": {
"type": "string",
"description": "The district, state, or province where the resource is located."
},
"countryOrRegion": {
"type": "string",
"description": "The country or region where the resource is located"
}
},
"required": [
"name"
]
},
"systemData": {
"description": "Metadata pertaining to creation and last modification of the resource.",
"type": "object",
"readOnly": true,
"properties": {
"createdBy": {
"type": "string",
"description": "The identity that created the resource."
},
"createdByType": {
"type": "string",
"description": "The type of identity that created the resource.",
"enum": [
"User",
"Application",
"ManagedIdentity",
"Key"
],
"x-ms-enum": {
"name": "createdByType",
"modelAsString": true
}
},
"createdAt": {
"type": "string",
"format": "date-time",
"description": "The timestamp of resource creation (UTC)."
},
"lastModifiedBy": {
"type": "string",
"description": "The identity that last modified the resource."
},
"lastModifiedByType": {
"type": "string",
"description": "The type of identity that last modified the resource.",
"enum": [
"User",
"Application",
"ManagedIdentity",
"Key"
],
"x-ms-enum": {
"name": "createdByType",
"modelAsString": true
}
},
"lastModifiedAt": {
"type": "string",
"format": "date-time",
"description": "The timestamp of resource last modification (UTC)"
}
}
},
"encryptionProperties": {
"description": "Configuration of key for data encryption",
"type": "object",
"properties": {
"status": {
"description": "Indicates whether or not the encryption is enabled for container registry.",
"enum": [
"enabled",
"disabled"
],
"type": "string",
"x-ms-enum": {
"name": "EncryptionStatus",
"modelAsString": true
}
},
"keyVaultProperties": {
"$ref": "#/definitions/KeyVaultProperties",
"description": "Key vault properties."
}
}
},
"KeyVaultProperties": {
"type": "object",
"properties": {
"keyIdentifier": {
"description": "Key vault uri to access the encryption key.",
"type": "string"
},
"identity": {
"description": "The client ID of the identity which will be used to access key vault.",
"type": "string"
}
}
},
"CheckNameAvailabilityRequest": {
"description": "The check availability request body.",
"type": "object",
"properties": {
"name": {
"description": "The name of the resource for which availability needs to be checked.",
"type": "string"
},
"type": {
"description": "The resource type.",
"type": "string"
}
}
},
"CheckNameAvailabilityResponse": {
"description": "The check availability result.",
"type": "object",
"properties": {
"nameAvailable": {
"description": "Indicates if the resource name is available.",
"type": "boolean"
},
"reason": {
"description": "The reason why the given name is not available.",
"type": "string",
"enum": [
"Invalid",
"AlreadyExists"
],
"x-ms-enum": {
"name": "CheckNameAvailabilityReason",
"modelAsString": true
}
},
"message": {
"description": "Detailed reason why the given name is available.",
"type": "string"
}
}
}
},
"parameters": {
"SubscriptionIdParameter": {
"name": "subscriptionId",
"in": "path",
"required": true,
"type": "string",
"description": "The ID of the target subscription.",
"minLength": 1
},
"ApiVersionParameter": {
"name": "api-version",
"in": "query",
"required": true,
"type": "string",
"description": "The API version to use for this operation.",
"minLength": 1
},
"ResourceGroupNameParameter": {
"name": "resourceGroupName",
"in": "path",
"required": true,
"type": "string",
"description": "The name of the resource group. The name is case insensitive.",
"minLength": 1,
"maxLength": 90,
"x-ms-parameter-location": "method"
},
"OperationIdParameter": {
"name": "operationId",
"in": "path",
"required": true,
"type": "string",
"description": "The ID of an ongoing async operation.",
"minLength": 1,
"x-ms-parameter-location": "method"
},
"LocationParameter": {
"name": "location",
"in": "path",
"required": true,
"type": "string",
"description": "The name of Azure region.",
"minLength": 1,
"x-ms-parameter-location": "method"
}
}
}

Просмотреть файл

@ -855,7 +855,7 @@ describe("Model Validation", () => {
it("should fail when value is not in base64 format", async () => {
const specPath2 = `${testPath}/modelValidation/swaggers/specification/formatValidation/format.json`;
const result = await validate.validateExamples(specPath2, "Byte");
console.log(result)
console.log(result);
assert.strictEqual(result.length, 3);
assert.strictEqual(result[0].code, "INVALID_FORMAT");
assert.strictEqual(
@ -863,10 +863,7 @@ describe("Model Validation", () => {
"Object didn't pass validation for format byte: space is not a valid base64 character"
);
assert.strictEqual(result[1].code, "INVALID_FORMAT");
assert.strictEqual(
result[1].message,
"Object didn't pass validation for format byte: ----"
);
assert.strictEqual(result[1].message, "Object didn't pass validation for format byte: ----");
assert.strictEqual(result[2].code, "INVALID_FORMAT");
assert.strictEqual(
result[2].message,
@ -895,11 +892,11 @@ describe("Model Validation", () => {
assert.strictEqual(result[0].exampleJsonPath, "$responses.200.body.result1['id']");
});
it("should validate mutable readonly properties without erroring", async() => {
const specPath = `${testPath}/modelValidation/swaggers/specification/readonlyNotRequired/openapi.json`;
const result = await validate.validateExamples(specPath, "Widgets_Create");
it("should validate mutable readonly properties without erroring", async () => {
const specPath = `${testPath}/modelValidation/swaggers/specification/readonlyNotRequired/openapi.json`;
const result = await validate.validateExamples(specPath, "Widgets_Create");
assert.strictEqual(result.length, 0);
assert.strictEqual(result.length, 0);
});
});
});

Просмотреть файл

@ -1,8 +1,7 @@
import * as assert from "assert";
import * as path from "path";
import { DefaultConfig } from "../lib/util/constants";
import { RequestResponsePair } from "../lib/liveValidation/liveValidator";
import { LiveValidator } from "../lib/liveValidation/liveValidator";
import { RequestResponsePair, LiveValidator } from "../lib/liveValidation/liveValidator";
// eslint-disable-next-line no-var
var glob = require("glob").glob;
@ -13,7 +12,8 @@ describe("Live Validator", () => {
describe("Initialization", () => {
it("OperationLoader should be completely initialized", async () => {
console.log("OperationLoader should be completely initialized");
const swaggerPattern = "specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/runCommands.json";
const swaggerPattern =
"specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/runCommands.json";
const glob = require("glob");
const filePaths: string[] = glob.sync(swaggerPattern, {
ignore: DefaultConfig.ExcludedExamplesAndCommonFiles,
@ -22,11 +22,11 @@ describe("Live Validator", () => {
const options = {
directory: "./test/liveValidation/swaggers/specification",
swaggerPathsPattern: [
"compute/resource-manager/Microsoft.Compute/stable/2021-11-01/runCommands.json"
"compute/resource-manager/Microsoft.Compute/stable/2021-11-01/runCommands.json",
],
swaggerPaths: filePaths,
enableRoundTripValidator: true,
excludedSwaggerPathsPattern: []
excludedSwaggerPathsPattern: [],
};
const validator = new LiveValidator(options);
await validator.initialize();
@ -44,12 +44,10 @@ describe("Live Validator", () => {
});
const options = {
directory: "./test/liveValidation/swaggers/specification",
swaggerPathsPattern: [
"**/*.json"
],
swaggerPathsPattern: ["**/*.json"],
swaggerPaths: filePaths,
enableRoundTripValidator: true,
excludedSwaggerPathsPattern: []
excludedSwaggerPathsPattern: [],
};
const validator = new LiveValidator(options);
await validator.initialize();
@ -59,7 +57,8 @@ describe("Live Validator", () => {
it("readonly properties should not cause error", async () => {
console.log("readonly properties should not cause error");
const swaggerPattern = "specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/*.json";
const swaggerPattern =
"specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/*.json";
const glob = require("glob");
const filePaths: string[] = glob.sync(swaggerPattern, {
ignore: DefaultConfig.ExcludedExamplesAndCommonFiles,
@ -68,11 +67,11 @@ describe("Live Validator", () => {
const options = {
directory: "./test/liveValidation/swaggers/specification",
swaggerPathsPattern: [
"compute/resource-manager/Microsoft.Compute/stable/2021-11-01/*.json"
"compute/resource-manager/Microsoft.Compute/stable/2021-11-01/*.json",
],
swaggerPaths: filePaths,
enableRoundTripValidator: true,
excludedSwaggerPathsPattern: []
excludedSwaggerPathsPattern: [],
};
const validator = new LiveValidator(options);
await validator.initialize();
@ -88,7 +87,8 @@ describe("Live Validator", () => {
it("Round trip validation fail", async () => {
console.log("Round trip validation fail");
const swaggerPattern = "specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/*.json";
const swaggerPattern =
"specification/compute/resource-manager/Microsoft.Compute/stable/2021-11-01/*.json";
const glob = require("glob");
const filePaths: string[] = glob.sync(swaggerPattern, {
ignore: DefaultConfig.ExcludedExamplesAndCommonFiles,
@ -97,11 +97,11 @@ describe("Live Validator", () => {
const options = {
directory: "./test/liveValidation/swaggers/specification",
swaggerPathsPattern: [
"compute/resource-manager/Microsoft.Compute/stable/2021-11-01/*.json"
"compute/resource-manager/Microsoft.Compute/stable/2021-11-01/*.json",
],
swaggerPaths: filePaths,
enableRoundTripValidator: true,
excludedSwaggerPathsPattern: []
excludedSwaggerPathsPattern: [],
};
const validator = new LiveValidator(options);
await validator.initialize();
@ -130,7 +130,8 @@ describe("Live Validator", () => {
it("Round trip validation of circular spec", async () => {
console.log("Round trip validation fail");
const swaggerPattern = "specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2019-08-01/*.json";
const swaggerPattern =
"specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2019-08-01/*.json";
const glob = require("glob");
const filePaths: string[] = glob.sync(swaggerPattern, {
ignore: DefaultConfig.ExcludedExamplesAndCommonFiles,
@ -139,11 +140,11 @@ describe("Live Validator", () => {
const options = {
directory: "./test/liveValidation/swaggers/specification",
swaggerPathsPattern: [
"containerservice/resource-manager/Microsoft.ContainerService/stable/2019-08-01/*.json"
"containerservice/resource-manager/Microsoft.ContainerService/stable/2019-08-01/*.json",
],
swaggerPaths: filePaths,
enableRoundTripValidator: true,
excludedSwaggerPathsPattern: []
excludedSwaggerPathsPattern: [],
};
const validator = new LiveValidator(options);
await validator.initialize();
@ -167,7 +168,8 @@ describe("Live Validator", () => {
it("Round trip validation of circular spec cognitiveService", async () => {
console.log("Round trip validation fail");
const swaggerPattern = "specification/cognitiveservices/data-plane/Language/preview/2022-10-01-preview/*.json";
const swaggerPattern =
"specification/cognitiveservices/data-plane/Language/preview/2022-10-01-preview/*.json";
const glob = require("glob");
const filePaths: string[] = glob.sync(swaggerPattern, {
ignore: DefaultConfig.ExcludedExamplesAndCommonFiles,
@ -176,11 +178,11 @@ describe("Live Validator", () => {
const options = {
directory: "./test/liveValidation/swaggers/specification",
swaggerPathsPattern: [
"cognitiveservices/data-plane/Language/preview/2022-10-01-preview/*.json"
"cognitiveservices/data-plane/Language/preview/2022-10-01-preview/*.json",
],
swaggerPaths: filePaths,
enableRoundTripValidator: true,
excludedSwaggerPathsPattern: []
excludedSwaggerPathsPattern: [],
};
const validator = new LiveValidator(options);
await validator.initialize();
@ -201,7 +203,6 @@ describe("Live Validator", () => {
}
//end of roundtrip validation
});
});
describe("Initialize cache and validate", () => {
@ -213,7 +214,7 @@ describe("Live Validator", () => {
const options = {
directory: "./test/liveValidation/swaggers/specification/storage",
swaggerPathsPattern: ["**/*.json"],
enableRoundTripValidator: true
enableRoundTripValidator: true,
};
const validator = new LiveValidator(options);
await validator.initialize();
@ -228,7 +229,7 @@ describe("Live Validator", () => {
const options = {
directory: "./test/liveValidation/swaggers/specification/defaultIsErrorOnly",
swaggerPathsPattern: ["test.json"],
enableRoundTripValidator: true
enableRoundTripValidator: true,
};
const validator = new LiveValidator(options);
await validator.initialize();
@ -263,7 +264,7 @@ describe("Live Validator", () => {
directory:
"./test/liveValidation/swaggers/specification/storage/resource-manager/Microsoft.Storage/2015-05-01-preview",
swaggerPathsPattern: ["*.json"],
enableRoundTripValidator: true
enableRoundTripValidator: true,
};
// Upper and lowercased provider and api-version strings for testing purpose
const adjustedUrl =
@ -319,7 +320,7 @@ describe("Live Validator", () => {
swaggerPathsPattern: [
"specification/resources/resource-manager/Microsoft.Resources/2015-11-01/*.json",
],
enableRoundTripValidator: true
enableRoundTripValidator: true,
};
const validator = new LiveValidator(options);
await validator.initialize();
@ -339,7 +340,7 @@ describe("Live Validator", () => {
swaggerPathsPattern: [
"specification/apimanagement/resource-manager/Microsoft.ApiManagement/**/*.json",
],
enableRoundTripValidator: true
enableRoundTripValidator: true,
};
const validator = new LiveValidator(options);
await validator.initialize();
@ -358,7 +359,7 @@ describe("Live Validator", () => {
git: {
shouldClone: false,
},
enableRoundTripValidator: true
enableRoundTripValidator: true,
};
const liveValidator = new LiveValidator(options);
await liveValidator.initialize();
@ -380,7 +381,7 @@ describe("Live Validator", () => {
git: {
shouldClone: false,
},
enableRoundTripValidator: true
enableRoundTripValidator: true,
};
const liveValidator = new LiveValidator(options);
await liveValidator.initialize();
@ -402,7 +403,7 @@ describe("Live Validator", () => {
git: {
shouldClone: false,
},
enableRoundTripValidator: true
enableRoundTripValidator: true,
};
const liveValidator = new LiveValidator(options);
await liveValidator.initialize();
@ -423,7 +424,7 @@ describe("Live Validator", () => {
git: {
shouldClone: false,
},
enableRoundTripValidator: true
enableRoundTripValidator: true,
};
const liveValidator = new LiveValidator(options);
await liveValidator.initialize();
@ -461,7 +462,7 @@ describe("Live Validator", () => {
git: {
shouldClone: false,
},
enableRoundTripValidator: true
enableRoundTripValidator: true,
};
const liveValidator = new LiveValidator(options);
await liveValidator.initialize();
@ -494,7 +495,7 @@ describe("Live Validator", () => {
git: {
shouldClone: false,
},
enableRoundTripValidator: true
enableRoundTripValidator: true,
};
const liveValidator = new LiveValidator(options);
await liveValidator.initialize();
@ -515,7 +516,7 @@ describe("Live Validator", () => {
shouldClone: false,
},
isArmCall: true,
enableRoundTripValidator: true
enableRoundTripValidator: true,
};
const liveValidator = new LiveValidator(options);
await liveValidator.initialize();
@ -536,7 +537,7 @@ describe("Live Validator", () => {
shouldClone: false,
},
isArmCall: true,
enableRoundTripValidator: true
enableRoundTripValidator: true,
};
const liveValidator = new LiveValidator(options);
await liveValidator.initialize();
@ -557,7 +558,7 @@ describe("Live Validator", () => {
shouldClone: false,
},
isArmCall: true,
enableRoundTripValidator: true
enableRoundTripValidator: true,
};
const liveValidator = new LiveValidator(options);
await liveValidator.initialize();
@ -578,7 +579,7 @@ describe("Live Validator", () => {
shouldClone: false,
},
isArmCall: true,
enableRoundTripValidator: true
enableRoundTripValidator: true,
};
const liveValidator = new LiveValidator(options);
await liveValidator.initialize();
@ -599,7 +600,7 @@ describe("Live Validator", () => {
shouldClone: false,
},
isArmCall: true,
enableRoundTripValidator: true
enableRoundTripValidator: true,
};
const liveValidator = new LiveValidator(options);
await liveValidator.initialize();
@ -617,7 +618,7 @@ describe("Live Validator", () => {
git: {
shouldClone: false,
},
enableRoundTripValidator: true
enableRoundTripValidator: true,
};
const liveValidator = new LiveValidator(options);
await liveValidator.initialize();
@ -635,7 +636,7 @@ describe("Live Validator", () => {
git: {
shouldClone: false,
},
enableRoundTripValidator: true
enableRoundTripValidator: true,
};
const liveValidator = new LiveValidator(options);
await liveValidator.initialize();
@ -648,7 +649,7 @@ describe("Live Validator", () => {
const options = {
directory: "./test/liveValidation/swaggers/specification/defaultIsErrorOnly",
swaggerPathsPattern: ["test.json"],
enableRoundTripValidator: true
enableRoundTripValidator: true,
};
const validator = new LiveValidator(options);
await validator.initialize();
@ -685,7 +686,7 @@ describe("Live Validator", () => {
git: {
shouldClone: false,
},
enableRoundTripValidator: true
enableRoundTripValidator: true,
};
const liveValidator = new LiveValidator(options);
await liveValidator.initialize();
@ -694,6 +695,4 @@ describe("Live Validator", () => {
assert.equal(result.responseValidationResult.isSuccessful, true);
});
});
});

Просмотреть файл

@ -71,7 +71,8 @@ describe("Semantic validation", () => {
it("should pass when validating a swagger with using arm-id format for string type", async () => {
const specPath = `${testPath}/semanticValidation/specification/validateCompile/Swagger-with-xms-extension.json`;
const result = await validate.validateSpec(specPath, undefined);
assert(result.validityStatus === true,
assert(
result.validityStatus === true,
`swagger "${specPath}" contains semantic validation errors.`
);
});
@ -286,5 +287,13 @@ describe("Semantic validation", () => {
const result = await validate.validateSpec(specPath, undefined);
assert(result.validityStatus === true);
});
it("should validate without additionalProperty Error on the refWithReadOnly property injected by oav", async () => {
const specPath = `${testPath}/modelValidation/swaggers/specification/refWithReadOnlyProperyError/cognitiveservices.json`;
const result = await validate.validateSpec(specPath, undefined);
assert(
result.validityStatus === true,
`swagger "${specPath}" contains semantic validation errors.`
);
});
});
});

Просмотреть файл

@ -78,32 +78,41 @@ describe("Utility functions", () => {
const key = "operationId";
const value = "ConfigurationStores_List";
const spec = {
"swagger": "2.0",
"paths": {
"/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/configurationStores": {
"get": {
"description": "Lists the configuration stores for a given resource group.",
"operationId": "ConfigurationStores_List"
}
},
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores": {
"get": {
"description": "Lists the configuration stores for a given resource group.",
"operationId": "ConfigurationStores_ListByResourceGroup"
}
},
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}": {
"put": {
"description": "Creates a configuration store with the specified parameters.",
"operationId": "ConfigurationStores_Create"
}
}
}
}
swagger: "2.0",
paths: {
"/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/configurationStores":
{
get: {
description: "Lists the configuration stores for a given resource group.",
operationId: "ConfigurationStores_List",
},
},
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores":
{
get: {
description: "Lists the configuration stores for a given resource group.",
operationId: "ConfigurationStores_ListByResourceGroup",
},
},
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}":
{
put: {
description: "Creates a configuration store with the specified parameters.",
operationId: "ConfigurationStores_Create",
},
},
},
};
const paths = utils.findPathsToKey({key, obj: spec})
expect(paths).toEqual([".paths['/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/configurationStores'].get.operationId", ".paths['/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores'].get.operationId", ".paths['/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}'].put.operationId"]);
const path = utils.findPathToValue(paths, spec, value)
expect(path).toEqual([".paths['/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/configurationStores'].get.operationId"]);
})
const paths = utils.findPathsToKey({ key, obj: spec });
expect(paths).toEqual([
".paths['/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/configurationStores'].get.operationId",
".paths['/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores'].get.operationId",
".paths['/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppConfiguration/configurationStores/{configStoreName}'].put.operationId",
]);
const path = utils.findPathToValue(paths, spec, value);
expect(path).toEqual([
".paths['/subscriptions/{subscriptionId}/providers/Microsoft.AppConfiguration/configurationStores'].get.operationId",
]);
});
});