From 795eda540a65426f21a7ff5d58e5881dd3eacf7d Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Fri, 29 Sep 2023 13:05:10 -0700 Subject: [PATCH] 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) --- ChangeLog.md | 4 + .../gen/ApiTestRuleBasedGenerator.ts | 6 +- .../gen/azureCliRecordingLoader.ts | 2 +- .../gen/restlerApiScenarioGenerator.ts | 2 +- .../gen/rules/noChildResourceCreated.ts | 12 +- .../gen/rules/resourceNameCaseInsensitive.ts | 8 +- .../gen/rules/systemDataExistsInResponse.ts | 13 +- lib/swaggerValidator/ajvSchemaValidator.ts | 8 + package-lock.json | 4 +- package.json | 2 +- test/ApiTestRuleBasedGeneratorTest.ts | 104 +- test/liveValidatorTests.ts | 12 +- .../cognitiveservices.json | 3138 +++++++++++++++++ .../examples/CheckDomainAvailability.json | 21 + .../examples/CheckSkuAvailability.json | 30 + .../examples/CreateAccount.json | 140 + .../examples/CreateAccountMin.json | 87 + .../examples/DeleteAccount.json | 13 + .../examples/DeleteCommitmentPlan.json | 14 + .../examples/DeleteDeployment.json | 14 + .../DeletePrivateEndpointConnection.json | 15 + .../examples/GetAccount.json | 31 + .../examples/GetCommitmentPlan.json | 26 + .../examples/GetDeletedAccount.json | 32 + .../examples/GetDeployment.json | 30 + .../examples/GetOperations.json | 43 + .../GetPrivateEndpointConnection.json | 29 + .../examples/GetSkus.json | 2164 ++++++++++++ .../examples/GetUsages.json | 28 + .../examples/ListAccountModels.json | 48 + .../examples/ListAccountsByResourceGroup.json | 50 + .../examples/ListAccountsBySubscription.json | 77 + .../examples/ListCommitmentPlans.json | 29 + .../examples/ListCommitmentTiers.json | 28 + .../ListDeletedAccountsBySubscription.json | 77 + .../examples/ListDeployments.json | 33 + .../examples/ListKeys.json | 16 + .../ListPrivateEndpointConnections.json | 31 + .../examples/ListPrivateLinkResources.json | 30 + .../examples/ListSkus.json | 30 + .../examples/PurgeDeletedAccount.json | 14 + .../examples/PutCommitmentPlan.json | 51 + .../examples/PutDeployment.json | 62 + .../PutPrivateEndpointConnection.json | 54 + .../examples/RegenerateKey.json | 19 + .../examples/UpdateAccount.json | 58 + .../privatelinks.json | 182 + .../refWithReadOnlyProperyError/types.json | 694 ++++ test/modelValidatorTests.ts | 15 +- test/roundtripValidatorTests.ts | 87 +- test/semanticValidatorTests.ts | 11 +- test/utilsTests.ts | 65 +- 52 files changed, 7630 insertions(+), 163 deletions(-) create mode 100644 test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/cognitiveservices.json create mode 100644 test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/CheckDomainAvailability.json create mode 100644 test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/CheckSkuAvailability.json create mode 100644 test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/CreateAccount.json create mode 100644 test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/CreateAccountMin.json create mode 100644 test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/DeleteAccount.json create mode 100644 test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/DeleteCommitmentPlan.json create mode 100644 test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/DeleteDeployment.json create mode 100644 test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/DeletePrivateEndpointConnection.json create mode 100644 test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/GetAccount.json create mode 100644 test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/GetCommitmentPlan.json create mode 100644 test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/GetDeletedAccount.json create mode 100644 test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/GetDeployment.json create mode 100644 test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/GetOperations.json create mode 100644 test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/GetPrivateEndpointConnection.json create mode 100644 test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/GetSkus.json create mode 100644 test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/GetUsages.json create mode 100644 test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListAccountModels.json create mode 100644 test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListAccountsByResourceGroup.json create mode 100644 test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListAccountsBySubscription.json create mode 100644 test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListCommitmentPlans.json create mode 100644 test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListCommitmentTiers.json create mode 100644 test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListDeletedAccountsBySubscription.json create mode 100644 test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListDeployments.json create mode 100644 test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListKeys.json create mode 100644 test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListPrivateEndpointConnections.json create mode 100644 test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListPrivateLinkResources.json create mode 100644 test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListSkus.json create mode 100644 test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/PurgeDeletedAccount.json create mode 100644 test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/PutCommitmentPlan.json create mode 100644 test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/PutDeployment.json create mode 100644 test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/PutPrivateEndpointConnection.json create mode 100644 test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/RegenerateKey.json create mode 100644 test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/UpdateAccount.json create mode 100644 test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/privatelinks.json create mode 100644 test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/types.json diff --git a/ChangeLog.md b/ChangeLog.md index b0fb2c92..e84a7056 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -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`. diff --git a/lib/apiScenario/gen/ApiTestRuleBasedGenerator.ts b/lib/apiScenario/gen/ApiTestRuleBasedGenerator.ts index 378f4caa..f7f33a77 100644 --- a/lib/apiScenario/gen/ApiTestRuleBasedGenerator.ts +++ b/lib/apiScenario/gen/ApiTestRuleBasedGenerator.ts @@ -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 }); } } diff --git a/lib/apiScenario/gen/azureCliRecordingLoader.ts b/lib/apiScenario/gen/azureCliRecordingLoader.ts index 1db55f8c..108b7fea 100644 --- a/lib/apiScenario/gen/azureCliRecordingLoader.ts +++ b/lib/apiScenario/gen/azureCliRecordingLoader.ts @@ -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[]; diff --git a/lib/apiScenario/gen/restlerApiScenarioGenerator.ts b/lib/apiScenario/gen/restlerApiScenarioGenerator.ts index 56cfdeea..05ddc1ed 100644 --- a/lib/apiScenario/gen/restlerApiScenarioGenerator.ts +++ b/lib/apiScenario/gen/restlerApiScenarioGenerator.ts @@ -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[]; diff --git a/lib/apiScenario/gen/rules/noChildResourceCreated.ts b/lib/apiScenario/gen/rules/noChildResourceCreated.ts index f2e3db10..4e3a1639 100644 --- a/lib/apiScenario/gen/rules/noChildResourceCreated.ts +++ b/lib/apiScenario/gen/rules/noChildResourceCreated.ts @@ -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; }, }; diff --git a/lib/apiScenario/gen/rules/resourceNameCaseInsensitive.ts b/lib/apiScenario/gen/rules/resourceNameCaseInsensitive.ts index 1300da8e..8e12ce84 100644 --- a/lib/apiScenario/gen/rules/resourceNameCaseInsensitive.ts +++ b/lib/apiScenario/gen/rules/resourceNameCaseInsensitive.ts @@ -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; }, diff --git a/lib/apiScenario/gen/rules/systemDataExistsInResponse.ts b/lib/apiScenario/gen/rules/systemDataExistsInResponse.ts index 051f67f4..5601f306 100644 --- a/lib/apiScenario/gen/rules/systemDataExistsInResponse.ts +++ b/lib/apiScenario/gen/rules/systemDataExistsInResponse.ts @@ -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; diff --git a/lib/swaggerValidator/ajvSchemaValidator.ts b/lib/swaggerValidator/ajvSchemaValidator.ts index c61de659..6c47d6c5 100644 --- a/lib/swaggerValidator/ajvSchemaValidator.ts +++ b/lib/swaggerValidator/ajvSchemaValidator.ts @@ -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 && diff --git a/package-lock.json b/package-lock.json index fd4fa946..42fc067c 100644 --- a/package-lock.json +++ b/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", diff --git a/package.json b/package.json index 4458dbe7..afd73778 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "oav", - "version": "3.2.12", + "version": "3.2.13", "author": { "name": "Microsoft Corporation", "email": "azsdkteam@microsoft.com", diff --git a/test/ApiTestRuleBasedGeneratorTest.ts b/test/ApiTestRuleBasedGeneratorTest.ts index 0b36aff9..9b2d4d97 100644 --- a/test/ApiTestRuleBasedGeneratorTest.ts +++ b/test/ApiTestRuleBasedGeneratorTest.ts @@ -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); } - }) -}) \ No newline at end of file + }); +}); diff --git a/test/liveValidatorTests.ts b/test/liveValidatorTests.ts index 5c7b562d..60f367e0 100644 --- a/test/liveValidatorTests.ts +++ b/test/liveValidatorTests.ts @@ -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(); diff --git a/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/cognitiveservices.json b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/cognitiveservices.json new file mode 100644 index 00000000..2d193c21 --- /dev/null +++ b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/cognitiveservices.json @@ -0,0 +1,3138 @@ +{ + "swagger": "2.0", + "info": { + "title": "CognitiveServicesManagementClient", + "description": "Cognitive Services Management Client", + "version": "2022-10-01" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "flow": "implicit", + "description": "Azure Active Directory OAuth2 Flow", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "paths": { + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}": { + "put": { + "tags": [ + "CognitiveServicesAccounts" + ], + "description": "Create Cognitive Services Account. Accounts is a resource group wide resource type. It holds the keys for developer to access intelligent APIs. It's also the resource type for billing.", + "operationId": "Accounts_Create", + "x-ms-examples": { + "Create Account": { + "$ref": "./examples/CreateAccount.json" + }, + "Create Account Min": { + "$ref": "./examples/CreateAccountMin.json" + } + }, + "parameters": [ + { + "$ref": "./types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/accountNameParameter" + }, + { + "name": "account", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/Account" + }, + "description": "The parameters to provide for the created account." + }, + { + "$ref": "./types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "./types.json#/parameters/SubscriptionIdParameter" + } + ], + "responses": { + "200": { + "description": "If resource is created successfully or already existed, the service should return 200 (OK).", + "schema": { + "$ref": "#/definitions/Account" + } + }, + "201": { + "description": "If resource is created successfully, the service should return 201 (OK).", + "schema": { + "$ref": "#/definitions/Account" + } + }, + "202": { + "description": "HTTP 202 (Accepted) if the operation was successfully started and will complete asynchronously.", + "schema": { + "$ref": "#/definitions/Account" + } + }, + "default": { + "description": "Error response describing why the operation failed", + "schema": { + "$ref": "./types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-long-running-operation": true + }, + "patch": { + "tags": [ + "CognitiveServicesAccounts" + ], + "description": "Updates a Cognitive Services account", + "operationId": "Accounts_Update", + "x-ms-examples": { + "Update Account": { + "$ref": "./examples/UpdateAccount.json" + } + }, + "parameters": [ + { + "$ref": "./types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/accountNameParameter" + }, + { + "name": "account", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/Account" + }, + "description": "The parameters to provide for the created account." + }, + { + "$ref": "./types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "./types.json#/parameters/SubscriptionIdParameter" + } + ], + "responses": { + "200": { + "description": "The resource provider should return 200 (OK) to indicate that the operation completed successfully. ", + "schema": { + "$ref": "#/definitions/Account" + } + }, + "202": { + "description": "HTTP 202 (Accepted) if the operation was successfully started and will complete asynchronously.", + "schema": { + "$ref": "#/definitions/Account" + } + }, + "default": { + "description": "Error response describing why the operation failed. If the resource group *or* resource does not exist, 404 (NotFound) should be returned.", + "schema": { + "$ref": "./types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-long-running-operation": true + }, + "delete": { + "tags": [ + "CognitiveServicesAccounts" + ], + "description": "Deletes a Cognitive Services account from the resource group. ", + "operationId": "Accounts_Delete", + "x-ms-examples": { + "Delete Account": { + "$ref": "./examples/DeleteAccount.json" + } + }, + "parameters": [ + { + "$ref": "./types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/accountNameParameter" + }, + { + "$ref": "./types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "./types.json#/parameters/SubscriptionIdParameter" + } + ], + "responses": { + "200": { + "description": "A 200 (OK) should be returned if the object exists and was deleted successfully;" + }, + "202": { + "description": "HTTP 202 (Accepted) if the operation was successfully started and will complete asynchronously." + }, + "204": { + "description": "a 204 (NoContent) should be used if the resource does not exist and the request is well formed." + }, + "default": { + "description": "Error response describing why the operation failed", + "schema": { + "$ref": "./types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-long-running-operation": true + }, + "get": { + "tags": [ + "CognitiveServicesAccounts" + ], + "description": "Returns a Cognitive Services account specified by the parameters.", + "operationId": "Accounts_Get", + "x-ms-examples": { + "Get Account": { + "$ref": "./examples/GetAccount.json" + } + }, + "parameters": [ + { + "$ref": "./types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/accountNameParameter" + }, + { + "$ref": "./types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "./types.json#/parameters/SubscriptionIdParameter" + } + ], + "responses": { + "200": { + "description": "The resource provider should return 200 (OK) to indicate that the operation completed successfully.\nFor a detailed explanation of each field in the response body, please refer to the request body description in the PUT resource section. The only GET specific properties are \"name,\" \"type\" and \"id.\"\nField\tDescription\nKind\trequired. String.\n\tThe API set for this API account. It can be \n\t· a single API, for example: Face API, Vision API, Speech API. \n\ta bundle of APIs: Face + Speech, Vision + Emotion, etc.\nsku.name\tRequired.\n\tThe pricing tier/plan of this API. Could be: \n\tF0 - Free\n\tB0 - Basic\n\tS0 - Standard\n\tP0 - Premium\n", + "schema": { + "$ref": "#/definitions/Account" + } + }, + "default": { + "description": "Error response describing why the operation failed. If the resource does not exist, 404 (NotFound) should be returned.", + "schema": { + "$ref": "./types.json#/definitions/ErrorResponse" + } + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/resourceGroups/{resourceGroupName}/deletedAccounts/{accountName}": { + "get": { + "tags": [ + "CognitiveServicesAccounts" + ], + "description": "Returns a Cognitive Services account specified by the parameters.", + "operationId": "DeletedAccounts_Get", + "x-ms-examples": { + "Get Account": { + "$ref": "./examples/GetDeletedAccount.json" + } + }, + "parameters": [ + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "./types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/accountNameParameter" + }, + { + "$ref": "./types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "./types.json#/parameters/SubscriptionIdParameter" + } + ], + "responses": { + "200": { + "description": "The resource provider should return 200 (OK) to indicate that the operation completed successfully.\nFor a detailed explanation of each field in the response body, please refer to the request body description in the PUT resource section. The only GET specific properties are \"name,\" \"type\" and \"id.\"\nField\tDescription\nKind\trequired. String.\n\tThe API set for this API account. It can be \n\t· a single API, for example: Face API, Vision API, Speech API. \n\ta bundle of APIs: Face + Speech, Vision + Emotion, etc.\nsku.name\tRequired.\n\tThe pricing tier/plan of this API. Could be: \n\tF0 - Free\n\tB0 - Basic\n\tS0 - Standard\n\tP0 - Premium\n", + "schema": { + "$ref": "#/definitions/Account" + } + }, + "default": { + "description": "Error response describing why the operation failed. If the resource does not exist, 404 (NotFound) should be returned.", + "schema": { + "$ref": "./types.json#/definitions/ErrorResponse" + } + } + } + }, + "delete": { + "tags": [ + "CognitiveServicesAccounts" + ], + "description": "Deletes a Cognitive Services account from the resource group. ", + "operationId": "DeletedAccounts_Purge", + "x-ms-examples": { + "Delete Account": { + "$ref": "./examples/PurgeDeletedAccount.json" + } + }, + "parameters": [ + { + "$ref": "#/parameters/locationParameter" + }, + { + "$ref": "./types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/accountNameParameter" + }, + { + "$ref": "./types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "./types.json#/parameters/SubscriptionIdParameter" + } + ], + "responses": { + "200": { + "description": "A 200 (OK) should be returned if the object exists and was deleted successfully;" + }, + "202": { + "description": "HTTP 202 (Accepted) if the operation was successfully started and will complete asynchronously." + }, + "204": { + "description": "a 204 (NoContent) should be used if the resource does not exist and the request is well formed." + }, + "default": { + "description": "Error response describing why the operation failed", + "schema": { + "$ref": "./types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-long-running-operation": true + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts": { + "get": { + "tags": [ + "CognitiveServicesAccounts" + ], + "description": "Returns all the resources of a particular type belonging to a resource group", + "operationId": "Accounts_ListByResourceGroup", + "x-ms-examples": { + "List Accounts by Resource Group": { + "$ref": "./examples/ListAccountsByResourceGroup.json" + } + }, + "parameters": [ + { + "$ref": "./types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "./types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "./types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "The resource provider should return 200 (OK) to indicate that the operation completed successfully. For other errors (e.g. internal errors) use the appropriate HTTP error code.\nThe nextLink field is expected to point to the URL the client should use to fetch the next page (per server side paging). This matches the OData guidelines for paged responses here. If a resource provider does not support paging, it should return the same body (JSON object with \"value\" property) but omit nextLink entirely (or set to null, *not* empty string) for future compatibility.\nThe nextLink should be implemented using following query parameters:\n· skipToken: opaque token that allows the resource provider to skip resources already enumerated. This value is defined and returned by the RP after first request via nextLink.\n· top: the optional client query parameter which defines the maximum number of records to be returned by the server.\nImplementation details:\n· NextLink may include all the query parameters (specifically OData $filter) used by the client in the first query. \n· Server may return less records than requested with nextLink. Returning zero records with NextLink is an acceptable response. \nClients must fetch records until the nextLink is not returned back / null. Clients should never rely on number of returned records to determinate if pagination is completed.", + "schema": { + "$ref": "#/definitions/AccountListResult" + } + }, + "default": { + "description": "Error response describing why the operation failed. If the resource group does not exist, 404 (NotFound) will be returned.", + "schema": { + "$ref": "./types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/accounts": { + "get": { + "tags": [ + "CognitiveServicesAccounts" + ], + "description": "Returns all the resources of a particular type belonging to a subscription.", + "operationId": "Accounts_List", + "x-ms-examples": { + "List Accounts by Subscription": { + "$ref": "./examples/ListAccountsBySubscription.json" + } + }, + "parameters": [ + { + "$ref": "./types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "./types.json#/parameters/SubscriptionIdParameter" + } + ], + "responses": { + "200": { + "description": "The resource provider should return 200 (OK) to indicate that the operation completed successfully. For other errors (e.g. internal errors) use the appropriate HTTP error code.\nThe nextLink field is expected to point to the URL the client should use to fetch the next page (per server side paging). This matches the OData guidelines for paged responses. If a resource provider does not support paging, it should return the same body but leave nextLink empty for future compatibility.\nFor a detailed explanation of each field in the response body, please refer to the request body description in the PUT resource section. ", + "schema": { + "$ref": "#/definitions/AccountListResult" + } + }, + "default": { + "description": "Error response describing why the operation failed", + "schema": { + "$ref": "./types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/deletedAccounts": { + "get": { + "tags": [ + "CognitiveServicesAccounts" + ], + "description": "Returns all the resources of a particular type belonging to a subscription.", + "operationId": "DeletedAccounts_List", + "x-ms-examples": { + "List Deleted Accounts by Subscription": { + "$ref": "./examples/ListDeletedAccountsBySubscription.json" + } + }, + "parameters": [ + { + "$ref": "./types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "./types.json#/parameters/SubscriptionIdParameter" + } + ], + "responses": { + "200": { + "description": "The resource provider should return 200 (OK) to indicate that the operation completed successfully. For other errors (e.g. internal errors) use the appropriate HTTP error code.\nThe nextLink field is expected to point to the URL the client should use to fetch the next page (per server side paging). This matches the OData guidelines for paged responses. If a resource provider does not support paging, it should return the same body but leave nextLink empty for future compatibility.\nFor a detailed explanation of each field in the response body, please refer to the request body description in the PUT resource section. ", + "schema": { + "$ref": "#/definitions/AccountListResult" + } + }, + "default": { + "description": "Error response describing why the operation failed", + "schema": { + "$ref": "./types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/listKeys": { + "post": { + "tags": [ + "CognitiveServicesAccounts" + ], + "operationId": "Accounts_ListKeys", + "description": "Lists the account keys for the specified Cognitive Services account.", + "x-ms-examples": { + "List Keys": { + "$ref": "./examples/ListKeys.json" + } + }, + "parameters": [ + { + "$ref": "./types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/accountNameParameter" + }, + { + "$ref": "./types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "./types.json#/parameters/SubscriptionIdParameter" + } + ], + "responses": { + "200": { + "description": "Returns with a response body containing the subscription keys for the resource: key1\nThe first API key for authentication when client calls the API endpoint.\n\nkey2\nThe second API key for authentication when client calls the API endpoint.", + "schema": { + "$ref": "#/definitions/ApiKeys" + } + }, + "default": { + "description": "Error response describing why the operation failed", + "schema": { + "$ref": "./types.json#/definitions/ErrorResponse" + } + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/regenerateKey": { + "post": { + "tags": [ + "CognitiveServicesAccounts" + ], + "operationId": "Accounts_RegenerateKey", + "description": "Regenerates the specified account key for the specified Cognitive Services account.", + "x-ms-examples": { + "Regenerate Keys": { + "$ref": "./examples/RegenerateKey.json" + } + }, + "parameters": [ + { + "$ref": "./types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/accountNameParameter" + }, + { + "name": "parameters", + "in": "body", + "required": true, + "x-ms-client-flatten": true, + "schema": { + "$ref": "#/definitions/RegenerateKeyParameters" + }, + "description": "regenerate key parameters." + }, + { + "$ref": "./types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "./types.json#/parameters/SubscriptionIdParameter" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/ApiKeys" + } + }, + "default": { + "description": "Error response describing why the operation failed", + "schema": { + "$ref": "./types.json#/definitions/ErrorResponse" + } + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/skus": { + "get": { + "tags": [ + "Skus", + "CognitiveServicesAccounts" + ], + "operationId": "ResourceSkus_List", + "description": "Gets the list of Microsoft.CognitiveServices SKUs available for your Subscription.", + "x-ms-examples": { + "Regenerate Keys": { + "$ref": "./examples/GetSkus.json" + } + }, + "parameters": [ + { + "$ref": "./types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "./types.json#/parameters/SubscriptionIdParameter" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/ResourceSkuListResult" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "./types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/skus": { + "get": { + "tags": [ + "CognitiveServicesAccounts" + ], + "description": "List available SKUs for the requested Cognitive Services account", + "x-ms-examples": { + "List SKUs": { + "$ref": "./examples/ListSkus.json" + } + }, + "operationId": "Accounts_ListSkus", + "parameters": [ + { + "$ref": "./types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/accountNameParameter" + }, + { + "$ref": "./types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "./types.json#/parameters/SubscriptionIdParameter" + } + ], + "responses": { + "200": { + "description": "The resource provider should return 200 (OK) to indicate that the operation completed successfully.\nFor a detailed explanation of each field in the response body, please refer to the request body description in the PUT resource section. The only GET specific properties are \"name,\" \"type\" and \"id.\"\nField\tDescription\nsku\tRequired, object\n\tThe exact set of keys that define this sku. This matches the fields on the respective resource.\nsku.name\tRequired, string\n\tThe name of the SKU. This is typically a letter + number code, such as A0 or P3\nsku.tier\tRequired, string\n\tThe tier of this particular SKU. Typically one of:\n\t· Free\n\t· Basic\n\t· Standard\n\t· Premium\n", + "schema": { + "$ref": "#/definitions/AccountSkuListResult" + } + }, + "default": { + "description": "Error response describing why the operation failed. If the resource does not exist, 404 (NotFound) will be returned.", + "schema": { + "$ref": "./types.json#/definitions/ErrorResponse" + } + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/usages": { + "get": { + "tags": [ + "CognitiveServicesAccounts" + ], + "description": "Get usages for the requested Cognitive Services account", + "x-ms-examples": { + "Get Usages": { + "$ref": "./examples/GetUsages.json" + } + }, + "operationId": "Accounts_ListUsages", + "parameters": [ + { + "$ref": "./types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/accountNameParameter" + }, + { + "$ref": "./types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "./types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "#/parameters/usageFilterParameter" + } + ], + "responses": { + "200": { + "description": "The usages for Cognitive Services account were retrieved successfully.", + "schema": { + "$ref": "#/definitions/UsageListResult" + } + }, + "default": { + "description": "Error response describing why the operation failed. If the resource does not exist, 404 (NotFound) will be returned.", + "schema": { + "$ref": "./types.json#/definitions/ErrorResponse" + } + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/models": { + "get": { + "tags": [ + "CognitiveServicesAccounts" + ], + "description": "List available Models for the requested Cognitive Services account", + "x-ms-examples": { + "List AccountModels": { + "$ref": "./examples/ListAccountModels.json" + } + }, + "operationId": "Accounts_ListModels", + "parameters": [ + { + "$ref": "./types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/accountNameParameter" + }, + { + "$ref": "./types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "./types.json#/parameters/SubscriptionIdParameter" + } + ], + "responses": { + "200": { + "description": "The resource provider should return 200 (OK) to indicate that the operation completed successfully.\nFor a detailed explanation of each field in the response body, please refer to the request body description in the PUT resource section. The only GET specific properties are \"name,\" \"type\" and \"id.\"\nField\tDescription\nsku\tRequired, object\n\tThe exact set of keys that define this sku. This matches the fields on the respective resource.\nsku.name\tRequired, string\n\tThe name of the SKU. This is typically a letter + number code, such as A0 or P3\nsku.tier\tRequired, string\n\tThe tier of this particular SKU. Typically one of:\n\t· Free\n\t· Basic\n\t· Standard\n\t· Premium\n", + "schema": { + "$ref": "#/definitions/AccountModelListResult" + } + }, + "default": { + "description": "Error response describing why the operation failed. If the resource does not exist, 404 (NotFound) will be returned.", + "schema": { + "$ref": "./types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/providers/Microsoft.CognitiveServices/operations": { + "get": { + "tags": [ + "Operations" + ], + "description": "Lists all the available Cognitive Services account operations.", + "operationId": "Operations_List", + "x-ms-examples": { + "Get Operations": { + "$ref": "./examples/GetOperations.json" + } + }, + "parameters": [ + { + "$ref": "./types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "OK.", + "schema": { + "$ref": "./types.json#/definitions/OperationListResult" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "./types.json#/definitions/ErrorResponse" + } + } + }, + "deprecated": false, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/checkSkuAvailability": { + "post": { + "tags": [ + "CognitiveServicesAccounts" + ], + "operationId": "CheckSkuAvailability", + "description": "Check available SKUs.", + "x-ms-examples": { + "Check SKU Availability": { + "$ref": "./examples/CheckSkuAvailability.json" + } + }, + "parameters": [ + { + "$ref": "./types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "./types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/locationParameter" + }, + { + "name": "parameters", + "in": "body", + "required": true, + "x-ms-client-flatten": true, + "schema": { + "$ref": "#/definitions/CheckSkuAvailabilityParameter" + }, + "description": "Check SKU Availability POST body." + } + ], + "responses": { + "200": { + "description": "OK.", + "schema": { + "$ref": "#/definitions/SkuAvailabilityListResult" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "./types.json#/definitions/ErrorResponse" + } + } + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/commitmentTiers": { + "get": { + "tags": [ + "CommitmentTiers" + ], + "operationId": "CommitmentTiers_List", + "description": "List Commitment Tiers.", + "x-ms-examples": { + "ListCommitmentTiers": { + "$ref": "./examples/ListCommitmentTiers.json" + } + }, + "parameters": [ + { + "$ref": "./types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "./types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/locationParameter" + } + ], + "responses": { + "200": { + "description": "OK.", + "schema": { + "$ref": "#/definitions/CommitmentTierListResult" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "./types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/checkDomainAvailability": { + "post": { + "tags": [ + "CognitiveServicesAccounts" + ], + "operationId": "CheckDomainAvailability", + "description": "Check whether a domain is available.", + "x-ms-examples": { + "Check SKU Availability": { + "$ref": "./examples/CheckDomainAvailability.json" + } + }, + "parameters": [ + { + "$ref": "./types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "./types.json#/parameters/ApiVersionParameter" + }, + { + "name": "parameters", + "in": "body", + "required": true, + "x-ms-client-flatten": true, + "schema": { + "$ref": "#/definitions/CheckDomainAvailabilityParameter" + }, + "description": "Check Domain Availability parameter." + } + ], + "responses": { + "200": { + "description": "OK.", + "schema": { + "$ref": "#/definitions/DomainAvailability" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "./types.json#/definitions/ErrorResponse" + } + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/privateEndpointConnections": { + "get": { + "tags": [ + "PrivateEndpointConnections" + ], + "operationId": "PrivateEndpointConnections_List", + "description": "Gets the private endpoint connections associated with the Cognitive Services account.", + "x-ms-examples": { + "GetPrivateEndpointConnection": { + "$ref": "./examples/ListPrivateEndpointConnections.json" + } + }, + "parameters": [ + { + "$ref": "./types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/accountNameParameter" + }, + { + "$ref": "./types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "./types.json#/parameters/SubscriptionIdParameter" + } + ], + "responses": { + "200": { + "description": "Successfully retrieved private endpoint connections.", + "schema": { + "$ref": "#/definitions/PrivateEndpointConnectionListResult" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "./types.json#/definitions/ErrorResponse" + } + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}": { + "get": { + "tags": [ + "PrivateEndpointConnections" + ], + "operationId": "PrivateEndpointConnections_Get", + "description": "Gets the specified private endpoint connection associated with the Cognitive Services account.", + "x-ms-examples": { + "GetPrivateEndpointConnection": { + "$ref": "./examples/GetPrivateEndpointConnection.json" + } + }, + "parameters": [ + { + "$ref": "./types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/accountNameParameter" + }, + { + "$ref": "./types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "./types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "#/parameters/privateEndpointConnectionNameParameter" + } + ], + "responses": { + "200": { + "description": "OK -- Get the private endpoint connection properties successfully.", + "schema": { + "$ref": "#/definitions/PrivateEndpointConnection" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "./types.json#/definitions/ErrorResponse" + } + } + } + }, + "put": { + "tags": [ + "PrivateEndpointConnections" + ], + "operationId": "PrivateEndpointConnections_CreateOrUpdate", + "description": "Update the state of specified private endpoint connection associated with the Cognitive Services account.", + "x-ms-examples": { + "PutPrivateEndpointConnection": { + "$ref": "./examples/PutPrivateEndpointConnection.json" + } + }, + "parameters": [ + { + "$ref": "./types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/accountNameParameter" + }, + { + "$ref": "./types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "./types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "#/parameters/privateEndpointConnectionNameParameter" + }, + { + "name": "properties", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PrivateEndpointConnection" + }, + "description": "The private endpoint connection properties." + } + ], + "responses": { + "200": { + "description": "OK -- Update the private endpoint connection properties successfully.", + "schema": { + "$ref": "#/definitions/PrivateEndpointConnection" + } + }, + "202": { + "description": "HTTP 202 (Accepted) if the operation was successfully started and will complete asynchronously.", + "schema": { + "$ref": "#/definitions/PrivateEndpointConnection" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "./types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-long-running-operation": true + }, + "delete": { + "tags": [ + "PrivateEndpointConnections" + ], + "operationId": "PrivateEndpointConnections_Delete", + "description": "Deletes the specified private endpoint connection associated with the Cognitive Services account.", + "x-ms-examples": { + "DeletePrivateEndpointConnection": { + "$ref": "./examples/DeletePrivateEndpointConnection.json" + } + }, + "parameters": [ + { + "$ref": "./types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/accountNameParameter" + }, + { + "$ref": "./types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "./types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "#/parameters/privateEndpointConnectionNameParameter" + } + ], + "responses": { + "200": { + "description": "OK -- Delete the private endpoint connection successfully." + }, + "202": { + "description": "Accepted -- the operation was successfully started and will complete asynchronously." + }, + "204": { + "description": "No Content -- The private endpoint connection does not exist." + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "./types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-long-running-operation": true + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/privateLinkResources": { + "get": { + "tags": [ + "PrivateLinkResources" + ], + "operationId": "PrivateLinkResources_List", + "description": "Gets the private link resources that need to be created for a Cognitive Services account.", + "x-ms-examples": { + "ListPrivateLinkResources": { + "$ref": "./examples/ListPrivateLinkResources.json" + } + }, + "parameters": [ + { + "$ref": "./types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/accountNameParameter" + }, + { + "$ref": "./types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "./types.json#/parameters/SubscriptionIdParameter" + } + ], + "responses": { + "200": { + "description": "Successfully retrieved private link resources.", + "schema": { + "$ref": "#/definitions/PrivateLinkResourceListResult" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "./types.json#/definitions/ErrorResponse" + } + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments": { + "get": { + "tags": [ + "Deployments" + ], + "operationId": "Deployments_List", + "description": "Gets the deployments associated with the Cognitive Services account.", + "x-ms-examples": { + "ListDeployments": { + "$ref": "./examples/ListDeployments.json" + } + }, + "parameters": [ + { + "$ref": "./types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/accountNameParameter" + }, + { + "$ref": "./types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "./types.json#/parameters/SubscriptionIdParameter" + } + ], + "responses": { + "200": { + "description": "Successfully retrieved deployments.", + "schema": { + "$ref": "#/definitions/DeploymentListResult" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "./types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments/{deploymentName}": { + "get": { + "tags": [ + "Deployments" + ], + "operationId": "Deployments_Get", + "description": "Gets the specified deployments associated with the Cognitive Services account.", + "x-ms-examples": { + "GetDeployment": { + "$ref": "./examples/GetDeployment.json" + } + }, + "parameters": [ + { + "$ref": "./types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/accountNameParameter" + }, + { + "$ref": "./types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "./types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "#/parameters/deploymentNameParameter" + } + ], + "responses": { + "200": { + "description": "OK -- Get the deployments properties successfully.", + "schema": { + "$ref": "#/definitions/Deployment" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "./types.json#/definitions/ErrorResponse" + } + } + } + }, + "put": { + "tags": [ + "Deployments" + ], + "operationId": "Deployments_CreateOrUpdate", + "description": "Update the state of specified deployments associated with the Cognitive Services account.", + "x-ms-examples": { + "PutDeployment": { + "$ref": "./examples/PutDeployment.json" + } + }, + "parameters": [ + { + "$ref": "./types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/accountNameParameter" + }, + { + "$ref": "./types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "./types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "#/parameters/deploymentNameParameter" + }, + { + "name": "deployment", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/Deployment" + }, + "description": "The deployment properties." + } + ], + "responses": { + "200": { + "description": "Create/Update the deployment successfully.", + "schema": { + "$ref": "#/definitions/Deployment" + } + }, + "201": { + "description": "Create the deployment successfully.", + "schema": { + "$ref": "#/definitions/Deployment" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "./types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-long-running-operation": true + }, + "delete": { + "tags": [ + "Deployments" + ], + "operationId": "Deployments_Delete", + "description": "Deletes the specified deployment associated with the Cognitive Services account.", + "x-ms-examples": { + "DeleteDeployment": { + "$ref": "./examples/DeleteDeployment.json" + } + }, + "parameters": [ + { + "$ref": "./types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/accountNameParameter" + }, + { + "$ref": "./types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "./types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "#/parameters/deploymentNameParameter" + } + ], + "responses": { + "200": { + "description": "OK -- Delete the deployment successfully." + }, + "202": { + "description": "Accepted -- the operation was successfully started and will complete asynchronously." + }, + "204": { + "description": "No Content -- The deployment does not exist." + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "./types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-long-running-operation": true + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/commitmentPlans": { + "get": { + "tags": [ + "CommitmentPlans" + ], + "operationId": "CommitmentPlans_List", + "description": "Gets the commitmentPlans associated with the Cognitive Services account.", + "x-ms-examples": { + "ListCommitmentPlans": { + "$ref": "./examples/ListCommitmentPlans.json" + } + }, + "parameters": [ + { + "$ref": "./types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/accountNameParameter" + }, + { + "$ref": "./types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "./types.json#/parameters/SubscriptionIdParameter" + } + ], + "responses": { + "200": { + "description": "Successfully retrieved commitmentPlans.", + "schema": { + "$ref": "#/definitions/CommitmentPlanListResult" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "./types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/commitmentPlans/{commitmentPlanName}": { + "get": { + "tags": [ + "CommitmentPlans" + ], + "operationId": "CommitmentPlans_Get", + "description": "Gets the specified commitmentPlans associated with the Cognitive Services account.", + "x-ms-examples": { + "GetCommitmentPlan": { + "$ref": "./examples/GetCommitmentPlan.json" + } + }, + "parameters": [ + { + "$ref": "./types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/accountNameParameter" + }, + { + "$ref": "./types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "./types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "#/parameters/commitmentPlanNameParameter" + } + ], + "responses": { + "200": { + "description": "OK -- Get the commitmentPlans properties successfully.", + "schema": { + "$ref": "#/definitions/CommitmentPlan" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "./types.json#/definitions/ErrorResponse" + } + } + } + }, + "put": { + "tags": [ + "CommitmentPlans" + ], + "operationId": "CommitmentPlans_CreateOrUpdate", + "description": "Update the state of specified commitmentPlans associated with the Cognitive Services account.", + "x-ms-examples": { + "PutCommitmentPlan": { + "$ref": "./examples/PutCommitmentPlan.json" + } + }, + "parameters": [ + { + "$ref": "./types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/accountNameParameter" + }, + { + "$ref": "./types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "./types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "#/parameters/commitmentPlanNameParameter" + }, + { + "name": "commitmentPlan", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CommitmentPlan" + }, + "description": "The commitmentPlan properties." + } + ], + "responses": { + "200": { + "description": "Create/Update the CommitmentPlan successfully.", + "schema": { + "$ref": "#/definitions/CommitmentPlan" + } + }, + "201": { + "description": "Create the CommitmentPlan successfully.", + "schema": { + "$ref": "#/definitions/CommitmentPlan" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "./types.json#/definitions/ErrorResponse" + } + } + } + }, + "delete": { + "tags": [ + "CommitmentPlans" + ], + "operationId": "CommitmentPlans_Delete", + "description": "Deletes the specified commitmentPlan associated with the Cognitive Services account.", + "x-ms-examples": { + "DeleteCommitmentPlan": { + "$ref": "./examples/DeleteCommitmentPlan.json" + } + }, + "parameters": [ + { + "$ref": "./types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/accountNameParameter" + }, + { + "$ref": "./types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "./types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "#/parameters/commitmentPlanNameParameter" + } + ], + "responses": { + "200": { + "description": "OK -- Delete the commitmentPlan successfully." + }, + "202": { + "description": "Accepted -- the operation was successfully started and will complete asynchronously." + }, + "204": { + "description": "No Content -- The commitmentPlan does not exist." + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "./types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-long-running-operation": true + } + } + }, + "definitions": { + "Kind": { + "type": "string", + "description": "The kind (type) of cognitive service account." + }, + "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", + "Enterprise" + ], + "x-ms-enum": { + "name": "SkuTier", + "modelAsString": true + }, + "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" + ] + }, + "SkuName": { + "type": "string", + "description": "The name of SKU." + }, + "Account": { + "description": "Cognitive Services account is an Azure resource representing the provisioned account, it's type, location and SKU.", + "type": "object", + "properties": { + "kind": { + "$ref": "#/definitions/Kind", + "description": "The Kind of the resource." + }, + "sku": { + "$ref": "#/definitions/Sku" + }, + "identity": { + "$ref": "#/definitions/Identity" + }, + "systemData": { + "$ref": "./types.json#/definitions/systemData", + "readOnly": true + }, + "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" + }, + "properties": { + "$ref": "#/definitions/AccountProperties", + "description": "Properties of Cognitive Services account." + } + }, + "allOf": [ + { + "$ref": "./types.json#/definitions/AzureEntityResource" + } + ] + }, + "AccountListResult": { + "type": "object", + "properties": { + "nextLink": { + "description": "The link used to get the next page of accounts.", + "type": "string" + }, + "value": { + "readOnly": true, + "type": "array", + "items": { + "$ref": "#/definitions/Account" + }, + "description": "Gets the list of Cognitive Services accounts and their properties." + } + }, + "description": "The list of cognitive services accounts operation response." + }, + "AccountProperties": { + "type": "object", + "properties": { + "provisioningState": { + "readOnly": true, + "type": "string", + "description": "Gets the status of the cognitive services account at the time the operation was called.", + "enum": [ + "Accepted", + "Creating", + "Deleting", + "Moving", + "Failed", + "Succeeded", + "ResolvingDNS" + ], + "x-ms-enum": { + "name": "ProvisioningState", + "modelAsString": true + } + }, + "endpoint": { + "type": "string", + "description": "Endpoint of the created account.", + "readOnly": true + }, + "internalId": { + "type": "string", + "description": "The internal identifier (deprecated, do not use this property).", + "readOnly": true + }, + "capabilities": { + "readOnly": true, + "type": "array", + "items": { + "$ref": "#/definitions/SkuCapability" + }, + "x-ms-identifiers": [ + "name" + ], + "description": "Gets the capabilities of the cognitive services account. Each item indicates the capability of a specific feature. The values are read-only and for reference only." + }, + "isMigrated": { + "type": "boolean", + "description": "If the resource is migrated from an existing key.", + "readOnly": true + }, + "migrationToken": { + "type": "string", + "description": "Resource migration token." + }, + "skuChangeInfo": { + "$ref": "#/definitions/SkuChangeInfo", + "description": "Sku change info of account.", + "readOnly": true + }, + "customSubDomainName": { + "type": "string", + "description": "Optional subdomain name used for token-based authentication." + }, + "networkAcls": { + "$ref": "#/definitions/NetworkRuleSet", + "description": "A collection of rules governing the accessibility from specific network locations." + }, + "encryption": { + "$ref": "#/definitions/Encryption", + "description": "The encryption properties for this resource." + }, + "userOwnedStorage": { + "type": "array", + "items": { + "$ref": "#/definitions/UserOwnedStorage" + }, + "x-ms-identifiers": [ + "resourceId" + ], + "description": "The storage accounts for this resource." + }, + "privateEndpointConnections": { + "type": "array", + "readOnly": true, + "items": { + "$ref": "#/definitions/PrivateEndpointConnection" + }, + "description": "The private endpoint connection associated with the Cognitive Services account." + }, + "publicNetworkAccess": { + "type": "string", + "description": "Whether or not public endpoint access is allowed for this account.", + "enum": [ + "Enabled", + "Disabled" + ], + "x-ms-enum": { + "name": "PublicNetworkAccess", + "modelAsString": true + } + }, + "apiProperties": { + "$ref": "#/definitions/ApiProperties", + "description": "The api properties for special APIs." + }, + "dateCreated": { + "readOnly": true, + "type": "string", + "description": "Gets the date of cognitive services account creation." + }, + "callRateLimit": { + "readOnly": true, + "$ref": "#/definitions/CallRateLimit" + }, + "dynamicThrottlingEnabled": { + "type": "boolean", + "description": "The flag to enable dynamic throttling." + }, + "quotaLimit": { + "readOnly": true, + "$ref": "#/definitions/QuotaLimit" + }, + "restrictOutboundNetworkAccess": { + "type": "boolean" + }, + "allowedFqdnList": { + "type": "array", + "items": { + "type": "string" + } + }, + "disableLocalAuth": { + "type": "boolean" + }, + "endpoints": { + "readOnly": true, + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "restore": { + "type": "boolean" + }, + "deletionDate": { + "type": "string", + "description": "The deletion date, only available for deleted account.", + "readOnly": true + }, + "scheduledPurgeDate": { + "type": "string", + "description": "The scheduled purge date, only available for deleted account.", + "readOnly": true + } + }, + "description": "Properties of Cognitive Services account." + }, + "ApiProperties": { + "type": "object", + "additionalProperties": { + "type": "object" + }, + "properties": { + "qnaRuntimeEndpoint": { + "type": "string", + "description": "(QnAMaker Only) The runtime endpoint of QnAMaker." + }, + "qnaAzureSearchEndpointKey": { + "type": "string", + "description": "(QnAMaker Only) The Azure Search endpoint key of QnAMaker." + }, + "qnaAzureSearchEndpointId": { + "type": "string", + "description": "(QnAMaker Only) The Azure Search endpoint id of QnAMaker." + }, + "statisticsEnabled": { + "type": "boolean", + "description": "(Bing Search Only) The flag to enable statistics of Bing Search." + }, + "eventHubConnectionString": { + "type": "string", + "description": "(Personalization Only) The flag to enable statistics of Bing Search.", + "pattern": "^( *)Endpoint=sb://(.*);( *)SharedAccessKeyName=(.*);( *)SharedAccessKey=(.*)$", + "maxLength": 1000 + }, + "storageAccountConnectionString": { + "type": "string", + "description": "(Personalization Only) The storage account connection string.", + "pattern": "^(( *)DefaultEndpointsProtocol=(http|https)( *);( *))?AccountName=(.*)AccountKey=(.*)EndpointSuffix=(.*)$", + "maxLength": 1000 + }, + "aadClientId": { + "type": "string", + "description": "(Metrics Advisor Only) The Azure AD Client Id (Application Id).", + "maxLength": 500 + }, + "aadTenantId": { + "type": "string", + "description": "(Metrics Advisor Only) The Azure AD Tenant Id.", + "maxLength": 500 + }, + "superUser": { + "type": "string", + "description": "(Metrics Advisor Only) The super user of Metrics Advisor.", + "maxLength": 500 + }, + "websiteName": { + "type": "string", + "description": "(Metrics Advisor Only) The website name of Metrics Advisor.", + "maxLength": 500 + } + }, + "description": "The api properties for special APIs." + }, + "CallRateLimit": { + "type": "object", + "properties": { + "count": { + "type": "number", + "description": "The count value of Call Rate Limit." + }, + "renewalPeriod": { + "type": "number", + "description": "The renewal period in seconds of Call Rate Limit." + }, + "rules": { + "type": "array", + "items": { + "$ref": "#/definitions/ThrottlingRule" + }, + "x-ms-identifiers": [ + "key" + ] + } + }, + "description": "The call rate limit Cognitive Services account." + }, + "QuotaLimit": { + "type": "object", + "properties": { + "count": { + "type": "number" + }, + "renewalPeriod": { + "type": "number" + }, + "rules": { + "type": "array", + "items": { + "$ref": "#/definitions/ThrottlingRule" + }, + "x-ms-identifiers": [ + "key" + ] + } + } + }, + "ThrottlingRule": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "renewalPeriod": { + "type": "number" + }, + "count": { + "type": "number" + }, + "minCount": { + "type": "number" + }, + "dynamicThrottlingEnabled": { + "type": "boolean" + }, + "matchPatterns": { + "type": "array", + "items": { + "$ref": "#/definitions/RequestMatchPattern" + }, + "x-ms-identifiers": [ + "path", + "method" + ] + } + } + }, + "RequestMatchPattern": { + "type": "object", + "properties": { + "path": { + "type": "string" + }, + "method": { + "type": "string" + } + } + }, + "ApiKeys": { + "type": "object", + "properties": { + "key1": { + "type": "string", + "description": "Gets the value of key 1." + }, + "key2": { + "type": "string", + "description": "Gets the value of key 2." + } + }, + "description": "The access keys for the cognitive services account." + }, + "SkuChangeInfo": { + "type": "object", + "properties": { + "countOfDowngrades": { + "type": "number", + "description": "Gets the count of downgrades." + }, + "countOfUpgradesAfterDowngrades": { + "type": "number", + "description": "Gets the count of upgrades after downgrades." + }, + "lastChangeDate": { + "type": "string", + "description": "Gets the last change date." + } + }, + "description": "Sku change info of account." + }, + "RegenerateKeyParameters": { + "type": "object", + "properties": { + "keyName": { + "type": "string", + "description": "key name to generate (Key1|Key2)", + "enum": [ + "Key1", + "Key2" + ], + "x-ms-enum": { + "name": "KeyName", + "modelAsString": false + } + } + }, + "required": [ + "keyName" + ], + "description": "Regenerate key parameters." + }, + "AccountSkuListResult": { + "type": "object", + "properties": { + "value": { + "type": "array", + "items": { + "$ref": "#/definitions/AccountSku" + }, + "x-ms-identifiers": [ + "sku/name", + "resourceType" + ], + "description": "Gets the list of Cognitive Services accounts and their properties." + } + }, + "description": "The list of cognitive services accounts operation response." + }, + "AccountSku": { + "type": "object", + "properties": { + "resourceType": { + "type": "string", + "description": "Resource Namespace and Type" + }, + "sku": { + "$ref": "#/definitions/Sku", + "description": "The SKU of Cognitive Services account." + } + }, + "description": "Cognitive Services resource type and SKU." + }, + "UsageListResult": { + "type": "object", + "properties": { + "value": { + "type": "array", + "items": { + "$ref": "#/definitions/Usage" + }, + "x-ms-identifiers": [ + "name" + ], + "description": "The list of usages for Cognitive Service account." + } + }, + "description": "The response to a list usage request." + }, + "Usage": { + "type": "object", + "properties": { + "unit": { + "description": "The unit of the metric.", + "$ref": "#/definitions/UnitType" + }, + "name": { + "$ref": "#/definitions/MetricName", + "description": "The name information for the metric." + }, + "quotaPeriod": { + "type": "string", + "description": "The quota period used to summarize the usage values." + }, + "limit": { + "type": "number", + "format": "double", + "description": "Maximum value for this metric." + }, + "currentValue": { + "type": "number", + "format": "double", + "description": "Current value for this metric." + }, + "nextResetTime": { + "type": "string", + "description": "Next reset time for current quota." + }, + "status": { + "type": "string", + "description": "Cognitive Services account quota usage status.", + "enum": [ + "Included", + "Blocked", + "InOverage", + "Unknown" + ], + "x-ms-enum": { + "name": "QuotaUsageStatus", + "modelAsString": true + } + } + }, + "description": "The usage data for a usage request." + }, + "MetricName": { + "type": "object", + "properties": { + "value": { + "type": "string", + "description": "The name of the metric." + }, + "localizedValue": { + "type": "string", + "description": "The friendly name of the metric." + } + }, + "description": "A metric name." + }, + "UnitType": { + "type": "string", + "description": "The unit of the metric.", + "enum": [ + "Count", + "Bytes", + "Seconds", + "Percent", + "CountPerSecond", + "BytesPerSecond", + "Milliseconds" + ], + "x-ms-enum": { + "modelAsString": true, + "name": "UnitType" + } + }, + "CheckSkuAvailabilityParameter": { + "type": "object", + "description": "Check SKU availability parameter.", + "properties": { + "skus": { + "type": "array", + "items": { + "$ref": "#/definitions/SkuName" + }, + "description": "The SKU of the resource." + }, + "kind": { + "$ref": "#/definitions/Kind", + "description": "The Kind of the resource." + }, + "type": { + "type": "string", + "description": "The Type of the resource." + } + }, + "required": [ + "skus", + "kind", + "type" + ] + }, + "SkuAvailabilityListResult": { + "type": "object", + "description": "Check SKU availability result list.", + "properties": { + "value": { + "type": "array", + "items": { + "$ref": "#/definitions/SkuAvailability" + }, + "x-ms-identifiers": [ + "skuName", + "type", + "kind" + ], + "description": "Check SKU availability result list." + } + } + }, + "SkuAvailability": { + "type": "object", + "description": "SKU availability.", + "properties": { + "kind": { + "$ref": "#/definitions/Kind", + "description": "The Kind of the resource." + }, + "type": { + "type": "string", + "description": "The Type of the resource." + }, + "skuName": { + "$ref": "#/definitions/SkuName", + "description": "The SKU of Cognitive Services account." + }, + "skuAvailable": { + "type": "boolean", + "description": "Indicates the given SKU is available or not." + }, + "reason": { + "type": "string", + "description": "Reason why the SKU is not available." + }, + "message": { + "type": "string", + "description": "Additional error message." + } + } + }, + "SkuCapability": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name of the SkuCapability." + }, + "value": { + "type": "string", + "description": "The value of the SkuCapability." + } + }, + "description": "SkuCapability indicates the capability of a certain feature." + }, + "CheckDomainAvailabilityParameter": { + "type": "object", + "description": "Check Domain availability parameter.", + "properties": { + "subdomainName": { + "type": "string", + "description": "The subdomain name to use." + }, + "type": { + "type": "string", + "description": "The Type of the resource." + }, + "kind": { + "$ref": "#/definitions/Kind", + "description": "The Kind of the resource." + } + }, + "required": [ + "subdomainName", + "type" + ] + }, + "DomainAvailability": { + "type": "object", + "description": "Domain availability.", + "properties": { + "isSubdomainAvailable": { + "type": "boolean", + "description": "Indicates the given SKU is available or not." + }, + "reason": { + "type": "string", + "description": "Reason why the SKU is not available." + }, + "subdomainName": { + "type": "string", + "description": "The subdomain name to use." + }, + "type": { + "type": "string", + "description": "The Type of the resource." + }, + "kind": { + "$ref": "#/definitions/Kind", + "description": "The Kind of the resource." + } + } + }, + "ResourceSkuRestrictions": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The type of restrictions.", + "enum": [ + "Location", + "Zone" + ], + "x-ms-enum": { + "name": "ResourceSkuRestrictionsType", + "modelAsString": false + } + }, + "values": { + "type": "array", + "items": { + "type": "string" + }, + "description": "The value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted." + }, + "restrictionInfo": { + "$ref": "#/definitions/ResourceSkuRestrictionInfo", + "description": "The information about the restriction where the SKU cannot be used." + }, + "reasonCode": { + "type": "string", + "description": "The reason for restriction.", + "enum": [ + "QuotaId", + "NotAvailableForSubscription" + ], + "x-ms-enum": { + "name": "ResourceSkuRestrictionsReasonCode", + "modelAsString": true + } + } + }, + "description": "Describes restrictions of a SKU." + }, + "ResourceSku": { + "type": "object", + "properties": { + "resourceType": { + "type": "string", + "description": "The type of resource the SKU applies to." + }, + "name": { + "type": "string", + "description": "The name of SKU." + }, + "tier": { + "type": "string", + "description": "Specifies the tier of Cognitive Services account." + }, + "kind": { + "type": "string", + "description": "The Kind of resources that are supported in this SKU." + }, + "locations": { + "type": "array", + "items": { + "type": "string" + }, + "description": "The set of locations that the SKU is available." + }, + "restrictions": { + "type": "array", + "items": { + "$ref": "#/definitions/ResourceSkuRestrictions" + }, + "x-ms-identifiers": [], + "description": "The restrictions because of which SKU cannot be used. This is empty if there are no restrictions." + } + }, + "description": "Describes an available Cognitive Services SKU." + }, + "ResourceSkuRestrictionInfo": { + "type": "object", + "properties": { + "locations": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Locations where the SKU is restricted" + }, + "zones": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of availability zones where the SKU is restricted." + } + } + }, + "ResourceSkuListResult": { + "type": "object", + "properties": { + "value": { + "type": "array", + "items": { + "$ref": "#/definitions/ResourceSku" + }, + "x-ms-identifiers": [ + "resourceType", + "name", + "kind" + ], + "description": "The list of skus available for the subscription." + }, + "nextLink": { + "type": "string", + "description": "The uri to fetch the next page of Skus." + } + }, + "required": [ + "value" + ], + "description": "The Get Skus operation response." + }, + "NetworkRuleSet": { + "type": "object", + "properties": { + "defaultAction": { + "type": "string", + "description": "The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated.", + "enum": [ + "Allow", + "Deny" + ], + "x-ms-enum": { + "name": "NetworkRuleAction", + "modelAsString": true + } + }, + "ipRules": { + "type": "array", + "items": { + "$ref": "#/definitions/IpRule" + }, + "x-ms-identifiers": [], + "description": "The list of IP address rules." + }, + "virtualNetworkRules": { + "type": "array", + "items": { + "$ref": "#/definitions/VirtualNetworkRule" + }, + "description": "The list of virtual network rules." + } + }, + "description": "A set of rules governing the network accessibility." + }, + "IpRule": { + "type": "object", + "properties": { + "value": { + "type": "string", + "description": "An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78)." + } + }, + "required": [ + "value" + ], + "description": "A rule governing the accessibility from a specific ip address or ip range." + }, + "VirtualNetworkRule": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'." + }, + "state": { + "type": "string", + "description": "Gets the state of virtual network rule." + }, + "ignoreMissingVnetServiceEndpoint": { + "type": "boolean", + "description": "Ignore missing vnet service endpoint or not." + } + }, + "required": [ + "id" + ], + "description": "A rule governing the accessibility from a specific virtual network." + }, + "Identity": { + "type": "object", + "description": "Identity for the resource.", + "properties": { + "type": { + "type": "string", + "description": "The identity type.", + "enum": [ + "None", + "SystemAssigned", + "UserAssigned", + "SystemAssigned, UserAssigned" + ], + "x-ms-enum": { + "name": "ResourceIdentityType", + "modelAsString": false + } + }, + "tenantId": { + "readOnly": true, + "type": "string", + "description": "The tenant ID of resource." + }, + "principalId": { + "readOnly": true, + "type": "string", + "description": "The principal ID of resource identity." + }, + "userAssignedIdentities": { + "description": "The list of user assigned identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}", + "type": "object", + "additionalProperties": { + "description": "User-assigned managed identity.", + "$ref": "#/definitions/UserAssignedIdentity" + } + } + } + }, + "UserAssignedIdentity": { + "type": "object", + "description": "User-assigned managed identity.", + "properties": { + "principalId": { + "readOnly": true, + "type": "string", + "description": "Azure Active Directory principal ID associated with this Identity." + }, + "clientId": { + "readOnly": true, + "type": "string", + "description": "Client App Id associated with this identity." + } + } + }, + "Encryption": { + "type": "object", + "properties": { + "keyVaultProperties": { + "$ref": "#/definitions/KeyVaultProperties", + "description": "Properties of KeyVault" + }, + "keySource": { + "type": "string", + "description": "Enumerates the possible value of keySource for Encryption", + "default": "Microsoft.KeyVault", + "enum": [ + "Microsoft.CognitiveServices", + "Microsoft.KeyVault" + ], + "x-ms-enum": { + "name": "keySource", + "modelAsString": true + } + } + }, + "description": "Properties to configure Encryption" + }, + "KeyVaultProperties": { + "type": "object", + "properties": { + "keyName": { + "type": "string", + "description": "Name of the Key from KeyVault" + }, + "keyVersion": { + "type": "string", + "description": "Version of the Key from KeyVault" + }, + "keyVaultUri": { + "type": "string", + "description": "Uri of KeyVault" + }, + "identityClientId": { + "type": "string" + } + }, + "description": "Properties to configure keyVault Properties" + }, + "UserOwnedStorage": { + "type": "object", + "properties": { + "resourceId": { + "type": "string", + "description": "Full resource id of a Microsoft.Storage resource." + }, + "identityClientId": { + "type": "string" + } + }, + "description": "The user owned storage for Cognitive Services account." + }, + "PrivateEndpointConnectionListResult": { + "type": "object", + "properties": { + "value": { + "type": "array", + "description": "Array of private endpoint connections", + "items": { + "$ref": "#/definitions/PrivateEndpointConnection" + } + } + }, + "description": "A list of private endpoint connections" + }, + "PrivateEndpointConnection": { + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/PrivateEndpointConnectionProperties", + "description": "Resource properties." + }, + "systemData": { + "$ref": "./types.json#/definitions/systemData", + "readOnly": true + }, + "location": { + "type": "string", + "description": "The location of the private endpoint connection" + } + }, + "allOf": [ + { + "$ref": "./types.json#/definitions/AzureEntityResource" + } + ], + "description": "The Private Endpoint Connection resource." + }, + "PrivateEndpointConnectionProperties": { + "type": "object", + "properties": { + "privateEndpoint": { + "$ref": "./privatelinks.json#/definitions/PrivateEndpoint", + "description": "The resource of private end point." + }, + "privateLinkServiceConnectionState": { + "$ref": "./privatelinks.json#/definitions/PrivateLinkServiceConnectionState", + "description": "A collection of information about the state of the connection between service consumer and provider." + }, + "provisioningState": { + "$ref": "./privatelinks.json#/definitions/PrivateEndpointConnectionProvisioningState", + "description": "The provisioning state of the private endpoint connection resource." + }, + "groupIds": { + "type": "array", + "items": { + "type": "string" + }, + "description": "The private link resource group ids." + } + }, + "required": [ + "privateLinkServiceConnectionState" + ], + "description": "Properties of the PrivateEndpointConnectProperties." + }, + "PrivateLinkResourceListResult": { + "type": "object", + "properties": { + "value": { + "type": "array", + "description": "Array of private link resources", + "items": { + "$ref": "#/definitions/PrivateLinkResource" + } + } + }, + "description": "A list of private link resources" + }, + "PrivateLinkResource": { + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/PrivateLinkResourceProperties", + "description": "Resource properties." + } + }, + "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." + }, + "displayName": { + "description": "The private link resource display name.", + "type": "string", + "readOnly": true + } + }, + "description": "Properties of a private link resource." + }, + "DeploymentListResult": { + "type": "object", + "properties": { + "nextLink": { + "description": "The link used to get the next page of Deployment.", + "type": "string" + }, + "value": { + "readOnly": true, + "type": "array", + "items": { + "$ref": "#/definitions/Deployment" + }, + "description": "Gets the list of Cognitive Services accounts Deployment and their properties." + } + }, + "description": "The list of cognitive services accounts operation response." + }, + "Deployment": { + "description": "Cognitive Services account deployment.", + "type": "object", + "properties": { + "systemData": { + "$ref": "./types.json#/definitions/systemData", + "readOnly": true + }, + "etag": { + "type": "string", + "readOnly": true, + "description": "Resource Etag." + }, + "properties": { + "$ref": "#/definitions/DeploymentProperties", + "description": "Properties of Cognitive Services account deployment." + } + }, + "allOf": [ + { + "$ref": "./types.json#/definitions/ProxyResource" + } + ] + }, + "DeploymentProperties": { + "type": "object", + "properties": { + "provisioningState": { + "readOnly": true, + "type": "string", + "description": "Gets the status of the resource at the time the operation was called.", + "enum": [ + "Accepted", + "Creating", + "Deleting", + "Moving", + "Failed", + "Succeeded" + ], + "x-ms-enum": { + "name": "DeploymentProvisioningState", + "modelAsString": true + } + }, + "model": { + "type": "object", + "$ref": "#/definitions/DeploymentModel" + }, + "scaleSettings": { + "type": "object", + "$ref": "#/definitions/DeploymentScaleSettings" + }, + "capabilities": { + "readOnly": true, + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "The capabilities." + }, + "raiPolicyName": { + "type": "string", + "description": "The name of RAI policy." + }, + "callRateLimit": { + "readOnly": true, + "$ref": "#/definitions/CallRateLimit" + } + }, + "description": "Properties of Cognitive Services account deployment." + }, + "DeploymentModel": { + "type": "object", + "properties": { + "format": { + "type": "string", + "description": "Deployment model format." + }, + "name": { + "type": "string", + "description": "Deployment model name." + }, + "version": { + "type": "string", + "description": "Deployment model version." + }, + "callRateLimit": { + "readOnly": true, + "$ref": "#/definitions/CallRateLimit" + } + }, + "description": "Properties of Cognitive Services account deployment model." + }, + "DeploymentScaleSettings": { + "type": "object", + "properties": { + "scaleType": { + "type": "string", + "description": "Deployment scale type.", + "enum": [ + "Standard", + "Manual" + ], + "x-ms-enum": { + "name": "DeploymentScaleType", + "modelAsString": true + } + }, + "capacity": { + "type": "integer", + "format": "int32", + "description": "Deployment capacity." + }, + "activeCapacity": { + "readOnly": true, + "type": "integer", + "format": "int32", + "description": "Deployment active capacity. This value might be different from `capacity` if customer recently updated `capacity`." + } + }, + "description": "Properties of Cognitive Services account deployment model." + }, + "CommitmentTierListResult": { + "type": "object", + "properties": { + "nextLink": { + "description": "The link used to get the next page of CommitmentTier.", + "type": "string" + }, + "value": { + "readOnly": true, + "type": "array", + "items": { + "$ref": "#/definitions/CommitmentTier" + }, + "x-ms-identifiers": [ + "kind", + "tier", + "skuName", + "hostingModel", + "planType" + ], + "description": "Gets the list of Cognitive Services accounts CommitmentTier and their properties." + } + }, + "description": "The list of cognitive services accounts operation response." + }, + "CommitmentTier": { + "description": "Cognitive Services account commitment tier.", + "type": "object", + "properties": { + "kind": { + "$ref": "#/definitions/Kind", + "description": "The Kind of the resource." + }, + "skuName": { + "type": "string", + "description": "The name of the SKU. Ex - P3. It is typically a letter+number code" + }, + "hostingModel": { + "$ref": "#/definitions/HostingModel", + "description": "Account hosting model." + }, + "planType": { + "type": "string", + "description": "Commitment plan type." + }, + "tier": { + "type": "string", + "description": "Commitment period commitment tier." + }, + "maxCount": { + "type": "integer", + "format": "int32", + "description": "Commitment period commitment max count." + }, + "quota": { + "type": "object", + "$ref": "#/definitions/CommitmentQuota" + }, + "cost": { + "type": "object", + "$ref": "#/definitions/CommitmentCost" + } + } + }, + "CommitmentQuota": { + "type": "object", + "properties": { + "quantity": { + "type": "integer", + "format": "int64", + "description": "Commitment quota quantity." + }, + "unit": { + "type": "string", + "description": "Commitment quota unit." + } + }, + "description": "Cognitive Services account commitment quota." + }, + "CommitmentCost": { + "type": "object", + "properties": { + "commitmentMeterId": { + "type": "string", + "description": "Commitment meter Id." + }, + "overageMeterId": { + "type": "string", + "description": "Overage meter Id." + } + }, + "description": "Cognitive Services account commitment cost." + }, + "CommitmentPlanListResult": { + "type": "object", + "properties": { + "nextLink": { + "description": "The link used to get the next page of CommitmentPlan.", + "type": "string" + }, + "value": { + "readOnly": true, + "type": "array", + "items": { + "$ref": "#/definitions/CommitmentPlan" + }, + "description": "Gets the list of Cognitive Services accounts CommitmentPlan and their properties." + } + }, + "description": "The list of cognitive services accounts operation response." + }, + "CommitmentPlan": { + "description": "Cognitive Services account commitment plan.", + "type": "object", + "properties": { + "systemData": { + "$ref": "./types.json#/definitions/systemData", + "readOnly": true + }, + "etag": { + "type": "string", + "readOnly": true, + "description": "Resource Etag." + }, + "properties": { + "$ref": "#/definitions/CommitmentPlanProperties", + "description": "Properties of Cognitive Services account commitment plan." + } + }, + "allOf": [ + { + "$ref": "./types.json#/definitions/ProxyResource" + } + ] + }, + "CommitmentPlanProperties": { + "type": "object", + "properties": { + "hostingModel": { + "$ref": "#/definitions/HostingModel", + "description": "Account hosting model." + }, + "planType": { + "type": "string", + "description": "Commitment plan type." + }, + "current": { + "type": "object", + "$ref": "#/definitions/CommitmentPeriod" + }, + "autoRenew": { + "type": "boolean", + "description": "AutoRenew commitment plan." + }, + "next": { + "type": "object", + "$ref": "#/definitions/CommitmentPeriod" + }, + "last": { + "type": "object", + "$ref": "#/definitions/CommitmentPeriod", + "readOnly": true + } + }, + "description": "Properties of Cognitive Services account commitment plan." + }, + "HostingModel": { + "type": "string", + "description": "Account hosting model.", + "enum": [ + "Web", + "ConnectedContainer", + "DisconnectedContainer" + ], + "x-ms-enum": { + "name": "HostingModel", + "modelAsString": true + } + }, + "CommitmentPeriod": { + "type": "object", + "properties": { + "tier": { + "type": "string", + "description": "Commitment period commitment tier." + }, + "count": { + "type": "integer", + "format": "int32", + "description": "Commitment period commitment count." + }, + "quota": { + "type": "object", + "$ref": "#/definitions/CommitmentQuota", + "readOnly": true + }, + "startDate": { + "type": "string", + "description": "Commitment period start date.", + "readOnly": true + }, + "endDate": { + "type": "string", + "description": "Commitment period end date.", + "readOnly": true + } + }, + "description": "Cognitive Services account commitment period." + }, + "AccountModelListResult": { + "type": "object", + "properties": { + "nextLink": { + "description": "The link used to get the next page of Model.", + "type": "string" + }, + "value": { + "type": "array", + "items": { + "$ref": "#/definitions/AccountModel" + }, + "x-ms-identifiers": [ + "name", + "format", + "version" + ], + "description": "Gets the list of Cognitive Services accounts Model and their properties." + } + }, + "description": "The list of cognitive services accounts operation response." + }, + "AccountModel": { + "description": "Cognitive Services account Model.", + "type": "object", + "properties": { + "baseModel": { + "type": "object", + "description": "Base Model Identifier.", + "$ref": "#/definitions/DeploymentModel" + }, + "maxCapacity": { + "type": "integer", + "format": "int32", + "description": "The max capacity." + }, + "capabilities": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "The capabilities." + }, + "deprecation": { + "type": "object", + "$ref": "#/definitions/ModelDeprecationInfo" + }, + "systemData": { + "$ref": "./types.json#/definitions/systemData" + } + }, + "allOf": [ + { + "$ref": "#/definitions/DeploymentModel" + } + ] + }, + "ModelDeprecationInfo": { + "description": "Cognitive Services account ModelDeprecationInfo.", + "type": "object", + "properties": { + "fineTune": { + "type": "string", + "description": "The datetime of deprecation of the fineTune Model." + }, + "inference": { + "type": "string", + "description": "The datetime of deprecation of the inference Model." + } + } + } + }, + "parameters": { + "accountNameParameter": { + "name": "accountName", + "in": "path", + "required": true, + "type": "string", + "maxLength": 64, + "minLength": 2, + "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$", + "description": "The name of Cognitive Services account.", + "x-ms-parameter-location": "method" + }, + "locationParameter": { + "name": "location", + "in": "path", + "description": "Resource location.", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }, + "usageFilterParameter": { + "name": "$filter", + "in": "query", + "required": false, + "type": "string", + "description": "An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names).", + "x-ms-parameter-location": "method" + }, + "privateEndpointConnectionNameParameter": { + "name": "privateEndpointConnectionName", + "in": "path", + "required": true, + "type": "string", + "description": "The name of the private endpoint connection associated with the Cognitive Services Account", + "x-ms-parameter-location": "method" + }, + "deploymentNameParameter": { + "name": "deploymentName", + "in": "path", + "required": true, + "type": "string", + "description": "The name of the deployment associated with the Cognitive Services Account", + "x-ms-parameter-location": "method" + }, + "commitmentPlanNameParameter": { + "name": "commitmentPlanName", + "in": "path", + "required": true, + "type": "string", + "description": "The name of the commitmentPlan associated with the Cognitive Services Account", + "x-ms-parameter-location": "method" + } + } +} \ No newline at end of file diff --git a/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/CheckDomainAvailability.json b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/CheckDomainAvailability.json new file mode 100644 index 00000000..9e80314a --- /dev/null +++ b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/CheckDomainAvailability.json @@ -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" + } + } + } +} diff --git a/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/CheckSkuAvailability.json b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/CheckSkuAvailability.json new file mode 100644 index 00000000..582cac98 --- /dev/null +++ b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/CheckSkuAvailability.json @@ -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 + } + ] + } + } + } +} diff --git a/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/CreateAccount.json b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/CreateAccount.json new file mode 100644 index 00000000..ef71a9f0 --- /dev/null +++ b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/CreateAccount.json @@ -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" + } + } + } + } +} diff --git a/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/CreateAccountMin.json b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/CreateAccountMin.json new file mode 100644 index 00000000..40fb6c48 --- /dev/null +++ b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/CreateAccountMin.json @@ -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" + } + } + } + } +} diff --git a/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/DeleteAccount.json b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/DeleteAccount.json new file mode 100644 index 00000000..48f3028f --- /dev/null +++ b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/DeleteAccount.json @@ -0,0 +1,13 @@ +{ + "parameters": { + "api-version": "2022-10-01", + "subscriptionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + "resourceGroupName": "myResourceGroup", + "accountName": "PropTest01" + }, + "responses": { + "200": {}, + "202": {}, + "204": {} + } +} diff --git a/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/DeleteCommitmentPlan.json b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/DeleteCommitmentPlan.json new file mode 100644 index 00000000..f25565cf --- /dev/null +++ b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/DeleteCommitmentPlan.json @@ -0,0 +1,14 @@ +{ + "parameters": { + "api-version": "2022-10-01", + "subscriptionId": "subscriptionId", + "resourceGroupName": "resourceGroupName", + "accountName": "accountName", + "commitmentPlanName": "commitmentPlanName" + }, + "responses": { + "200": {}, + "202": {}, + "204": {} + } +} diff --git a/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/DeleteDeployment.json b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/DeleteDeployment.json new file mode 100644 index 00000000..bb12fb23 --- /dev/null +++ b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/DeleteDeployment.json @@ -0,0 +1,14 @@ +{ + "parameters": { + "api-version": "2022-10-01", + "subscriptionId": "subscriptionId", + "resourceGroupName": "resourceGroupName", + "accountName": "accountName", + "deploymentName": "deploymentName" + }, + "responses": { + "200": {}, + "202": {}, + "204": {} + } +} diff --git a/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/DeletePrivateEndpointConnection.json b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/DeletePrivateEndpointConnection.json new file mode 100644 index 00000000..ae373d9e --- /dev/null +++ b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/DeletePrivateEndpointConnection.json @@ -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": {} + } +} diff --git a/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/GetAccount.json b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/GetAccount.json new file mode 100644 index 00000000..3d8276b7 --- /dev/null +++ b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/GetAccount.json @@ -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" + } + } + } + } +} diff --git a/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/GetCommitmentPlan.json b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/GetCommitmentPlan.json new file mode 100644 index 00000000..665b5b80 --- /dev/null +++ b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/GetCommitmentPlan.json @@ -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" + } + } + } + } + } +} diff --git a/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/GetDeletedAccount.json b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/GetDeletedAccount.json new file mode 100644 index 00000000..73e94125 --- /dev/null +++ b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/GetDeletedAccount.json @@ -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" + } + } + } + } +} diff --git a/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/GetDeployment.json b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/GetDeployment.json new file mode 100644 index 00000000..ca4264fd --- /dev/null +++ b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/GetDeployment.json @@ -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" + } + } + } + } +} diff --git a/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/GetOperations.json b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/GetOperations.json new file mode 100644 index 00000000..22f89012 --- /dev/null +++ b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/GetOperations.json @@ -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" + } + ] + } + } + } +} diff --git a/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/GetPrivateEndpointConnection.json b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/GetPrivateEndpointConnection.json new file mode 100644 index 00000000..9f2a643e --- /dev/null +++ b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/GetPrivateEndpointConnection.json @@ -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" + } + } + } + } + } +} diff --git a/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/GetSkus.json b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/GetSkus.json new file mode 100644 index 00000000..e2a881ec --- /dev/null +++ b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/GetSkus.json @@ -0,0 +1,2164 @@ +{ + "parameters": { + "api-version": "2022-10-01", + "subscriptionId": "f1c637e4-72ec-4f89-8d2b-0f933c036002" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "Bing.Speech", + "locations": [ + "GLOBAL" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "Bing.Speech", + "locations": [ + "GLOBAL" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "SpeechTranslation", + "locations": [ + "GLOBAL" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S1", + "tier": "Standard", + "kind": "SpeechTranslation", + "locations": [ + "GLOBAL" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S2", + "tier": "Standard", + "kind": "SpeechTranslation", + "locations": [ + "GLOBAL" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S3", + "tier": "Standard", + "kind": "SpeechTranslation", + "locations": [ + "GLOBAL" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S4", + "tier": "Standard", + "kind": "SpeechTranslation", + "locations": [ + "GLOBAL" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "TextTranslation", + "locations": [ + "GLOBAL" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S1", + "tier": "Standard", + "kind": "TextTranslation", + "locations": [ + "GLOBAL" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S2", + "tier": "Standard", + "kind": "TextTranslation", + "locations": [ + "GLOBAL" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S3", + "tier": "Standard", + "kind": "TextTranslation", + "locations": [ + "GLOBAL" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S4", + "tier": "Standard", + "kind": "TextTranslation", + "locations": [ + "GLOBAL" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S1", + "tier": "Standard", + "kind": "Bing.Search.v7", + "locations": [ + "GLOBAL" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S2", + "tier": "Standard", + "kind": "Bing.Search.v7", + "locations": [ + "GLOBAL" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S3", + "tier": "Standard", + "kind": "Bing.Search.v7", + "locations": [ + "GLOBAL" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S4", + "tier": "Standard", + "kind": "Bing.Search.v7", + "locations": [ + "GLOBAL" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S5", + "tier": "Standard", + "kind": "Bing.Search.v7", + "locations": [ + "GLOBAL" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S6", + "tier": "Standard", + "kind": "Bing.Search.v7", + "locations": [ + "GLOBAL" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S7", + "tier": "Standard", + "kind": "Bing.Search.v7", + "locations": [ + "GLOBAL" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S8", + "tier": "Standard", + "kind": "Bing.Search.v7", + "locations": [ + "GLOBAL" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S1", + "tier": "Standard", + "kind": "Bing.Autosuggest.v7", + "locations": [ + "GLOBAL" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S1", + "tier": "Standard", + "kind": "Bing.CustomSearch", + "locations": [ + "GLOBAL" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S1", + "tier": "Standard", + "kind": "Bing.SpellCheck.v7", + "locations": [ + "GLOBAL" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "Bing.EntitySearch", + "locations": [ + "GLOBAL" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S1", + "tier": "Standard", + "kind": "Bing.EntitySearch", + "locations": [ + "GLOBAL" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "Face", + "locations": [ + "AUSTRALIAEAST" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "Face", + "locations": [ + "AUSTRALIAEAST" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "ComputerVision", + "locations": [ + "AUSTRALIAEAST" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S1", + "tier": "Standard", + "kind": "ComputerVision", + "locations": [ + "AUSTRALIAEAST" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "ContentModerator", + "locations": [ + "AUSTRALIAEAST" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "ContentModerator", + "locations": [ + "AUSTRALIAEAST" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "TextAnalytics", + "locations": [ + "AUSTRALIAEAST" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "AUSTRALIAEAST" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S1", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "AUSTRALIAEAST" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S2", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "AUSTRALIAEAST" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S3", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "AUSTRALIAEAST" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S4", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "AUSTRALIAEAST" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "LUIS", + "locations": [ + "AUSTRALIAEAST" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "LUIS", + "locations": [ + "AUSTRALIAEAST" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "Face", + "locations": [ + "BRAZILSOUTH" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "Face", + "locations": [ + "BRAZILSOUTH" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "ComputerVision", + "locations": [ + "BRAZILSOUTH" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S1", + "tier": "Standard", + "kind": "ComputerVision", + "locations": [ + "BRAZILSOUTH" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "ContentModerator", + "locations": [ + "BRAZILSOUTH" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "ContentModerator", + "locations": [ + "BRAZILSOUTH" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "TextAnalytics", + "locations": [ + "BRAZILSOUTH" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "BRAZILSOUTH" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S1", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "BRAZILSOUTH" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S2", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "BRAZILSOUTH" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S3", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "BRAZILSOUTH" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S4", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "BRAZILSOUTH" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "LUIS", + "locations": [ + "BRAZILSOUTH" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "LUIS", + "locations": [ + "BRAZILSOUTH" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "Face", + "locations": [ + "CENTRALUSEUAP" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "Face", + "locations": [ + "CENTRALUSEUAP" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "ComputerVision", + "locations": [ + "CENTRALUSEUAP" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S1", + "tier": "Standard", + "kind": "ComputerVision", + "locations": [ + "CENTRALUSEUAP" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "TextAnalytics", + "locations": [ + "CENTRALUSEUAP" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "CENTRALUSEUAP" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S1", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "CENTRALUSEUAP" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S2", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "CENTRALUSEUAP" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S3", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "CENTRALUSEUAP" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S4", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "CENTRALUSEUAP" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "ContentModerator", + "locations": [ + "CENTRALUSEUAP" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "ContentModerator", + "locations": [ + "CENTRALUSEUAP" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "LUIS", + "locations": [ + "CENTRALUSEUAP" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "LUIS", + "locations": [ + "CENTRALUSEUAP" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "ContentModerator", + "locations": [ + "WESTUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "ContentModerator", + "locations": [ + "WESTUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "LUIS", + "locations": [ + "WESTUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "LUIS", + "locations": [ + "WESTUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "Face", + "locations": [ + "WESTUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "Face", + "locations": [ + "WESTUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "TextAnalytics", + "locations": [ + "WESTUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "WESTUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S1", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "WESTUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S2", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "WESTUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S3", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "WESTUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S4", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "WESTUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "SpeakerRecognition", + "locations": [ + "WESTUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "SpeakerRecognition", + "locations": [ + "WESTUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "CustomSpeech", + "locations": [ + "WESTUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S2", + "tier": "Standard", + "kind": "CustomSpeech", + "locations": [ + "WESTUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "ComputerVision", + "locations": [ + "WESTUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S1", + "tier": "Standard", + "kind": "ComputerVision", + "locations": [ + "WESTUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "Face", + "locations": [ + "WESTUS2" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "Face", + "locations": [ + "WESTUS2" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "ComputerVision", + "locations": [ + "WESTUS2" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S1", + "tier": "Standard", + "kind": "ComputerVision", + "locations": [ + "WESTUS2" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "ContentModerator", + "locations": [ + "WESTUS2" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "ContentModerator", + "locations": [ + "WESTUS2" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "TextAnalytics", + "locations": [ + "WESTUS2" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "WESTUS2" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S1", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "WESTUS2" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S2", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "WESTUS2" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S3", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "WESTUS2" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S4", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "WESTUS2" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "LUIS", + "locations": [ + "WESTUS2" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "LUIS", + "locations": [ + "WESTUS2" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "Face", + "locations": [ + "WESTEUROPE" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "Face", + "locations": [ + "WESTEUROPE" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "LUIS", + "locations": [ + "WESTEUROPE" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "LUIS", + "locations": [ + "WESTEUROPE" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "ContentModerator", + "locations": [ + "WESTEUROPE" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "ContentModerator", + "locations": [ + "WESTEUROPE" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "ComputerVision", + "locations": [ + "WESTEUROPE" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S1", + "tier": "Standard", + "kind": "ComputerVision", + "locations": [ + "WESTEUROPE" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "TextAnalytics", + "locations": [ + "WESTEUROPE" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "WESTEUROPE" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S1", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "WESTEUROPE" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S2", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "WESTEUROPE" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S3", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "WESTEUROPE" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S4", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "WESTEUROPE" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "Face", + "locations": [ + "NORTHEUROPE" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "Face", + "locations": [ + "NORTHEUROPE" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "ComputerVision", + "locations": [ + "NORTHEUROPE" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S1", + "tier": "Standard", + "kind": "ComputerVision", + "locations": [ + "NORTHEUROPE" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "ContentModerator", + "locations": [ + "NORTHEUROPE" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "ContentModerator", + "locations": [ + "NORTHEUROPE" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "TextAnalytics", + "locations": [ + "NORTHEUROPE" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "NORTHEUROPE" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S1", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "NORTHEUROPE" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S2", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "NORTHEUROPE" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S3", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "NORTHEUROPE" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S4", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "NORTHEUROPE" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "LUIS", + "locations": [ + "NORTHEUROPE" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "LUIS", + "locations": [ + "NORTHEUROPE" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "Face", + "locations": [ + "SOUTHEASTASIA" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "Face", + "locations": [ + "SOUTHEASTASIA" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "ContentModerator", + "locations": [ + "SOUTHEASTASIA" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "ContentModerator", + "locations": [ + "SOUTHEASTASIA" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "LUIS", + "locations": [ + "SOUTHEASTASIA" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "LUIS", + "locations": [ + "SOUTHEASTASIA" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "ComputerVision", + "locations": [ + "SOUTHEASTASIA" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S1", + "tier": "Standard", + "kind": "ComputerVision", + "locations": [ + "SOUTHEASTASIA" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "TextAnalytics", + "locations": [ + "SOUTHEASTASIA" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "SOUTHEASTASIA" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S1", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "SOUTHEASTASIA" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S2", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "SOUTHEASTASIA" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S3", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "SOUTHEASTASIA" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S4", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "SOUTHEASTASIA" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "Face", + "locations": [ + "EASTASIA" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "Face", + "locations": [ + "EASTASIA" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "ComputerVision", + "locations": [ + "EASTASIA" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S1", + "tier": "Standard", + "kind": "ComputerVision", + "locations": [ + "EASTASIA" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "ContentModerator", + "locations": [ + "EASTASIA" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "ContentModerator", + "locations": [ + "EASTASIA" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "TextAnalytics", + "locations": [ + "EASTASIA" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "EASTASIA" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S1", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "EASTASIA" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S2", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "EASTASIA" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S3", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "EASTASIA" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S4", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "EASTASIA" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "LUIS", + "locations": [ + "EASTASIA" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "LUIS", + "locations": [ + "EASTASIA" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "Face", + "locations": [ + "WESTCENTRALUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "Face", + "locations": [ + "WESTCENTRALUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "ContentModerator", + "locations": [ + "WESTCENTRALUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "ContentModerator", + "locations": [ + "WESTCENTRALUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "LUIS", + "locations": [ + "WESTCENTRALUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "LUIS", + "locations": [ + "WESTCENTRALUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "ComputerVision", + "locations": [ + "WESTCENTRALUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S1", + "tier": "Standard", + "kind": "ComputerVision", + "locations": [ + "WESTCENTRALUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "TextAnalytics", + "locations": [ + "WESTCENTRALUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "WESTCENTRALUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S1", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "WESTCENTRALUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S2", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "WESTCENTRALUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S3", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "WESTCENTRALUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S4", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "WESTCENTRALUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "Face", + "locations": [ + "SOUTHCENTRALUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "Face", + "locations": [ + "SOUTHCENTRALUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "ComputerVision", + "locations": [ + "SOUTHCENTRALUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S1", + "tier": "Standard", + "kind": "ComputerVision", + "locations": [ + "SOUTHCENTRALUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "ContentModerator", + "locations": [ + "SOUTHCENTRALUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "ContentModerator", + "locations": [ + "SOUTHCENTRALUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "TextAnalytics", + "locations": [ + "SOUTHCENTRALUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "SOUTHCENTRALUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S1", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "SOUTHCENTRALUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S2", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "SOUTHCENTRALUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S3", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "SOUTHCENTRALUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S4", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "SOUTHCENTRALUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "LUIS", + "locations": [ + "SOUTHCENTRALUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "LUIS", + "locations": [ + "SOUTHCENTRALUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "CustomVision.Training", + "locations": [ + "SOUTHCENTRALUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "CustomVision.Training", + "locations": [ + "SOUTHCENTRALUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "CustomVision.Prediction", + "locations": [ + "SOUTHCENTRALUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "CustomVision.Prediction", + "locations": [ + "SOUTHCENTRALUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "Face", + "locations": [ + "EASTUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "Face", + "locations": [ + "EASTUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "ComputerVision", + "locations": [ + "EASTUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S1", + "tier": "Standard", + "kind": "ComputerVision", + "locations": [ + "EASTUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "ContentModerator", + "locations": [ + "EASTUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "ContentModerator", + "locations": [ + "EASTUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "TextAnalytics", + "locations": [ + "EASTUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "EASTUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S1", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "EASTUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S2", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "EASTUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S3", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "EASTUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S4", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "EASTUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "LUIS", + "locations": [ + "EASTUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "LUIS", + "locations": [ + "EASTUS" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "ContentModerator", + "locations": [ + "EASTUS2" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "ContentModerator", + "locations": [ + "EASTUS2" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "Face", + "locations": [ + "EASTUS2" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "Face", + "locations": [ + "EASTUS2" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "LUIS", + "locations": [ + "EASTUS2" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "LUIS", + "locations": [ + "EASTUS2" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "ComputerVision", + "locations": [ + "EASTUS2" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S1", + "tier": "Standard", + "kind": "ComputerVision", + "locations": [ + "EASTUS2" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "F0", + "tier": "Free", + "kind": "TextAnalytics", + "locations": [ + "EASTUS2" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S0", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "EASTUS2" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S1", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "EASTUS2" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S2", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "EASTUS2" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S3", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "EASTUS2" + ], + "restrictions": [] + }, + { + "resourceType": "accounts", + "name": "S4", + "tier": "Standard", + "kind": "TextAnalytics", + "locations": [ + "EASTUS2" + ], + "restrictions": [] + } + ] + } + } + } +} diff --git a/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/GetUsages.json b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/GetUsages.json new file mode 100644 index 00000000..29d48e02 --- /dev/null +++ b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/GetUsages.json @@ -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" + } + ] + } + } + } +} diff --git a/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListAccountModels.json b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListAccountModels.json new file mode 100644 index 00000000..3d587c44 --- /dev/null +++ b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListAccountModels.json @@ -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" + } + } + ] + } + } + } +} diff --git a/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListAccountsByResourceGroup.json b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListAccountsByResourceGroup.json new file mode 100644 index 00000000..9aaa6dc3 --- /dev/null +++ b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListAccountsByResourceGroup.json @@ -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" + } + } + ] + } + } + } +} diff --git a/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListAccountsBySubscription.json b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListAccountsBySubscription.json new file mode 100644 index 00000000..19be86cf --- /dev/null +++ b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListAccountsBySubscription.json @@ -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" + } + } + ] + } + } + } +} diff --git a/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListCommitmentPlans.json b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListCommitmentPlans.json new file mode 100644 index 00000000..9c358646 --- /dev/null +++ b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListCommitmentPlans.json @@ -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" + } + } + } + ] + } + } + } +} diff --git a/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListCommitmentTiers.json b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListCommitmentTiers.json new file mode 100644 index 00000000..013137c1 --- /dev/null +++ b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListCommitmentTiers.json @@ -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": {} + } + ] + } + } + } +} diff --git a/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListDeletedAccountsBySubscription.json b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListDeletedAccountsBySubscription.json new file mode 100644 index 00000000..19be86cf --- /dev/null +++ b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListDeletedAccountsBySubscription.json @@ -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" + } + } + ] + } + } + } +} diff --git a/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListDeployments.json b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListDeployments.json new file mode 100644 index 00000000..0e596dbe --- /dev/null +++ b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListDeployments.json @@ -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" + } + } + ] + } + } + } +} diff --git a/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListKeys.json b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListKeys.json new file mode 100644 index 00000000..9902038a --- /dev/null +++ b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListKeys.json @@ -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" + } + } + } +} diff --git a/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListPrivateEndpointConnections.json b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListPrivateEndpointConnections.json new file mode 100644 index 00000000..439597c2 --- /dev/null +++ b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListPrivateEndpointConnections.json @@ -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" + } + } + } + ] + } + } + } +} diff --git a/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListPrivateLinkResources.json b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListPrivateLinkResources.json new file mode 100644 index 00000000..675b0477 --- /dev/null +++ b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListPrivateLinkResources.json @@ -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" + ] + } + } + ] + } + } + } +} diff --git a/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListSkus.json b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListSkus.json new file mode 100644 index 00000000..9630de7a --- /dev/null +++ b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/ListSkus.json @@ -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" + } + } + ] + } + } + } +} diff --git a/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/PurgeDeletedAccount.json b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/PurgeDeletedAccount.json new file mode 100644 index 00000000..6f4c1df8 --- /dev/null +++ b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/PurgeDeletedAccount.json @@ -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": {} + } +} diff --git a/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/PutCommitmentPlan.json b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/PutCommitmentPlan.json new file mode 100644 index 00000000..ab4ca9dd --- /dev/null +++ b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/PutCommitmentPlan.json @@ -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" + } + } + } + } + } +} diff --git a/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/PutDeployment.json b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/PutDeployment.json new file mode 100644 index 00000000..ae393fa1 --- /dev/null +++ b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/PutDeployment.json @@ -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" + } + } + } + } +} diff --git a/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/PutPrivateEndpointConnection.json b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/PutPrivateEndpointConnection.json new file mode 100644 index 00000000..600fe601 --- /dev/null +++ b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/PutPrivateEndpointConnection.json @@ -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" + } + } + } + } + } +} diff --git a/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/RegenerateKey.json b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/RegenerateKey.json new file mode 100644 index 00000000..8cc9d6d6 --- /dev/null +++ b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/RegenerateKey.json @@ -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" + } + } + } +} diff --git a/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/UpdateAccount.json b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/UpdateAccount.json new file mode 100644 index 00000000..7210d294 --- /dev/null +++ b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/examples/UpdateAccount.json @@ -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" + } + } + } + } +} diff --git a/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/privatelinks.json b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/privatelinks.json new file mode 100644 index 00000000..de71737a --- /dev/null +++ b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/privatelinks.json @@ -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" + } + } +} \ No newline at end of file diff --git a/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/types.json b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/types.json new file mode 100644 index 00000000..a1d7f19f --- /dev/null +++ b/test/modelValidation/swaggers/specification/refWithReadOnlyProperyError/types.json @@ -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" + } + } +} diff --git a/test/modelValidatorTests.ts b/test/modelValidatorTests.ts index 063f2871..c099d088 100644 --- a/test/modelValidatorTests.ts +++ b/test/modelValidatorTests.ts @@ -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); }); }); }); diff --git a/test/roundtripValidatorTests.ts b/test/roundtripValidatorTests.ts index 728e5696..643665ae 100644 --- a/test/roundtripValidatorTests.ts +++ b/test/roundtripValidatorTests.ts @@ -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); }); }); - - }); diff --git a/test/semanticValidatorTests.ts b/test/semanticValidatorTests.ts index aa94abf1..4b2c2cec 100644 --- a/test/semanticValidatorTests.ts +++ b/test/semanticValidatorTests.ts @@ -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.` + ); + }); }); }); diff --git a/test/utilsTests.ts b/test/utilsTests.ts index 1b652fd1..e4d05124 100644 --- a/test/utilsTests.ts +++ b/test/utilsTests.ts @@ -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" - } - } - } - } - - 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"]); - }) + 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", + ]); + }); });