From bf9d5af9c9d685783cd44eae69df56a9f7d291ef Mon Sep 17 00:00:00 2001 From: dingmeng-xue Date: Mon, 20 Jul 2020 14:23:51 +0800 Subject: [PATCH 1/8] Add -AllowList --- .azure-pipelines/test-module-upgrade.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/test-module-upgrade.yml b/.azure-pipelines/test-module-upgrade.yml index 1f684e35fc8..84e9708477c 100644 --- a/.azure-pipelines/test-module-upgrade.yml +++ b/.azure-pipelines/test-module-upgrade.yml @@ -14,6 +14,6 @@ steps: displayName: Verify Upgrade inputs: targetType: inline - script: './AutoRestUpgradeTest.ps1 -Configuration' + script: './AutoRestUpgradeTest.ps1 -AllowList' workingDirectory: 'tests-upgrade' failOnStderr: true \ No newline at end of file From c9b29a61ac30c179d0d0c981d550fe2b1d3df2cd Mon Sep 17 00:00:00 2001 From: dingmeng-xue Date: Mon, 20 Jul 2020 14:31:40 +0800 Subject: [PATCH 2/8] Add scripts and configuration --- tests-upgrade/AutoRestUpgradeTest.ps1 | 285 +++++++++++++++++++++++++- tests-upgrade/Configuration.json | 3 + 2 files changed, 287 insertions(+), 1 deletion(-) create mode 100644 tests-upgrade/Configuration.json diff --git a/tests-upgrade/AutoRestUpgradeTest.ps1 b/tests-upgrade/AutoRestUpgradeTest.ps1 index 21b6ac00801..fbe40f979ed 100644 --- a/tests-upgrade/AutoRestUpgradeTest.ps1 +++ b/tests-upgrade/AutoRestUpgradeTest.ps1 @@ -1 +1,284 @@ -Write-Host "Hello" \ No newline at end of file +param([switch]$Generate,[string]$TestName,[switch]$M3,[switch]$M4,[switch]$AllowList,[switch]$BlackList) +#need to use the right version of node.js +# nvs use 10.16.0 +# #please use substring to select the compare path +# $m3Path='.\generate\m3' +# $m4Path='.\generate\m4' +$scriptPath = Get-Location +$global:isError = $false +$conf = (Get-Content 'Configuration.json') | ConvertFrom-Json +$conf +if($AllowList) +{ + # $configurationFileName = $scriptPath.path +'\AllowListConfiguration.csv' + # $testList = import-Csv $configurationFileName + $testList = $conf.WhiteList +} +if($BlackList) +{ + # $blackConfigurationFileName = $scriptPath.path +'\BlackListConfiguration.csv' + # $blackTestList = import-Csv $blackConfigurationFileName + $blackTestList = $conf.BlackList +} +function isCommand([Object]$Object1 , [Object]$Object2) +{ + $isCommandResult = $True + $difference = Compare-Object $Object1 $Object2 + foreach($line in $difference) + { + $lineInfo = $line.InputObject.Replace(' ','') + $lineCompareResult =$lineInfo.Startswith('//') + if(!$lineCompareResult) + { + $isCommandResult = $false + break + } + } + return $isCommandResult +} + +function isNeedIgnore([string]$inputFileName , [Array]$ignoreArray) +{ + $Ignore = $false + foreach($ignoreDetail in $ignoreArray) + { + if($inputFileName.Startswith($ignoreDetail)) + { + $Ignore =$True + break + } + } + return $Ignore +} + +function Generate() +{ + ##m3 and m4 all need to be generated + if((-not $M3) -and (-not $M4)) + { + ##generate m3 code + autorest-beta --use:@autorest/powershell@2.1.386 --output-folder:.\generate\m3 --Debug + ##generate m4 code + autorest-beta --use:D:\comparetest\ModuleFour\autorest.powershell --output-folder:.\generate\m4 --Debug + }elseif($M3) + { + autorest-beta --use:@autorest/powershell@2.1.386 --output-folder:.\generate\m3 --Debug + }else + { + autorest-beta --use:D:\comparetest\ModuleFour\autorest.powershell --output-folder:.\generate\m4 --Debug + } +} + +function CompareTest([string]$inputm3Path,[string]$inputm4Path,[string]$testFileName) +{ + $testFileName + #to creare ecah dictionary (the struct is (string,obj)) + #the key is the path of each file,and the obj has two parameters(hashcodevalue,status) + $initialDict = @{} + #in m3Path + cd $inputm3Path + $initFileList = Get-ChildItem -Recurse -force + # $initIgnoreFileList = $inputm3Path + '\generated\modules' + # $targetIgnoreFileList = $inputm4Path + '\generated\modules' + $initIgnoreFileList = (($inputm3Path+'\generated\modules'), ($inputm3Path+'\.gitignore')) + $targetIgnoreFileList = (($inputm4Path+'\generated\modules'), ($inputm4Path+'\.gitignore')) + # $initFileList + #foreach initFileList and get the hashcode of them + foreach( $initFile in $initFileList) + { + $ignoreResult = isNeedIgnore -inputFileName $initFile.FullName -ignoreArray $initIgnoreFileList + if(!$ignoreResult) + { + # if(!$initFile.FullName.Startswith($initIgnoreFileList)){ + $obj = "what" | Select-Object -Property HashCode, Status + #if the file is not filefolder + if($initFile.mode -eq '-a---') + { + #get the hashcode of the file + $hashTable = $initFile.PSPath.Replace('Microsoft.PowerShell.Core\FileSystem::','') | get-filehash + # $initFile.FullName + # $hashTable + $obj.HashCode = $hashTable.Hash + #get the path of the file + $detailPath = $hashTable.Path.Replace($inputm3Path,'') + $initialDict.Add($detailPath,$obj) + } + } + } + $targetDict = @{} + #in m4Path + cd $inputm4Path + $targetFileList = Get-ChildItem -Recurse -force + #foreach initFileList and get the hashcode of them + foreach( $targetFile in $targetFileList) + { + $ignoreResult = isNeedIgnore -inputFileName $targetFile.FullName -ignoreArray $targetIgnoreFileList + if(!$ignoreResult) + { + $obj = "waht2" | Select-Object -Property HashCode, Status + #if the file is not filefolder + if($targetFile.mode -eq '-a---') + { + #get the hashcode of the file + $hashTable = $targetFile.PSPath.Replace('Microsoft.PowerShell.Core\FileSystem::','') | get-filehash + $obj.HashCode = $hashTable.Hash + #get the path of the file + $detailPath = $hashTable.path.Replace($inputm4Path,'') + $targetDict.Add($detailPath,$obj) + } + } + } + [object[]] $difArray=@() + + #search each dictDetail in targetDict + #the status means: 0 this file do not exist in anouther filefolder + # 1 the hashcode of the file is the same as that in another filefolder + # 2 the hashcode of the file is different from that in another filefolder + foreach($initDictDetail in $initialDict.Keys) + { + $difDetail = "what"| Select-Object -Property fileName,Path,fileFolderName,Status + #if the file not exists in targetDict + if($targetDict[$initDictDetail] -eq $null) + { + $difDetail.Path = $initDictDetail + $difDetail.fileFolderName = 'M3' + $splitStrings = $initDictDetail.Split('\') + $difDetail.fileName = $splitStrings[$splitStrings.count-1] + $difDetail.status = 'lack in M4' + #sign up the status of the file + $initialDict[$initDictDetail].status = 0 + $difArray+= $difDetail + }elseif($targetDict[$initDictDetail].HashCode -ne $initialDict[$initDictDetail].HashCode) + { + $M3CompareFile = Get-Content ($inputm3Path + $initDictDetail) + $M4CompareFile = Get-Content ($inputm4Path + $initDictDetail) + $isCommandResult = isCommand -Object1 $M3CompareFile -Object2 $M4CompareFile + if( $isCommandResult -ne $True) + { + $difDetail.Path = $initDictDetail + $difDetail.fileFolderName = 'M3' + $splitStrings = $initDictDetail.Split('\') + $difDetail.fileName = $splitStrings[$splitStrings.count-1] + $difDetail.status = 'different' + #sign up the status of the file + $initialDict[$initDictDetail].status = 2 + $targetDict[$initDictDetail].status = 2 + $difArray+=$difDetail + }else + { + $initialDict[$initDictDetail].status = 1 + $targetDict[$initDictDetail].status = 1 + } + }else + { + $initialDict[$initDictDetail].status = 1 + $targetDict[$initDictDetail].status = 1 + } + } + #search those files which status is null + foreach($targetDetail in $targetDict.Keys) + { + $difDetail = "what"| Select-Object -Property fileName,Path,fileFolderName,Status + if($targetDict[$targetDetail].Status -eq $null) + { + $difDetail.Path = $targetDetail + $difDetail.fileFolderName = 'M4' + $splitStrings = $targetDetail.Split('\') + $difDetail.fileName = $splitStrings[$splitStrings.count-1] + $difDetail.Status = 'lack in m3' + $difArray+=$difDetail + } + } + if($difArray.Count -gt 0) + { + $global:isError=$True + } + $filename = $scriptPath.Path + '\CompareResult\' + $testFileName + (get-date -format 'yyyyMMddhhmmss')+'.csv' + $difArray | Select-Object -Property fileName,Path,fileFolderName,Status | Export-CSV -path $filename +} + +$currentPath = Get-Location +$fileList = Get-ChildItem +#if only one case +if($TestName -ne $null -and ($TestName -ne '')) +{ + $currentDetailPath = Get-Location + cd ($currentDetailPath.Path+'\'+$TestName) + $deatilPath = $currentDetailPath.Path + 'generate' + Generate + if(-not $Generate) + { + $m3FilePath = $currentDetailPath.Path +'\'+$TestName + '\generate\m3' + $m4FilePath =$currentDetailPath.Path +'\'+$TestName + '\generate\m4' + CompareTest -inputm3Path $m3FilePath -inputm4Path $m4FilePath -testFileName $TestName + } +}elseif($AllowList) +{ + $currentDetailPath = Get-Location + #get each testfolder + foreach($eachTest in $testList) + { + # Write-Host -ForegroundColor green $eachTest + # if(($fileDeatil.Mode -eq 'd----') -and ($fileDeatil.Name -eq $TestName)) + # { + cd ($currentDetailPath.Path+'\'+$eachTest) + $deatilPath = $currentDetailPath.Path + 'generate' + Generate + # } + if(-not $Generate) + { + $m3FilePath = $currentDetailPath.Path +'\'+$eachTest + '\generate\m3' + $m4FilePath =$currentDetailPath.Path +'\'+$eachTest + '\generate\m4' + CompareTest -inputm3Path $m3FilePath -inputm4Path $m4FilePath -testFileName $eachTest + } + } +}elseif($BlackList) +{ + $currentDetailPath = Get-Location + $currentDetailPath + #get each testfolder + foreach($fileDetail in $fileList) + { + foreach($blackTestName in $blackTestList) + { + if(($fileDetail.Mode -eq 'd----') -and (!$fileDetail.Name.Startswith($blackTestName))) + { + cd ($currentDetailPath.Path+'\'+$fileDetail.Name) + $deatilPath = $currentDetailPath.Path + 'generate' + Generate + if(-not $Generate) + { + $m3FilePath = $currentDetailPath.Path +'\'+$fileDetail.Name + '\generate\m3' + $m4FilePath =$currentDetailPath.Path +'\'+$fileDetail.Name + '\generate\m4' + CompareTest -inputm3Path $m3FilePath -inputm4Path $m4FilePath -testFileName $fileDeatil.path + } + } + } + } +} +else +{ + foreach($fileDetail in $fileList) + { + # $currentDetailPath = Get-Location + if($fileDetail.Mode -eq 'd----' -and (!$fileDetail.Name.Startswith('Compare'))) + { + $g1 = $scriptPath.Path +'\' +$fileDetail.Name + cd ($scriptPath.Path +'\' +$fileDetail.Name) + $deatilPath = $scriptPath.Path +'\' +$fileDetail.Name + Generate + if(-not $Generate) + { + $m3FilePath = $deatilPath + '\generate\m3' + $m4FilePath = $deatilPath + '\generate\m4' + CompareTest -inputm3Path $m3FilePath -inputm4Path $m4FilePath -testFileName $fileDetail.Name + # CompareTest -inputm3Path (($currentDetailPath.Path +'\'+$fileDetail.Name+'\generate\m3') -inputm4Path ($currentDetailPath.Path +'\'+$fileDetail.Name+'\generate\m4')) -testFileName $fileDeatil.path + } + } + } +} +cd $currentPath.Path +if($global:isError) +{ + throw 'Error: The code generated by the target file is different from the code generated by the source file.' +} diff --git a/tests-upgrade/Configuration.json b/tests-upgrade/Configuration.json new file mode 100644 index 00000000000..ff193de0224 --- /dev/null +++ b/tests-upgrade/Configuration.json @@ -0,0 +1,3 @@ +{ + "WhiteList":["basic-get","basic-get-delete"] +} \ No newline at end of file From d4e92bece660bd726426fe5c50f444cb89388683 Mon Sep 17 00:00:00 2001 From: dingmeng-xue Date: Mon, 20 Jul 2020 14:40:32 +0800 Subject: [PATCH 3/8] Add build steps --- .azure-pipelines/test-module-upgrade.yml | 27 ++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/.azure-pipelines/test-module-upgrade.yml b/.azure-pipelines/test-module-upgrade.yml index 84e9708477c..58548f2ec39 100644 --- a/.azure-pipelines/test-module-upgrade.yml +++ b/.azure-pipelines/test-module-upgrade.yml @@ -3,6 +3,11 @@ pool: demands: npm steps: +- task: NodeTool@0 + displayName: 'Use Node 10.16.0' + inputs: + versionSpec: 10.16.0 + - task: Npm@1 displayName: 'Install autorest@beta' inputs: @@ -10,6 +15,28 @@ steps: verbose: false customCommand: 'install -g "@autorest/autorest"' +- task: Npm@1 + displayName: 'Install @microsoft/rush' + inputs: + command: custom + verbose: false + customCommand: 'install -g @microsoft/rush@5.12.0' + +- task: CmdLine@2 + displayName: 'Rush sync-versions' + inputs: + script: 'rush sync-versions' + +- task: CmdLine@2 + displayName: 'Rush Update' + inputs: + script: 'rush update' + +- task: CmdLine@2 + displayName: 'Rush Rebuild' + inputs: + script: 'rush rebuild' + - task: PowerShell@2 displayName: Verify Upgrade inputs: From 421018b0528dcfecd0975b9327bbb87b81e0ed97 Mon Sep 17 00:00:00 2001 From: dingmeng-xue Date: Mon, 20 Jul 2020 14:53:52 +0800 Subject: [PATCH 4/8] Change work directory --- tests-upgrade/AutoRestUpgradeTest.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests-upgrade/AutoRestUpgradeTest.ps1 b/tests-upgrade/AutoRestUpgradeTest.ps1 index fbe40f979ed..e6b2cc46e01 100644 --- a/tests-upgrade/AutoRestUpgradeTest.ps1 +++ b/tests-upgrade/AutoRestUpgradeTest.ps1 @@ -59,13 +59,13 @@ function Generate() ##generate m3 code autorest-beta --use:@autorest/powershell@2.1.386 --output-folder:.\generate\m3 --Debug ##generate m4 code - autorest-beta --use:D:\comparetest\ModuleFour\autorest.powershell --output-folder:.\generate\m4 --Debug + autorest-beta --use:..\..\ --output-folder:.\generate\m4 --Debug }elseif($M3) { autorest-beta --use:@autorest/powershell@2.1.386 --output-folder:.\generate\m3 --Debug }else { - autorest-beta --use:D:\comparetest\ModuleFour\autorest.powershell --output-folder:.\generate\m4 --Debug + autorest-beta --use:..\..\ --output-folder:.\generate\m4 --Debug } } From 66c750d8fa1db81803c3626d97e1d71a8989b107 Mon Sep 17 00:00:00 2001 From: Youri Date: Mon, 20 Jul 2020 17:48:35 +0800 Subject: [PATCH 5/8] Enable AutoRestUpgradeTest.ps1. --- tests-upgrade/.gitignore | 1 + tests-upgrade/AutoRestUpgradeTest.ps1 | 11 +- tests-upgrade/Configuration.json | 35 +- .../basic-disableazure-get/readme.md | 13 + .../basic-disableazure-get/swagger.json | 53 + .../basic-disableazure-response/readme.md | 13 + .../basic-disableazure-response/swagger.json | 61 + .../basic-get-delete-put-patch/swagger.json | 16 +- tests-upgrade/basic-get-delete/swagger.json | 12 +- .../basic-get-response-operation/swagger.json | 4 +- tests-upgrade/basic-get/swagger.json | 8 +- .../basic-response-defaultoperation/readme.md | 10 + .../swagger.json | 53 + .../swagger.json | 31 +- .../swagger.json | 6 - .../component-definitions-local/swagger.json | 6 - .../component-multiparam/swagger.json | 12 - .../component-param-inbody/swagger.json | 3 - .../component-param-localremote/swagger.json | 12 - .../component-param-remote/swagger.json | 12 - tests-upgrade/component-param/swagger.json | 12 - .../datamodels-combineschema/readme.md | 10 + .../datamodels-combineschema/swagger.json | 105 ++ .../datamodels-datatypes-anytype/readme.md | 10 + .../datamodels-datatypes-anytype/swagger.json | 58 + .../datamodels-datatypes-array/swagger.json | 3 - .../datamodels-datatypes-file/readme.md | 10 + .../datamodels-datatypes-file/swagger.json | 64 + .../datamodels-datatypes-integer/swagger.json | 9 +- .../swagger.json | 9 +- .../swagger.json | 9 +- .../datamodels-datatypes-object/readme.md | 10 + .../datamodels-datatypes-object/swagger.json | 131 ++ .../datamodels-datatypes-string/swagger.json | 6 - tests-upgrade/datamodels-enums/readme.md | 10 + tests-upgrade/datamodels-enums/swagger.json | 73 + tests-upgrade/sample-swagger.json | 1266 ----------------- 37 files changed, 770 insertions(+), 1397 deletions(-) create mode 100644 tests-upgrade/basic-disableazure-get/readme.md create mode 100644 tests-upgrade/basic-disableazure-get/swagger.json create mode 100644 tests-upgrade/basic-disableazure-response/readme.md create mode 100644 tests-upgrade/basic-disableazure-response/swagger.json create mode 100644 tests-upgrade/basic-response-defaultoperation/readme.md create mode 100644 tests-upgrade/basic-response-defaultoperation/swagger.json create mode 100644 tests-upgrade/datamodels-combineschema/readme.md create mode 100644 tests-upgrade/datamodels-combineschema/swagger.json create mode 100644 tests-upgrade/datamodels-datatypes-anytype/readme.md create mode 100644 tests-upgrade/datamodels-datatypes-anytype/swagger.json create mode 100644 tests-upgrade/datamodels-datatypes-file/readme.md create mode 100644 tests-upgrade/datamodels-datatypes-file/swagger.json create mode 100644 tests-upgrade/datamodels-datatypes-object/readme.md create mode 100644 tests-upgrade/datamodels-datatypes-object/swagger.json create mode 100644 tests-upgrade/datamodels-enums/readme.md create mode 100644 tests-upgrade/datamodels-enums/swagger.json delete mode 100644 tests-upgrade/sample-swagger.json diff --git a/tests-upgrade/.gitignore b/tests-upgrade/.gitignore index dc9b2375c7a..de2a9c8829c 100644 --- a/tests-upgrade/.gitignore +++ b/tests-upgrade/.gitignore @@ -1 +1,2 @@ +generate generated \ No newline at end of file diff --git a/tests-upgrade/AutoRestUpgradeTest.ps1 b/tests-upgrade/AutoRestUpgradeTest.ps1 index e6b2cc46e01..a27559fea34 100644 --- a/tests-upgrade/AutoRestUpgradeTest.ps1 +++ b/tests-upgrade/AutoRestUpgradeTest.ps1 @@ -1,9 +1,10 @@ param([switch]$Generate,[string]$TestName,[switch]$M3,[switch]$M4,[switch]$AllowList,[switch]$BlackList) #need to use the right version of node.js -# nvs use 10.16.0 +#nvs use 10.16.0 # #please use substring to select the compare path # $m3Path='.\generate\m3' # $m4Path='.\generate\m4' +mkdir CompareResult $scriptPath = Get-Location $global:isError = $false $conf = (Get-Content 'Configuration.json') | ConvertFrom-Json @@ -60,6 +61,7 @@ function Generate() autorest-beta --use:@autorest/powershell@2.1.386 --output-folder:.\generate\m3 --Debug ##generate m4 code autorest-beta --use:..\..\ --output-folder:.\generate\m4 --Debug + }elseif($M3) { autorest-beta --use:@autorest/powershell@2.1.386 --output-folder:.\generate\m3 --Debug @@ -80,8 +82,8 @@ function CompareTest([string]$inputm3Path,[string]$inputm4Path,[string]$testFile $initFileList = Get-ChildItem -Recurse -force # $initIgnoreFileList = $inputm3Path + '\generated\modules' # $targetIgnoreFileList = $inputm4Path + '\generated\modules' - $initIgnoreFileList = (($inputm3Path+'\generated\modules'), ($inputm3Path+'\.gitignore')) - $targetIgnoreFileList = (($inputm4Path+'\generated\modules'), ($inputm4Path+'\.gitignore')) + $initIgnoreFileList = (($inputm3Path+'\generated\modules'), ($inputm3Path+'\.gitignore'),($inputm3Path+'\tools\Resources\.gitignore')) + $targetIgnoreFileList = (($inputm4Path+'\generated\modules'), ($inputm4Path+'\.gitignore'),($inputm4Path+'\tools\Resources\.gitignore')) # $initFileList #foreach initFileList and get the hashcode of them foreach( $initFile in $initFileList) @@ -281,4 +283,7 @@ cd $currentPath.Path if($global:isError) { throw 'Error: The code generated by the target file is different from the code generated by the source file.' +}else +{ + Write-Host -ForegroundColor blue 'All generated codes are the same' } diff --git a/tests-upgrade/Configuration.json b/tests-upgrade/Configuration.json index ff193de0224..45cfd08d30f 100644 --- a/tests-upgrade/Configuration.json +++ b/tests-upgrade/Configuration.json @@ -1,3 +1,36 @@ { - "WhiteList":["basic-get","basic-get-delete"] + "WhiteList":[ + "basic-disableazure-get", + "basic-disableazure-response" + ], + "BlackList":[ + "basic-get-querystr", + "basic-get-delete", + "basic-get-delete-put-patch", + "basic-request-methods", + "basic-get-response-operation", + "basic-response-multioperation", + "basic-response-defaultoperation", + "basic-disableazure-get", + "component-param", + "component-multiparam", + "component-param-remote", + "component--param-localremote", + "component-param-inbody", + "component-definitions-local", + "component-definitions-remote", + "component-definitions-combined", + "datamodels-datatypes-mixedtypes", + "datamodels-datatypes-integer", + "datamodels-datatypes-string", + "datamodels-datatypes-nullable", + "datamodels-datatypes-array", + "datamodels-datatypes-object", + "datamodels-datatypes-file", + "datamodels-datatypes-anytype", + "datamodels-enums", + "datamodels-keyvalue", + "datamodels-combineschema", + "datamodels-inheritpolymorphism" + ] } \ No newline at end of file diff --git a/tests-upgrade/basic-disableazure-get/readme.md b/tests-upgrade/basic-disableazure-get/readme.md new file mode 100644 index 00000000000..f64f8c74647 --- /dev/null +++ b/tests-upgrade/basic-disableazure-get/readme.md @@ -0,0 +1,13 @@ +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +require: + - $(this-folder)/../readme.azure.noprofile.md + +azure: false + +input-file: + - $(this-folder)/swagger.json + +``` diff --git a/tests-upgrade/basic-disableazure-get/swagger.json b/tests-upgrade/basic-disableazure-get/swagger.json new file mode 100644 index 00000000000..ec29bdce647 --- /dev/null +++ b/tests-upgrade/basic-disableazure-get/swagger.json @@ -0,0 +1,53 @@ +{ + + "swagger": "2.0", + "info": { + "title": "AutoRestUpgradeClient", + "version": "2018-04-01", + "description": "ARM AutoRestUpgrade" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "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/resourceGroup": { + "get": { + "tags": [ + "Workspaces" + ], + "operationId": "Workspaces_Get", + "description": "Gets the workspace.", + "responses": { + "200": { + "description": "Ok-Return" + } + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/basic-disableazure-response/readme.md b/tests-upgrade/basic-disableazure-response/readme.md new file mode 100644 index 00000000000..f64f8c74647 --- /dev/null +++ b/tests-upgrade/basic-disableazure-response/readme.md @@ -0,0 +1,13 @@ +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +require: + - $(this-folder)/../readme.azure.noprofile.md + +azure: false + +input-file: + - $(this-folder)/swagger.json + +``` diff --git a/tests-upgrade/basic-disableazure-response/swagger.json b/tests-upgrade/basic-disableazure-response/swagger.json new file mode 100644 index 00000000000..4e3ddee1c72 --- /dev/null +++ b/tests-upgrade/basic-disableazure-response/swagger.json @@ -0,0 +1,61 @@ +{ + + "swagger": "2.0", + "info": { + "title": "AutoRestUpgradeClient", + "version": "2018-04-01", + "description": "ARM AutoRestUpgrade" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "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/resourceGroup": { + "get": { + "tags": [ + "Workspaces" + ], + "operationId": "Workspaces_Get", + "description": "Gets the workspace.", + "responses": { + "200": { + "description": "Ok-Return", + "schema": { + "$ref": "#/definitions/Workspaces" + } + } + } + } + } + }, + "definitions": { + "Workspaces": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/tests-upgrade/basic-get-delete-put-patch/swagger.json b/tests-upgrade/basic-get-delete-put-patch/swagger.json index 1e492fbdb81..79ca5c3d604 100644 --- a/tests-upgrade/basic-get-delete-put-patch/swagger.json +++ b/tests-upgrade/basic-get-delete-put-patch/swagger.json @@ -2,9 +2,9 @@ "swagger": "2.0", "info": { - "title": "DatabricksClient", + "title": "AutoRestUpgradeClient", "version": "2018-04-01", - "description": "ARM Databricks" + "description": "ARM AutoRestUpgrade" }, "host": "management.azure.com", "schemes": [ @@ -43,8 +43,8 @@ "operationId": "Workspaces_Get", "description": "Gets the workspace.", "responses": { - "default": { - "description": "Error response describing why the operation failed." + "200": { + "description": "Ok-Return" } } }, @@ -55,8 +55,8 @@ "operationId": "Workspaces_Delete", "description": "Deletes the workspace", "responses": { - "default": { - "description": "Error response describing why the operation failed." + "200": { + "description": "Ok-Return" } } }, @@ -67,8 +67,8 @@ "operationId": "Workspaces_CreateOrUpdate", "description": "Creates a new workspace.", "responses": { - "default": { - "description": "Error response describing why the operation failed." + "200": { + "description": "Ok-Return" } } }, diff --git a/tests-upgrade/basic-get-delete/swagger.json b/tests-upgrade/basic-get-delete/swagger.json index 99515cde797..a5b34b7f0ca 100644 --- a/tests-upgrade/basic-get-delete/swagger.json +++ b/tests-upgrade/basic-get-delete/swagger.json @@ -2,7 +2,7 @@ "swagger": "2.0", "info": { - "title": "DatabricksClient", + "title": "AutoRestUpgradeClient", "version": "2018-04-01", "description": "ARM Databricks" }, @@ -43,8 +43,8 @@ "operationId": "Workspaces_Get", "description": "Gets the workspace.", "responses": { - "default": { - "description": "Error response describing why the operation failed." + "200": { + "description": "Ok-Return" } } }, @@ -55,9 +55,9 @@ "operationId": "Workspaces_Delete", "description": "Delete the workspace.", "responses": { - "default": { - "description": "Error response describing why the operation failed." - } + "200": { + "description": "Ok-Return" + } } } } diff --git a/tests-upgrade/basic-get-response-operation/swagger.json b/tests-upgrade/basic-get-response-operation/swagger.json index 58b0c253858..6ea9ca33bf7 100644 --- a/tests-upgrade/basic-get-response-operation/swagger.json +++ b/tests-upgrade/basic-get-response-operation/swagger.json @@ -46,8 +46,8 @@ "200": { "description": "OK - Returns the workspace." }, - "default": { - "description": "Error response describing why the operation failed." + "201": { + "description": "OK - Returns the workspace." } } } diff --git a/tests-upgrade/basic-get/swagger.json b/tests-upgrade/basic-get/swagger.json index 5480c062852..ec29bdce647 100644 --- a/tests-upgrade/basic-get/swagger.json +++ b/tests-upgrade/basic-get/swagger.json @@ -2,9 +2,9 @@ "swagger": "2.0", "info": { - "title": "DatabricksClient", + "title": "AutoRestUpgradeClient", "version": "2018-04-01", - "description": "ARM Databricks" + "description": "ARM AutoRestUpgrade" }, "host": "management.azure.com", "schemes": [ @@ -43,8 +43,8 @@ "operationId": "Workspaces_Get", "description": "Gets the workspace.", "responses": { - "default": { - "description": "Error response describing why the operation failed." + "200": { + "description": "Ok-Return" } } } diff --git a/tests-upgrade/basic-response-defaultoperation/readme.md b/tests-upgrade/basic-response-defaultoperation/readme.md new file mode 100644 index 00000000000..cd6b9c0ac24 --- /dev/null +++ b/tests-upgrade/basic-response-defaultoperation/readme.md @@ -0,0 +1,10 @@ +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +require: + - $(this-folder)/../readme.azure.noprofile.md +input-file: + - $(this-folder)/swagger.json + +``` diff --git a/tests-upgrade/basic-response-defaultoperation/swagger.json b/tests-upgrade/basic-response-defaultoperation/swagger.json new file mode 100644 index 00000000000..bd560d4df82 --- /dev/null +++ b/tests-upgrade/basic-response-defaultoperation/swagger.json @@ -0,0 +1,53 @@ +{ + + "swagger": "2.0", + "info": { + "title": "AutoRestUpgradeClient", + "version": "2018-04-01", + "description": "ARM AutoRestUpgrade" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "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/resourceGroup": { + "get": { + "tags": [ + "Workspaces" + ], + "operationId": "Workspaces_Get", + "description": "Gets the workspace.", + "responses": { + "default": { + "description": "Error response describing why the operation failed." + } + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/basic-response-multioperation/swagger.json b/tests-upgrade/basic-response-multioperation/swagger.json index 115b3af19eb..d394280a4cf 100644 --- a/tests-upgrade/basic-response-multioperation/swagger.json +++ b/tests-upgrade/basic-response-multioperation/swagger.json @@ -46,8 +46,8 @@ "200": { "description": "OK - Returns the workspace." }, - "default": { - "description": "Error response describing why the operation failed." + "201": { + "description": "OK - Returns the workspace." } } }, @@ -59,10 +59,10 @@ "description": "Deletes the workspace", "responses": { "200": { - "description": "OK - Deleted the workspace." + "description": "OK - Returns the workspace." }, - "default": { - "description": "Error response describing why the operation failed." + "201": { + "description": "OK - Returns the workspace." } } }, @@ -73,12 +73,12 @@ "operationId": "Workspaces_CreateOrUpdate", "description": "Creates a new workspace.", "responses": { - "200": { - "description": "OK - Created or updated the workspace." - }, - "default": { - "description": "Error response describing why the operation failed." - } + "200": { + "description": "OK - Returns the workspace." + }, + "201": { + "description": "OK - Returns the workspace." + } } }, "patch": { @@ -89,13 +89,10 @@ "description": "Updates a workspace.", "responses": { "200": { - "description": "OK - Updated the workspace." - }, - "202": { - "description": "Accepted" + "description": "OK - Returns the workspace." }, - "default": { - "description": "Error response describing why the operation failed." + "201": { + "description": "OK - Returns the workspace." } } } diff --git a/tests-upgrade/component-definitions-combined/swagger.json b/tests-upgrade/component-definitions-combined/swagger.json index 1330299ffdf..74275d3ea50 100644 --- a/tests-upgrade/component-definitions-combined/swagger.json +++ b/tests-upgrade/component-definitions-combined/swagger.json @@ -45,12 +45,6 @@ "responses": { "200": { "description": "OK-Return workspace." - }, - "default": { - "description": "Error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/ExtendedErrorModel" - } } } } diff --git a/tests-upgrade/component-definitions-local/swagger.json b/tests-upgrade/component-definitions-local/swagger.json index 3f8d3819459..abe8d4ae8da 100644 --- a/tests-upgrade/component-definitions-local/swagger.json +++ b/tests-upgrade/component-definitions-local/swagger.json @@ -45,12 +45,6 @@ "responses": { "200": { "description": "OK - Returns an array of workspaces." - }, - "default": { - "description": "Error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } } } } diff --git a/tests-upgrade/component-multiparam/swagger.json b/tests-upgrade/component-multiparam/swagger.json index ce72f5a4f15..65059d19396 100644 --- a/tests-upgrade/component-multiparam/swagger.json +++ b/tests-upgrade/component-multiparam/swagger.json @@ -61,9 +61,6 @@ "responses": { "200": { "description": "OK - Returns the workspace." - }, - "default": { - "description": "Error response describing why the operation failed." } } }, @@ -93,9 +90,6 @@ "responses": { "200": { "description": "OK - Deleted the workspace." - }, - "default": { - "description": "Error response describing why the operation failed." } } }, @@ -125,9 +119,6 @@ "responses": { "200": { "description": "OK - Created or updated the workspace." - }, - "default": { - "description": "Error response describing why the operation failed." } } }, @@ -157,9 +148,6 @@ "responses": { "200": { "description": "OK - Updated the workspace." - }, - "default": { - "description": "Error response describing why the operation failed." } } } diff --git a/tests-upgrade/component-param-inbody/swagger.json b/tests-upgrade/component-param-inbody/swagger.json index 5f514f3db2e..92f69beb418 100644 --- a/tests-upgrade/component-param-inbody/swagger.json +++ b/tests-upgrade/component-param-inbody/swagger.json @@ -67,9 +67,6 @@ "responses": { "200": { "description": "OK - Created or updated the workspace." - }, - "default": { - "description": "Error response describing why the operation failed." } } } diff --git a/tests-upgrade/component-param-localremote/swagger.json b/tests-upgrade/component-param-localremote/swagger.json index 2ee6b92080d..e40621844c2 100644 --- a/tests-upgrade/component-param-localremote/swagger.json +++ b/tests-upgrade/component-param-localremote/swagger.json @@ -62,9 +62,6 @@ "responses": { "200": { "description": "OK - Returns the workspace." - }, - "default": { - "description": "Error response describing why the operation failed." } } }, @@ -95,9 +92,6 @@ "responses": { "200": { "description": "OK - Deleted the workspace." - }, - "default": { - "description": "Error response describing why the operation failed." } } }, @@ -128,9 +122,6 @@ "responses": { "200": { "description": "OK - Created or updated the workspace." - }, - "default": { - "description": "Error response describing why the operation failed." } } }, @@ -161,9 +152,6 @@ "responses": { "200": { "description": "OK - Updated the workspace." - }, - "default": { - "description": "Error response describing why the operation failed." } } } diff --git a/tests-upgrade/component-param-remote/swagger.json b/tests-upgrade/component-param-remote/swagger.json index eed1f4fca06..ad2e13269ca 100644 --- a/tests-upgrade/component-param-remote/swagger.json +++ b/tests-upgrade/component-param-remote/swagger.json @@ -58,9 +58,6 @@ "responses": { "200": { "description": "OK - Returns the workspace." - }, - "default": { - "description": "Error response describing why the operation failed." } } }, @@ -87,9 +84,6 @@ "responses": { "200": { "description": "OK - Deleted the workspace." - }, - "default": { - "description": "Error response describing why the operation failed." } } }, @@ -116,9 +110,6 @@ "responses": { "200": { "description": "OK - Created or updated the workspace." - }, - "default": { - "description": "Error response describing why the operation failed." } } }, @@ -145,9 +136,6 @@ "responses": { "200": { "description": "OK - Updated the workspace." - }, - "default": { - "description": "Error response describing why the operation failed." } } } diff --git a/tests-upgrade/component-param/swagger.json b/tests-upgrade/component-param/swagger.json index 731b8c5688d..f61120bf5bb 100644 --- a/tests-upgrade/component-param/swagger.json +++ b/tests-upgrade/component-param/swagger.json @@ -53,9 +53,6 @@ "responses": { "200": { "description": "OK - Returns the workspace." - }, - "default": { - "description": "Error response describing why the operation failed." } } }, @@ -77,9 +74,6 @@ "responses": { "200": { "description": "OK - Deleted the workspace." - }, - "default": { - "description": "Error response describing why the operation failed." } } }, @@ -101,9 +95,6 @@ "responses": { "200": { "description": "OK - Created or updated the workspace." - }, - "default": { - "description": "Error response describing why the operation failed." } } }, @@ -128,9 +119,6 @@ "responses": { "200": { "description": "OK - Updated the workspace." - }, - "default": { - "description": "Error response describing why the operation failed." } } } diff --git a/tests-upgrade/datamodels-combineschema/readme.md b/tests-upgrade/datamodels-combineschema/readme.md new file mode 100644 index 00000000000..cd6b9c0ac24 --- /dev/null +++ b/tests-upgrade/datamodels-combineschema/readme.md @@ -0,0 +1,10 @@ +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +require: + - $(this-folder)/../readme.azure.noprofile.md +input-file: + - $(this-folder)/swagger.json + +``` diff --git a/tests-upgrade/datamodels-combineschema/swagger.json b/tests-upgrade/datamodels-combineschema/swagger.json new file mode 100644 index 00000000000..9f83a802c31 --- /dev/null +++ b/tests-upgrade/datamodels-combineschema/swagger.json @@ -0,0 +1,105 @@ +{ + + "swagger": "2.0", + "info": { + "title": "DatabricksClient", + "version": "2018-04-01", + "description": "ARM Databricks" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "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": { + "/pets": { + "patch": { + "tags": [ + "pets" + ], + "operationId": "Pets_Update", + "description": "Gets pet list.", + "parameters": [ + { + "name": "pets", + "in": "body", + "required": true, + "description": "The pets update.", + "schema": { + "$ref":"#/definitions/Dog" + } + } + ], + "responses": { + "200": { + "description": "OK-Return workspace." + } + } + } + } + }, + "definitions": { + "Pet": { + "type": "object", + "properties": { + "petType": { + "type": "string" + } + } + }, + "Dog":{ + "type": "object", + "properties": { + "bark": { + "type": "boolean" + }, + "breed": { + "type": "string" + } + } + }, + "Cat": { + "allOf": [ + { + "$ref": "#/definitions/Pet" + + }, + { + "type": "object", + "properties": { + "hunts": { + "type": "boolean" + }, + "age": { + "type": "integer" + } + } + } + ] + + } + } +} \ No newline at end of file diff --git a/tests-upgrade/datamodels-datatypes-anytype/readme.md b/tests-upgrade/datamodels-datatypes-anytype/readme.md new file mode 100644 index 00000000000..cd6b9c0ac24 --- /dev/null +++ b/tests-upgrade/datamodels-datatypes-anytype/readme.md @@ -0,0 +1,10 @@ +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +require: + - $(this-folder)/../readme.azure.noprofile.md +input-file: + - $(this-folder)/swagger.json + +``` diff --git a/tests-upgrade/datamodels-datatypes-anytype/swagger.json b/tests-upgrade/datamodels-datatypes-anytype/swagger.json new file mode 100644 index 00000000000..e5adebe0807 --- /dev/null +++ b/tests-upgrade/datamodels-datatypes-anytype/swagger.json @@ -0,0 +1,58 @@ +{ + + "swagger": "2.0", + "info": { + "title": "DatabricksClient", + "version": "2018-04-01", + "description": "ARM Databricks" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "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/resourceGroup": { + "get": { + "tags": [ + "Workspaces" + ], + "operationId": "Workspaces_Get", + "description": "Gets the workspace.", + "responses": { + "200": { + "description": "OK-Return workspace." + } + } + } + } + }, + "definitions": { + "FilesModel": { + "description": "Can be any value - string, number, boolean, array or object." + } + } +} \ No newline at end of file diff --git a/tests-upgrade/datamodels-datatypes-array/swagger.json b/tests-upgrade/datamodels-datatypes-array/swagger.json index 6e69cbf3baa..d0276ce0819 100644 --- a/tests-upgrade/datamodels-datatypes-array/swagger.json +++ b/tests-upgrade/datamodels-datatypes-array/swagger.json @@ -48,9 +48,6 @@ "schema":{ "$ref": "#/definitions/Workspace" } - }, - "default": { - "description": "Error response describing why the operation failed." } } } diff --git a/tests-upgrade/datamodels-datatypes-file/readme.md b/tests-upgrade/datamodels-datatypes-file/readme.md new file mode 100644 index 00000000000..cd6b9c0ac24 --- /dev/null +++ b/tests-upgrade/datamodels-datatypes-file/readme.md @@ -0,0 +1,10 @@ +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +require: + - $(this-folder)/../readme.azure.noprofile.md +input-file: + - $(this-folder)/swagger.json + +``` diff --git a/tests-upgrade/datamodels-datatypes-file/swagger.json b/tests-upgrade/datamodels-datatypes-file/swagger.json new file mode 100644 index 00000000000..88f1a2f3320 --- /dev/null +++ b/tests-upgrade/datamodels-datatypes-file/swagger.json @@ -0,0 +1,64 @@ +{ + + "swagger": "2.0", + "info": { + "title": "DatabricksClient", + "version": "2018-04-01", + "description": "ARM Databricks" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "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/resourceGroup": { + "get": { + "tags": [ + "Workspaces" + ], + "operationId": "Workspaces_Get", + "description": "Gets the workspace.", + "responses": { + "200": { + "description": "OK-Return workspace." + } + } + } + } + }, + "definitions": { + "FilesModel": { + "type": "object", + "properties": { + "file": { + "type": "string", + "format": "binary" + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/datamodels-datatypes-integer/swagger.json b/tests-upgrade/datamodels-datatypes-integer/swagger.json index a08d8d9e3c8..ba95966f003 100644 --- a/tests-upgrade/datamodels-datatypes-integer/swagger.json +++ b/tests-upgrade/datamodels-datatypes-integer/swagger.json @@ -44,13 +44,10 @@ "description": "Gets the workspace.", "responses": { "200": { - "description": "OK-Return workspace." - }, - "default": { - "description": "Error response describing why the operation failed.", - "schema": { + "description": "OK-Return workspace.", + "schema": { "$ref": "#/definitions/BasicErrorModel" - } + } } } } diff --git a/tests-upgrade/datamodels-datatypes-mixedtypes/swagger.json b/tests-upgrade/datamodels-datatypes-mixedtypes/swagger.json index a9dca898e4e..2bc5d4658a2 100644 --- a/tests-upgrade/datamodels-datatypes-mixedtypes/swagger.json +++ b/tests-upgrade/datamodels-datatypes-mixedtypes/swagger.json @@ -44,13 +44,10 @@ "description": "Gets the workspace.", "responses": { "200": { - "description": "OK-Return workspace." - }, - "default": { - "description": "Error response describing why the operation failed.", - "schema": { + "description": "OK-Return workspace.", + "schema": { "$ref": "#/definitions/BasicErrorModel" - } + } } } } diff --git a/tests-upgrade/datamodels-datatypes-nullable/swagger.json b/tests-upgrade/datamodels-datatypes-nullable/swagger.json index e3832914d01..1c302ab5180 100644 --- a/tests-upgrade/datamodels-datatypes-nullable/swagger.json +++ b/tests-upgrade/datamodels-datatypes-nullable/swagger.json @@ -44,13 +44,10 @@ "description": "Gets the workspace.", "responses": { "200": { - "description": "OK-Return workspace." - }, - "default": { - "description": "Error response describing why the operation failed.", - "schema": { + "description": "OK-Return workspace.", + "schema": { "$ref": "#/definitions/BasicErrorModel" - } + } } } } diff --git a/tests-upgrade/datamodels-datatypes-object/readme.md b/tests-upgrade/datamodels-datatypes-object/readme.md new file mode 100644 index 00000000000..cd6b9c0ac24 --- /dev/null +++ b/tests-upgrade/datamodels-datatypes-object/readme.md @@ -0,0 +1,10 @@ +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +require: + - $(this-folder)/../readme.azure.noprofile.md +input-file: + - $(this-folder)/swagger.json + +``` diff --git a/tests-upgrade/datamodels-datatypes-object/swagger.json b/tests-upgrade/datamodels-datatypes-object/swagger.json new file mode 100644 index 00000000000..b82571a6750 --- /dev/null +++ b/tests-upgrade/datamodels-datatypes-object/swagger.json @@ -0,0 +1,131 @@ +{ + + "swagger": "2.0", + "info": { + "title": "DatabricksClient", + "version": "2018-04-01", + "description": "ARM Databricks" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "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/resourceGroup": { + "get": { + "tags": [ + "Workspaces" + ], + "operationId": "Workspaces_Get", + "description": "Gets the workspace.", + "responses": { + "200": { + "description": "OK-Return workspace." + } + } + } + } + }, + "definitions": { + "Model": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "code": { + "type": "integer" + } + } + }, + "Model2": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "username": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "required": [ + "id", + "username" + ] + }, + "Model3": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "readOnly": true + }, + "password": { + "type": "string" + } + }, + "required": [ + "id", + "username" + ] + }, + "ContactInfo": { + "type": "object", + "properties": { + "email": { + "type": "string", + "format": "email" + }, + "phone": { + "type": "string" + } + } + }, + "User": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "contact_info": { + "$ref": "#/definitions/ContactInfo" + } + } + }, + "Model4": { + "type": "object", + "minProperties": 2, + "maxProperties": 10 + } + } +} \ No newline at end of file diff --git a/tests-upgrade/datamodels-datatypes-string/swagger.json b/tests-upgrade/datamodels-datatypes-string/swagger.json index f1f9d58cb9d..67c6bf4fc54 100644 --- a/tests-upgrade/datamodels-datatypes-string/swagger.json +++ b/tests-upgrade/datamodels-datatypes-string/swagger.json @@ -45,12 +45,6 @@ "responses": { "200": { "description": "OK-Return workspace." - }, - "default": { - "description": "Error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/BasicErrorModel" - } } } } diff --git a/tests-upgrade/datamodels-enums/readme.md b/tests-upgrade/datamodels-enums/readme.md new file mode 100644 index 00000000000..cd6b9c0ac24 --- /dev/null +++ b/tests-upgrade/datamodels-enums/readme.md @@ -0,0 +1,10 @@ +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +require: + - $(this-folder)/../readme.azure.noprofile.md +input-file: + - $(this-folder)/swagger.json + +``` diff --git a/tests-upgrade/datamodels-enums/swagger.json b/tests-upgrade/datamodels-enums/swagger.json new file mode 100644 index 00000000000..efa7111df69 --- /dev/null +++ b/tests-upgrade/datamodels-enums/swagger.json @@ -0,0 +1,73 @@ +{ + + "swagger": "2.0", + "info": { + "title": "DatabricksClient", + "version": "2018-04-01", + "description": "ARM Databricks" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "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/resourceGroup/{resourceGroup}": { + "get": { + "tags": [ + "Workspaces" + ], + "operationId": "Workspaces_Get", + "description": "Gets the workspace.", + "parameters": [ + { + "$ref": "#/parameters/ResourceGroupName" + } + ], + "responses": { + "200": { + "description": "OK-Return workspace." + } + } + } + } + }, + "parameters": { + "ResourceGroupName":{ + "in": "path", + "name": "resourceGroup", + "description": "Resource group name", + "required": true, + "schema": { + "type": "string", + "enum": [ + "azure cloud", + "azure prod" + ] + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/sample-swagger.json b/tests-upgrade/sample-swagger.json deleted file mode 100644 index 8db4896d3dd..00000000000 --- a/tests-upgrade/sample-swagger.json +++ /dev/null @@ -1,1266 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "title": "DatabricksClient", - "version": "2018-04-01", - "description": "ARM Databricks" - }, - "host": "management.azure.com", - "schemes": [ - "https" - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "security": [ - { - "azure_auth": [ - "user_impersonation" - ] - } - ], - "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.Databricks/workspaces/{workspaceName}": { - "get": { - "tags": [ - "Workspaces" - ], - "operationId": "Workspaces_Get", - "description": "Gets the workspace.", - "x-ms-examples": { - "Get a workspace": { - "$ref": "./examples/WorkspaceGet.json" - }, - "Get a workspace with custom parameters": { - "$ref": "./examples/WorkspaceGetParameters.json" - } - }, - "parameters": [ - { - "$ref": "#/parameters/ResourceGroupName" - }, - { - "$ref": "#/parameters/WorkspaceName" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/SubscriptionIdParameter" - } - ], - "responses": { - "200": { - "description": "OK - Returns the workspace.", - "schema": { - "$ref": "#/definitions/Workspace" - } - }, - "default": { - "description": "Error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } - } - } - }, - "delete": { - "tags": [ - "Workspaces" - ], - "operationId": "Workspaces_Delete", - "description": "Deletes the workspace.", - "x-ms-examples": { - "Delete a workspace": { - "$ref": "./examples/WorkspaceDelete.json" - } - }, - "parameters": [ - { - "$ref": "#/parameters/ResourceGroupName" - }, - { - "$ref": "#/parameters/WorkspaceName" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/SubscriptionIdParameter" - } - ], - "responses": { - "204": { - "description": "NoContent" - }, - "202": { - "description": "Accepted - Returns this status until the asynchronous operation has completed." - }, - "200": { - "description": "OK. The request has succeeded." - }, - "default": { - "description": "Error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } - } - }, - "x-ms-long-running-operation": true - }, - "put": { - "tags": [ - "Workspaces" - ], - "operationId": "Workspaces_CreateOrUpdate", - "description": "Creates a new workspace.", - "x-ms-examples": { - "Create or update workspace": { - "$ref": "./examples/WorkspaceCreate.json" - }, - "Create or update workspace with custom parameters": { - "$ref": "./examples/WorkspaceCreateWithParameters.json" - }, - "Create a workspace which is ready for Customer-Managed Key (CMK) encryption": { - "$ref": "./examples/PrepareEncryption.json" - }, - "Enable Customer-Managed Key (CMK) encryption on a workspace which is prepared for encryption": { - "$ref": "./examples/EnableEncryption.json" - }, - "Revert Customer-Managed Key (CMK) encryption to Microsoft Managed Keys encryption on a workspace": { - "$ref": "./examples/DisableEncryption.json" - } - }, - "parameters": [ - { - "name": "parameters", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/Workspace" - }, - "description": "Parameters supplied to the create or update a workspace." - }, - { - "$ref": "#/parameters/ResourceGroupName" - }, - { - "$ref": "#/parameters/WorkspaceName" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/SubscriptionIdParameter" - } - ], - "responses": { - "200": { - "description": "Created - Returns information about the workspace, including provisioning status.", - "schema": { - "$ref": "#/definitions/Workspace" - } - }, - "201": { - "description": "Created - Returns information about the workspace, including provisioning status.", - "schema": { - "$ref": "#/definitions/Workspace" - } - }, - "default": { - "description": "Error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } - } - }, - "x-ms-long-running-operation": true - }, - "patch": { - "tags": [ - "Workspaces" - ], - "operationId": "Workspaces_Update", - "description": "Updates a workspace.", - "parameters": [ - { - "name": "parameters", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/WorkspaceUpdate" - }, - "description": "The update to the workspace." - }, - { - "$ref": "#/parameters/ResourceGroupName" - }, - { - "$ref": "#/parameters/WorkspaceName" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/SubscriptionIdParameter" - } - ], - "responses": { - "200": { - "description": "Successfully updated the workspace.", - "schema": { - "$ref": "#/definitions/Workspace" - } - }, - "default": { - "description": "Error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } - }, - "202": { - "description": "Accepted" - } - }, - "x-ms-long-running-operation": true, - "x-ms-examples": { - "Update a workspace's tags.": { - "$ref": "./examples/WorkspaceUpdate.json" - } - } - } - }, - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces": { - "get": { - "tags": [ - "Workspaces" - ], - "operationId": "Workspaces_ListByResourceGroup", - "description": "Gets all the workspaces within a resource group.", - "x-ms-examples": { - "Lists workspaces": { - "$ref": "./examples/WorkspacesListByResourceGroup.json" - } - }, - "parameters": [ - { - "$ref": "#/parameters/ResourceGroupName" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/SubscriptionIdParameter" - } - ], - "responses": { - "200": { - "description": "OK - Returns an array of workspaces.", - "schema": { - "$ref": "#/definitions/WorkspaceListResult" - } - }, - "default": { - "description": "Error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } - } - }, - "x-ms-pageable": { - "nextLinkName": "nextLink" - } - } - }, - "/subscriptions/{subscriptionId}/providers/Microsoft.Databricks/workspaces": { - "get": { - "tags": [ - "Workspaces" - ], - "operationId": "Workspaces_ListBySubscription", - "description": "Gets all the workspaces within a subscription.", - "x-ms-examples": { - "Lists workspaces": { - "$ref": "./examples/WorkspacesListBySubscription.json" - } - }, - "parameters": [ - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/SubscriptionIdParameter" - } - ], - "responses": { - "200": { - "description": "OK - Returns an array of workspaces.", - "schema": { - "$ref": "#/definitions/WorkspaceListResult" - } - }, - "default": { - "description": "Error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } - } - }, - "x-ms-pageable": { - "nextLinkName": "nextLink" - } - } - }, - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/virtualNetworkPeerings/{peeringName}": { - "get": { - "tags": [ - "vNetPeering" - ], - "operationId": "vNetPeering_Get", - "description": "Gets the workspace vNet Peering.", - "x-ms-examples": { - "Get a workspace with vNet Peering Configured": { - "$ref": "./examples/WorkspaceVirtualNetPeeringGet.json" - } - }, - "parameters": [ - { - "$ref": "#/parameters/ResourceGroupName" - }, - { - "$ref": "#/parameters/WorkspaceName" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/SubscriptionIdParameter" - }, - { - "$ref": "#/parameters/PeeringNameParameter" - } - ], - "responses": { - "200": { - "description": "OK. The request has succeeded.", - "schema": { - "$ref": "#/definitions/VirtualNetworkPeering" - } - }, - "204": { - "description": "OK - NoContent" - }, - "default": { - "description": "Error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } - } - } - }, - "delete": { - "tags": [ - "vNetPeering" - ], - "operationId": "vNetPeering_Delete", - "description": "Deletes the workspace vNetPeering.", - "x-ms-examples": { - "Delete a workspace vNet Peering": { - "$ref": "./examples/WorkspaceVirtualNetworkPeeringDelete.json" - } - }, - "parameters": [ - { - "$ref": "#/parameters/ResourceGroupName" - }, - { - "$ref": "#/parameters/WorkspaceName" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/SubscriptionIdParameter" - }, - { - "$ref": "#/parameters/PeeringNameParameter" - } - ], - "responses": { - "202": { - "description": "Accepted - Returns this status until the asynchronous operation has completed." - }, - "204": { - "description": "NoContent" - }, - "200": { - "description": "OK. The request has succeeded." - }, - "default": { - "description": "Error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } - } - }, - "x-ms-long-running-operation": true - }, - "put": { - "tags": [ - "vNetPeering" - ], - "operationId": "vNetPeering_CreateOrUpdate", - "description": "Creates vNet Peering for workspace.", - "x-ms-examples": { - "Create vNet Peering for Workspace": { - "$ref": "./examples/WorkspaceVirtualNetworkPeeringCreateOrUpdate.json" - } - }, - "parameters": [ - { - "name": "VirtualNetworkPeeringParameters", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/VirtualNetworkPeering" - }, - "description": "Parameters supplied to the create workspace vNet Peering." - }, - { - "$ref": "#/parameters/ResourceGroupName" - }, - { - "$ref": "#/parameters/WorkspaceName" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/SubscriptionIdParameter" - }, - { - "$ref": "#/parameters/PeeringNameParameter" - } - ], - "responses": { - "201": { - "description": "Created - Returns information about the workspace vNet peering, including provisioning status.", - "schema": { - "$ref": "#/definitions/VirtualNetworkPeering" - } - }, - "200": { - "description": "Update succeeded - Returns information about the workspace vNet peering.", - "schema": { - "$ref": "#/definitions/VirtualNetworkPeering" - } - }, - "default": { - "description": "Error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } - } - }, - "x-ms-long-running-operation": true - } - }, - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/virtualNetworkPeerings": { - "get": { - "tags": [ - "vNetPeering" - ], - "operationId": "vNetPeering_ListByWorkspace", - "description": "Lists the workspace vNet Peerings.", - "x-ms-examples": { - "List all vNet Peerings for the workspace": { - "$ref": "./examples/WorkspaceVirtualNetPeeringList.json" - } - }, - "parameters": [ - { - "$ref": "#/parameters/ResourceGroupName" - }, - { - "$ref": "#/parameters/WorkspaceName" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/SubscriptionIdParameter" - } - ], - "responses": { - "200": { - "description": "List succeeded. Returns the resulting resource objects in response body.", - "schema": { - "$ref": "#/definitions/VirtualNetworkPeeringList" - } - }, - "default": { - "description": "Error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } - } - }, - "x-ms-pageable": { - "nextLinkName": "nextLink" - } - } - }, - "/providers/Microsoft.Databricks/operations": { - "get": { - "tags": [ - "Operations" - ], - "description": "Lists all of the available RP operations.", - "x-ms-examples": { - "Operations": { - "$ref": "./examples/OperationsList.json" - } - }, - "operationId": "Operations_List", - "parameters": [ - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "OK. The request has succeeded.", - "schema": { - "$ref": "#/definitions/OperationListResult" - } - }, - "default": { - "description": "Resource Provider error response describing why the operation failed.", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } - } - }, - "x-ms-pageable": { - "nextLinkName": "nextLink" - } - } - } - }, - "definitions": { - "Workspace": { - "properties": { - "properties": { - "x-ms-client-flatten": true, - "$ref": "#/definitions/WorkspaceProperties", - "description": "The workspace properties." - }, - "sku": { - "$ref": "#/definitions/Sku", - "description": "The SKU of the resource." - } - }, - "required": [ - "properties" - ], - "allOf": [ - { - "$ref": "#/definitions/TrackedResource" - } - ], - "description": "Information about workspace." - }, - "WorkspaceProperties": { - "properties": { - "managedResourceGroupId": { - "type": "string", - "description": "The managed resource group Id." - }, - "parameters": { - "$ref": "#/definitions/WorkspaceCustomParameters", - "description": "The workspace's custom parameters." - }, - "provisioningState": { - "readOnly": true, - "$ref": "#/definitions/ProvisioningState", - "description": "The workspace provisioning state." - }, - "uiDefinitionUri": { - "type": "string", - "description": "The blob URI where the UI definition file is located." - }, - "authorizations": { - "description": "The workspace provider authorizations.", - "type": "array", - "items": { - "$ref": "#/definitions/WorkspaceProviderAuthorization" - } - }, - "createdBy": { - "description": "Indicates the Object ID, PUID and Application ID of entity that created the workspace.", - "$ref": "#/definitions/CreatedBy" - }, - "updatedBy": { - "description": "Indicates the Object ID, PUID and Application ID of entity that last updated the workspace.", - "$ref": "#/definitions/CreatedBy" - }, - "createdDateTime": { - "description": "Specifies the date and time when the workspace is created.", - "$ref": "#/definitions/CreatedDateTime" - }, - "workspaceId": { - "readOnly": true, - "description": "The unique identifier of the databricks workspace in databricks control plane.", - "type": "string" - }, - "workspaceUrl": { - "readOnly": true, - "description": "The workspace URL which is of the format 'adb-{workspaceId}.{random}.azuredatabricks.net'", - "type": "string" - }, - "storageAccountIdentity": { - "description": "The details of Managed Identity of Storage Account", - "$ref": "#/definitions/ManagedIdentityConfiguration" - } - }, - "required": [ - "managedResourceGroupId" - ], - "description": "The workspace properties." - }, - "TrackedResource": { - "description": "The resource model definition for a ARM tracked top level resource", - "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" - } - ] - }, - "Resource": { - "description": "The core properties of ARM resources", - "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. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts." - } - }, - "x-ms-azure-resource": true - }, - "Sku": { - "properties": { - "name": { - "type": "string", - "description": "The SKU name." - }, - "tier": { - "type": "string", - "description": "The SKU tier." - } - }, - "required": [ - "name" - ], - "description": "SKU for the resource." - }, - "ProvisioningState": { - "description": "Provisioning status of the workspace.", - "readOnly": true, - "enum": [ - "Accepted", - "Running", - "Ready", - "Creating", - "Created", - "Deleting", - "Deleted", - "Canceled", - "Failed", - "Succeeded", - "Updating" - ], - "type": "string", - "x-ms-enum": { - "name": "ProvisioningState", - "modelAsString": true - } - }, - "PeeringProvisioningState": { - "type": "string", - "readOnly": true, - "description": "The current provisioning state.", - "enum": [ - "Succeeded", - "Updating", - "Deleting", - "Failed" - ], - "x-ms-enum": { - "name": "PeeringProvisioningState", - "modelAsString": true - } - }, - "ManagedIdentityConfiguration": { - "description": "The Managed Identity details for storage account.", - "properties": { - "principalId": { - "type": "string", - "format": "uuid", - "description": "The objectId of the Managed Identity that is linked to the Managed Storage account.", - "readOnly": true - }, - "tenantId": { - "type": "string", - "format": "uuid", - "description": "The tenant Id where the Managed Identity is created.", - "readOnly": true - }, - "type": { - "type": "string", - "description": "The type of Identity created. It can be either SystemAssigned or UserAssigned.", - "readOnly": true - } - } - }, - "WorkspaceCustomParameterType": { - "description": "Provisioning status of the workspace.", - "readOnly": true, - "enum": [ - "Bool", - "Object", - "String" - ], - "type": "string", - "x-ms-enum": { - "name": "CustomParameterType", - "modelAsString": true - } - }, - "WorkspaceCustomBooleanParameter": { - "properties": { - "type": { - "$ref": "#/definitions/WorkspaceCustomParameterType", - "description": "The type of variable that this is" - }, - "value": { - "type": "boolean", - "description": "The value which should be used for this field." - } - }, - "required": [ - "value" - ], - "description": "The value which should be used for this field." - }, - "WorkspaceCustomObjectParameter": { - "properties": { - "type": { - "$ref": "#/definitions/WorkspaceCustomParameterType", - "description": "The type of variable that this is" - }, - "value": { - "type": "object", - "description": "The value which should be used for this field." - } - }, - "required": [ - "value" - ], - "description": "The value which should be used for this field." - }, - "WorkspaceCustomStringParameter": { - "properties": { - "type": { - "$ref": "#/definitions/WorkspaceCustomParameterType", - "description": "The type of variable that this is" - }, - "value": { - "type": "string", - "description": "The value which should be used for this field." - } - }, - "required": [ - "value" - ], - "description": "The Value." - }, - "WorkspaceCustomParameters": { - "properties": { - "customVirtualNetworkId": { - "$ref": "#/definitions/WorkspaceCustomStringParameter", - "description": "The ID of a Virtual Network where this Databricks Cluster should be created" - }, - "customPublicSubnetName": { - "$ref": "#/definitions/WorkspaceCustomStringParameter", - "description": "The name of a Public Subnet within the Virtual Network" - }, - "customPrivateSubnetName": { - "$ref": "#/definitions/WorkspaceCustomStringParameter", - "description": "The name of the Private Subnet within the Virtual Network" - }, - "enableNoPublicIp": { - "$ref": "#/definitions/WorkspaceCustomBooleanParameter", - "description": "Should the Public IP be Disabled?" - }, - "prepareEncryption": { - "$ref": "#/definitions/WorkspaceCustomBooleanParameter", - "description": "Prepare the workspace for encryption. Enables the Managed Identity for managed storage account." - }, - "encryption": { - "$ref": "#/definitions/WorkspaceEncryptionParameter", - "description": "Contains the encryption details for Customer-Managed Key (CMK) enabled workspace." - } - }, - "description": "Custom Parameters used for Cluster Creation." - }, - "CreatedDateTime": { - "type": "string", - "format": "date-time", - "description": "The date and time stamp when the workspace was created.", - "readOnly": true - }, - "CreatedBy": { - "properties": { - "oid": { - "type": "string", - "format": "uuid", - "description": "The Object ID that created the workspace.", - "readOnly": true - }, - "puid": { - "type": "string", - "description": "The Personal Object ID corresponding to the object ID above", - "readOnly": true - }, - "applicationId": { - "type": "string", - "format": "uuid", - "description": "The application ID of the application that initiated the creation of the workspace. For example, Azure Portal.", - "readOnly": true - } - }, - "description": "Provides details of the entity that created/updated the workspace." - }, - "WorkspaceEncryptionParameter": { - "properties": { - "type": { - "$ref": "#/definitions/WorkspaceCustomParameterType", - "description": "The type of variable that this is" - }, - "value": { - "$ref": "#/definitions/Encryption", - "description": "The value which should be used for this field." - } - }, - "description": "The object that contains details of encryption used on the workspace." - }, - "Encryption": { - "properties": { - "keySource": { - "type": "string", - "description": "The encryption keySource (provider). Possible values (case-insensitive): Default, Microsoft.Keyvault", - "enum": [ - "Default", - "Microsoft.Keyvault" - ], - "x-ms-enum": { - "name": "KeySource", - "modelAsString": true - }, - "default": "Default" - }, - "KeyName": { - "type": "string", - "description": "The name of KeyVault key." - }, - "keyversion": { - "type": "string", - "description": "The version of KeyVault key.", - "x-ms-client-name": "KeyVersion" - }, - "keyvaulturi": { - "type": "string", - "description": "The Uri of KeyVault.", - "x-ms-client-name": "KeyVaultUri" - } - }, - "description": "The object that contains details of encryption used on the workspace." - }, - "WorkspaceProviderAuthorization": { - "properties": { - "principalId": { - "type": "string", - "format": "uuid", - "description": "The provider's principal identifier. This is the identity that the provider will use to call ARM to manage the workspace resources." - }, - "roleDefinitionId": { - "type": "string", - "format": "uuid", - "description": "The provider's role definition identifier. This role will define all the permissions that the provider must have on the workspace's container resource group. This role definition cannot have permission to delete the resource group." - } - }, - "required": [ - "principalId", - "roleDefinitionId" - ], - "description": "The workspace provider authorization." - }, - "WorkspaceUpdate": { - "description": "An update to a workspace.", - "type": "object", - "properties": { - "tags": { - "description": "Resource tags.", - "type": "object", - "additionalProperties": { - "type": "string" - } - } - } - }, - "ErrorDetail": { - "title": "Error details.", - "type": "object", - "properties": { - "code": { - "description": "The error's code.", - "type": "string" - }, - "message": { - "description": "A human readable error message.", - "type": "string" - }, - "target": { - "description": "Indicates which property in the request is responsible for the error.", - "type": "string" - } - }, - "required": [ - "code", - "message" - ] - }, - "ErrorInfo": { - "title": "The code and message for an error.", - "type": "object", - "properties": { - "code": { - "description": "A machine readable error code.", - "type": "string" - }, - "message": { - "description": "A human readable error message.", - "type": "string" - }, - "details": { - "description": "error details.", - "type": "array", - "items": { - "$ref": "#/definitions/ErrorDetail" - } - }, - "innererror": { - "description": "Inner error details if they exist.", - "type": "string" - } - }, - "required": [ - "code", - "message" - ] - }, - "ErrorResponse": { - "title": "Error response.", - "description": "Contains details when the response code indicates an error.", - "type": "object", - "properties": { - "error": { - "description": "The error details.", - "$ref": "#/definitions/ErrorInfo" - } - }, - "required": [ - "error" - ] - }, - "WorkspaceListResult": { - "properties": { - "value": { - "type": "array", - "items": { - "$ref": "#/definitions/Workspace" - }, - "description": "The array of workspaces." - }, - "nextLink": { - "type": "string", - "description": "The URL to use for getting the next set of results." - } - }, - "description": "List of workspaces." - }, - "Operation": { - "description": "REST API operation", - "type": "object", - "properties": { - "name": { - "description": "Operation name: {provider}/{resource}/{operation}", - "type": "string" - }, - "display": { - "description": "The object that represents the operation.", - "properties": { - "provider": { - "description": "Service provider: Microsoft.ResourceProvider", - "type": "string" - }, - "resource": { - "description": "Resource on which the operation is performed.", - "type": "string" - }, - "operation": { - "description": "Operation type: Read, write, delete, etc.", - "type": "string" - } - } - } - } - }, - "OperationListResult": { - "description": "Result of the request to list Resource Provider operations. It contains a list of operations and a URL link to get the next set of results.", - "properties": { - "value": { - "type": "array", - "items": { - "$ref": "#/definitions/Operation" - }, - "description": "List of Resource Provider operations supported by the Resource Provider resource provider." - }, - "nextLink": { - "type": "string", - "description": "URL to get the next set of operation list results if there are any." - } - } - }, - "VirtualNetworkPeeringList": { - "properties": { - "value": { - "type": "array", - "items": { - "$ref": "#/definitions/VirtualNetworkPeering" - }, - "description": "List of virtual network peerings on workspace." - }, - "nextLink": { - "type": "string", - "description": "URL to get the next set of virtual network peering list results if there are any." - } - }, - "description": "Gets all virtual network peerings under a workspace." - }, - "VirtualNetworkPeering": { - "properties": { - "properties": { - "x-ms-client-flatten": true, - "$ref": "#/definitions/VirtualNetworkPeeringPropertiesFormat", - "description": "List of properties for vNet Peering" - }, - "name": { - "type": "string", - "description": "Name of the virtual network peering resource", - "readOnly": true - }, - "id": { - "type": "string", - "description": "Resource ID.", - "readOnly": true - }, - "type": { - "type": "string", - "description": "type of the virtual network peering resource", - "readOnly": true - } - }, - "required": [ - "properties" - ], - "description": "Peerings in a VirtualNetwork resource", - "x-ms-azure-resource": true - }, - "VirtualNetworkPeeringPropertiesFormat": { - "properties": { - "allowVirtualNetworkAccess": { - "type": "boolean", - "description": "Whether the VMs in the local virtual network space would be able to access the VMs in remote virtual network space." - }, - "allowForwardedTraffic": { - "type": "boolean", - "description": "Whether the forwarded traffic from the VMs in the local virtual network will be allowed/disallowed in remote virtual network." - }, - "allowGatewayTransit": { - "type": "boolean", - "description": "If gateway links can be used in remote virtual networking to link to this virtual network." - }, - "useRemoteGateways": { - "type": "boolean", - "description": "If remote gateways can be used on this virtual network. If the flag is set to true, and allowGatewayTransit on remote peering is also true, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set to true. This flag cannot be set if virtual network already has a gateway." - }, - "databricksVirtualNetwork": { - "properties": { - "id": { - "type": "string", - "description": "The Id of the databricks virtual network." - } - }, - "description": " The remote virtual network should be in the same region. See here to learn more (https://docs.microsoft.com/en-us/azure/databricks/administration-guide/cloud-configurations/azure/vnet-peering)." - }, - "databricksAddressSpace": { - "$ref": "#/definitions/AddressSpace", - "description": "The reference to the databricks virtual network address space." - }, - "remoteVirtualNetwork": { - "properties": { - "id": { - "type": "string", - "description": "The Id of the remote virtual network." - } - }, - "description": " The remote virtual network should be in the same region. See here to learn more (https://docs.microsoft.com/en-us/azure/databricks/administration-guide/cloud-configurations/azure/vnet-peering)." - }, - "remoteAddressSpace": { - "$ref": "#/definitions/AddressSpace", - "description": "The reference to the remote virtual network address space." - }, - "peeringState": { - "type": "string", - "description": "The status of the virtual network peering.", - "enum": [ - "Initiated", - "Connected", - "Disconnected" - ], - "x-ms-enum": { - "name": "peeringState", - "modelAsString": true - }, - "readOnly": true - }, - "provisioningState": { - "readOnly": true, - "$ref": "#/definitions/PeeringProvisioningState", - "description": "The provisioning state of the virtual network peering resource." - } - }, - "required": [ - "remoteVirtualNetwork" - ], - "description": "Properties of the virtual network peering." - }, - "AddressSpace": { - "properties": { - "addressPrefixes": { - "type": "array", - "items": { - "type": "string" - }, - "description": "A list of address blocks reserved for this virtual network in CIDR notation." - } - }, - "description": "AddressSpace contains an array of IP address ranges that can be used by subnets of the virtual network." - } - }, - "parameters": { - "SubscriptionIdParameter": { - "name": "subscriptionId", - "in": "path", - "required": true, - "type": "string", - "description": "The ID of the target subscription." - }, - "ApiVersionParameter": { - "name": "api-version", - "in": "query", - "required": true, - "type": "string", - "description": "The API version to use for this operation." - }, - "ResourceGroupName": { - "name": "resourceGroupName", - "in": "path", - "required": true, - "type": "string", - "description": "The name of the resource group. The name is case insensitive.", - "pattern": "^[-\\w\\._\\(\\)]+$", - "minLength": 1, - "maxLength": 90, - "x-ms-parameter-location": "method" - }, - "WorkspaceName": { - "name": "workspaceName", - "in": "path", - "required": true, - "type": "string", - "description": "The name of the workspace.", - "minLength": 3, - "maxLength": 64, - "x-ms-parameter-location": "method" - }, - "PeeringNameParameter": { - "name": "peeringName", - "in": "path", - "required": true, - "type": "string", - "description": "The name of the workspace vNet peering.", - "x-ms-parameter-location": "method" - } - } - } \ No newline at end of file From 2a1838e10ee1768da68e7cbec9963c1f72b52b24 Mon Sep 17 00:00:00 2001 From: dingmeng-xue Date: Mon, 20 Jul 2020 18:07:49 +0800 Subject: [PATCH 6/8] Add save artifacts task --- .azure-pipelines/test-module-upgrade.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.azure-pipelines/test-module-upgrade.yml b/.azure-pipelines/test-module-upgrade.yml index 58548f2ec39..e128344281b 100644 --- a/.azure-pipelines/test-module-upgrade.yml +++ b/.azure-pipelines/test-module-upgrade.yml @@ -43,4 +43,11 @@ steps: targetType: inline script: './AutoRestUpgradeTest.ps1 -AllowList' workingDirectory: 'tests-upgrade' - failOnStderr: true \ No newline at end of file + failOnStderr: true + +- task: PublishPipelineArtifact@0 + displayName: 'Save artifacts' + inputs: + artifactName: CompareResult + targetPath: tests-upgrade\CompareResult + condition: succeededOrFailed() \ No newline at end of file From 951847aa883b10dfb15e69112a34573776101787 Mon Sep 17 00:00:00 2001 From: Youri Date: Wed, 22 Jul 2020 14:30:09 +0800 Subject: [PATCH 7/8] Revert "Enable AutoRestUpgradeTest.ps1." This reverts commit 66c750d8fa1db81803c3626d97e1d71a8989b107. --- tests-upgrade/.gitignore | 1 - tests-upgrade/AutoRestUpgradeTest.ps1 | 11 +- tests-upgrade/Configuration.json | 35 +- .../basic-disableazure-get/readme.md | 13 - .../basic-disableazure-get/swagger.json | 53 - .../basic-disableazure-response/readme.md | 13 - .../basic-disableazure-response/swagger.json | 61 - .../basic-get-delete-put-patch/swagger.json | 16 +- tests-upgrade/basic-get-delete/swagger.json | 12 +- .../basic-get-response-operation/swagger.json | 4 +- tests-upgrade/basic-get/swagger.json | 8 +- .../basic-response-defaultoperation/readme.md | 10 - .../swagger.json | 53 - .../swagger.json | 31 +- .../swagger.json | 6 + .../component-definitions-local/swagger.json | 6 + .../component-multiparam/swagger.json | 12 + .../component-param-inbody/swagger.json | 3 + .../component-param-localremote/swagger.json | 12 + .../component-param-remote/swagger.json | 12 + tests-upgrade/component-param/swagger.json | 12 + .../datamodels-combineschema/readme.md | 10 - .../datamodels-combineschema/swagger.json | 105 -- .../datamodels-datatypes-anytype/readme.md | 10 - .../datamodels-datatypes-anytype/swagger.json | 58 - .../datamodels-datatypes-array/swagger.json | 3 + .../datamodels-datatypes-file/readme.md | 10 - .../datamodels-datatypes-file/swagger.json | 64 - .../datamodels-datatypes-integer/swagger.json | 9 +- .../swagger.json | 9 +- .../swagger.json | 9 +- .../datamodels-datatypes-object/readme.md | 10 - .../datamodels-datatypes-object/swagger.json | 131 -- .../datamodels-datatypes-string/swagger.json | 6 + tests-upgrade/datamodels-enums/readme.md | 10 - tests-upgrade/datamodels-enums/swagger.json | 73 - tests-upgrade/sample-swagger.json | 1266 +++++++++++++++++ 37 files changed, 1397 insertions(+), 770 deletions(-) delete mode 100644 tests-upgrade/basic-disableazure-get/readme.md delete mode 100644 tests-upgrade/basic-disableazure-get/swagger.json delete mode 100644 tests-upgrade/basic-disableazure-response/readme.md delete mode 100644 tests-upgrade/basic-disableazure-response/swagger.json delete mode 100644 tests-upgrade/basic-response-defaultoperation/readme.md delete mode 100644 tests-upgrade/basic-response-defaultoperation/swagger.json delete mode 100644 tests-upgrade/datamodels-combineschema/readme.md delete mode 100644 tests-upgrade/datamodels-combineschema/swagger.json delete mode 100644 tests-upgrade/datamodels-datatypes-anytype/readme.md delete mode 100644 tests-upgrade/datamodels-datatypes-anytype/swagger.json delete mode 100644 tests-upgrade/datamodels-datatypes-file/readme.md delete mode 100644 tests-upgrade/datamodels-datatypes-file/swagger.json delete mode 100644 tests-upgrade/datamodels-datatypes-object/readme.md delete mode 100644 tests-upgrade/datamodels-datatypes-object/swagger.json delete mode 100644 tests-upgrade/datamodels-enums/readme.md delete mode 100644 tests-upgrade/datamodels-enums/swagger.json create mode 100644 tests-upgrade/sample-swagger.json diff --git a/tests-upgrade/.gitignore b/tests-upgrade/.gitignore index de2a9c8829c..dc9b2375c7a 100644 --- a/tests-upgrade/.gitignore +++ b/tests-upgrade/.gitignore @@ -1,2 +1 @@ -generate generated \ No newline at end of file diff --git a/tests-upgrade/AutoRestUpgradeTest.ps1 b/tests-upgrade/AutoRestUpgradeTest.ps1 index a27559fea34..e6b2cc46e01 100644 --- a/tests-upgrade/AutoRestUpgradeTest.ps1 +++ b/tests-upgrade/AutoRestUpgradeTest.ps1 @@ -1,10 +1,9 @@ param([switch]$Generate,[string]$TestName,[switch]$M3,[switch]$M4,[switch]$AllowList,[switch]$BlackList) #need to use the right version of node.js -#nvs use 10.16.0 +# nvs use 10.16.0 # #please use substring to select the compare path # $m3Path='.\generate\m3' # $m4Path='.\generate\m4' -mkdir CompareResult $scriptPath = Get-Location $global:isError = $false $conf = (Get-Content 'Configuration.json') | ConvertFrom-Json @@ -61,7 +60,6 @@ function Generate() autorest-beta --use:@autorest/powershell@2.1.386 --output-folder:.\generate\m3 --Debug ##generate m4 code autorest-beta --use:..\..\ --output-folder:.\generate\m4 --Debug - }elseif($M3) { autorest-beta --use:@autorest/powershell@2.1.386 --output-folder:.\generate\m3 --Debug @@ -82,8 +80,8 @@ function CompareTest([string]$inputm3Path,[string]$inputm4Path,[string]$testFile $initFileList = Get-ChildItem -Recurse -force # $initIgnoreFileList = $inputm3Path + '\generated\modules' # $targetIgnoreFileList = $inputm4Path + '\generated\modules' - $initIgnoreFileList = (($inputm3Path+'\generated\modules'), ($inputm3Path+'\.gitignore'),($inputm3Path+'\tools\Resources\.gitignore')) - $targetIgnoreFileList = (($inputm4Path+'\generated\modules'), ($inputm4Path+'\.gitignore'),($inputm4Path+'\tools\Resources\.gitignore')) + $initIgnoreFileList = (($inputm3Path+'\generated\modules'), ($inputm3Path+'\.gitignore')) + $targetIgnoreFileList = (($inputm4Path+'\generated\modules'), ($inputm4Path+'\.gitignore')) # $initFileList #foreach initFileList and get the hashcode of them foreach( $initFile in $initFileList) @@ -283,7 +281,4 @@ cd $currentPath.Path if($global:isError) { throw 'Error: The code generated by the target file is different from the code generated by the source file.' -}else -{ - Write-Host -ForegroundColor blue 'All generated codes are the same' } diff --git a/tests-upgrade/Configuration.json b/tests-upgrade/Configuration.json index 45cfd08d30f..ff193de0224 100644 --- a/tests-upgrade/Configuration.json +++ b/tests-upgrade/Configuration.json @@ -1,36 +1,3 @@ { - "WhiteList":[ - "basic-disableazure-get", - "basic-disableazure-response" - ], - "BlackList":[ - "basic-get-querystr", - "basic-get-delete", - "basic-get-delete-put-patch", - "basic-request-methods", - "basic-get-response-operation", - "basic-response-multioperation", - "basic-response-defaultoperation", - "basic-disableazure-get", - "component-param", - "component-multiparam", - "component-param-remote", - "component--param-localremote", - "component-param-inbody", - "component-definitions-local", - "component-definitions-remote", - "component-definitions-combined", - "datamodels-datatypes-mixedtypes", - "datamodels-datatypes-integer", - "datamodels-datatypes-string", - "datamodels-datatypes-nullable", - "datamodels-datatypes-array", - "datamodels-datatypes-object", - "datamodels-datatypes-file", - "datamodels-datatypes-anytype", - "datamodels-enums", - "datamodels-keyvalue", - "datamodels-combineschema", - "datamodels-inheritpolymorphism" - ] + "WhiteList":["basic-get","basic-get-delete"] } \ No newline at end of file diff --git a/tests-upgrade/basic-disableazure-get/readme.md b/tests-upgrade/basic-disableazure-get/readme.md deleted file mode 100644 index f64f8c74647..00000000000 --- a/tests-upgrade/basic-disableazure-get/readme.md +++ /dev/null @@ -1,13 +0,0 @@ -### AutoRest Configuration -> see https://aka.ms/autorest - -``` yaml -require: - - $(this-folder)/../readme.azure.noprofile.md - -azure: false - -input-file: - - $(this-folder)/swagger.json - -``` diff --git a/tests-upgrade/basic-disableazure-get/swagger.json b/tests-upgrade/basic-disableazure-get/swagger.json deleted file mode 100644 index ec29bdce647..00000000000 --- a/tests-upgrade/basic-disableazure-get/swagger.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - - "swagger": "2.0", - "info": { - "title": "AutoRestUpgradeClient", - "version": "2018-04-01", - "description": "ARM AutoRestUpgrade" - }, - "host": "management.azure.com", - "schemes": [ - "https" - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "security": [ - { - "azure_auth": [ - "user_impersonation" - ] - } - ], - "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/resourceGroup": { - "get": { - "tags": [ - "Workspaces" - ], - "operationId": "Workspaces_Get", - "description": "Gets the workspace.", - "responses": { - "200": { - "description": "Ok-Return" - } - } - } - } - } -} \ No newline at end of file diff --git a/tests-upgrade/basic-disableazure-response/readme.md b/tests-upgrade/basic-disableazure-response/readme.md deleted file mode 100644 index f64f8c74647..00000000000 --- a/tests-upgrade/basic-disableazure-response/readme.md +++ /dev/null @@ -1,13 +0,0 @@ -### AutoRest Configuration -> see https://aka.ms/autorest - -``` yaml -require: - - $(this-folder)/../readme.azure.noprofile.md - -azure: false - -input-file: - - $(this-folder)/swagger.json - -``` diff --git a/tests-upgrade/basic-disableazure-response/swagger.json b/tests-upgrade/basic-disableazure-response/swagger.json deleted file mode 100644 index 4e3ddee1c72..00000000000 --- a/tests-upgrade/basic-disableazure-response/swagger.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - - "swagger": "2.0", - "info": { - "title": "AutoRestUpgradeClient", - "version": "2018-04-01", - "description": "ARM AutoRestUpgrade" - }, - "host": "management.azure.com", - "schemes": [ - "https" - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "security": [ - { - "azure_auth": [ - "user_impersonation" - ] - } - ], - "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/resourceGroup": { - "get": { - "tags": [ - "Workspaces" - ], - "operationId": "Workspaces_Get", - "description": "Gets the workspace.", - "responses": { - "200": { - "description": "Ok-Return", - "schema": { - "$ref": "#/definitions/Workspaces" - } - } - } - } - } - }, - "definitions": { - "Workspaces": { - "type": "string" - } - } -} \ No newline at end of file diff --git a/tests-upgrade/basic-get-delete-put-patch/swagger.json b/tests-upgrade/basic-get-delete-put-patch/swagger.json index 79ca5c3d604..1e492fbdb81 100644 --- a/tests-upgrade/basic-get-delete-put-patch/swagger.json +++ b/tests-upgrade/basic-get-delete-put-patch/swagger.json @@ -2,9 +2,9 @@ "swagger": "2.0", "info": { - "title": "AutoRestUpgradeClient", + "title": "DatabricksClient", "version": "2018-04-01", - "description": "ARM AutoRestUpgrade" + "description": "ARM Databricks" }, "host": "management.azure.com", "schemes": [ @@ -43,8 +43,8 @@ "operationId": "Workspaces_Get", "description": "Gets the workspace.", "responses": { - "200": { - "description": "Ok-Return" + "default": { + "description": "Error response describing why the operation failed." } } }, @@ -55,8 +55,8 @@ "operationId": "Workspaces_Delete", "description": "Deletes the workspace", "responses": { - "200": { - "description": "Ok-Return" + "default": { + "description": "Error response describing why the operation failed." } } }, @@ -67,8 +67,8 @@ "operationId": "Workspaces_CreateOrUpdate", "description": "Creates a new workspace.", "responses": { - "200": { - "description": "Ok-Return" + "default": { + "description": "Error response describing why the operation failed." } } }, diff --git a/tests-upgrade/basic-get-delete/swagger.json b/tests-upgrade/basic-get-delete/swagger.json index a5b34b7f0ca..99515cde797 100644 --- a/tests-upgrade/basic-get-delete/swagger.json +++ b/tests-upgrade/basic-get-delete/swagger.json @@ -2,7 +2,7 @@ "swagger": "2.0", "info": { - "title": "AutoRestUpgradeClient", + "title": "DatabricksClient", "version": "2018-04-01", "description": "ARM Databricks" }, @@ -43,8 +43,8 @@ "operationId": "Workspaces_Get", "description": "Gets the workspace.", "responses": { - "200": { - "description": "Ok-Return" + "default": { + "description": "Error response describing why the operation failed." } } }, @@ -55,9 +55,9 @@ "operationId": "Workspaces_Delete", "description": "Delete the workspace.", "responses": { - "200": { - "description": "Ok-Return" - } + "default": { + "description": "Error response describing why the operation failed." + } } } } diff --git a/tests-upgrade/basic-get-response-operation/swagger.json b/tests-upgrade/basic-get-response-operation/swagger.json index 6ea9ca33bf7..58b0c253858 100644 --- a/tests-upgrade/basic-get-response-operation/swagger.json +++ b/tests-upgrade/basic-get-response-operation/swagger.json @@ -46,8 +46,8 @@ "200": { "description": "OK - Returns the workspace." }, - "201": { - "description": "OK - Returns the workspace." + "default": { + "description": "Error response describing why the operation failed." } } } diff --git a/tests-upgrade/basic-get/swagger.json b/tests-upgrade/basic-get/swagger.json index ec29bdce647..5480c062852 100644 --- a/tests-upgrade/basic-get/swagger.json +++ b/tests-upgrade/basic-get/swagger.json @@ -2,9 +2,9 @@ "swagger": "2.0", "info": { - "title": "AutoRestUpgradeClient", + "title": "DatabricksClient", "version": "2018-04-01", - "description": "ARM AutoRestUpgrade" + "description": "ARM Databricks" }, "host": "management.azure.com", "schemes": [ @@ -43,8 +43,8 @@ "operationId": "Workspaces_Get", "description": "Gets the workspace.", "responses": { - "200": { - "description": "Ok-Return" + "default": { + "description": "Error response describing why the operation failed." } } } diff --git a/tests-upgrade/basic-response-defaultoperation/readme.md b/tests-upgrade/basic-response-defaultoperation/readme.md deleted file mode 100644 index cd6b9c0ac24..00000000000 --- a/tests-upgrade/basic-response-defaultoperation/readme.md +++ /dev/null @@ -1,10 +0,0 @@ -### AutoRest Configuration -> see https://aka.ms/autorest - -``` yaml -require: - - $(this-folder)/../readme.azure.noprofile.md -input-file: - - $(this-folder)/swagger.json - -``` diff --git a/tests-upgrade/basic-response-defaultoperation/swagger.json b/tests-upgrade/basic-response-defaultoperation/swagger.json deleted file mode 100644 index bd560d4df82..00000000000 --- a/tests-upgrade/basic-response-defaultoperation/swagger.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - - "swagger": "2.0", - "info": { - "title": "AutoRestUpgradeClient", - "version": "2018-04-01", - "description": "ARM AutoRestUpgrade" - }, - "host": "management.azure.com", - "schemes": [ - "https" - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "security": [ - { - "azure_auth": [ - "user_impersonation" - ] - } - ], - "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/resourceGroup": { - "get": { - "tags": [ - "Workspaces" - ], - "operationId": "Workspaces_Get", - "description": "Gets the workspace.", - "responses": { - "default": { - "description": "Error response describing why the operation failed." - } - } - } - } - } -} \ No newline at end of file diff --git a/tests-upgrade/basic-response-multioperation/swagger.json b/tests-upgrade/basic-response-multioperation/swagger.json index d394280a4cf..115b3af19eb 100644 --- a/tests-upgrade/basic-response-multioperation/swagger.json +++ b/tests-upgrade/basic-response-multioperation/swagger.json @@ -46,8 +46,8 @@ "200": { "description": "OK - Returns the workspace." }, - "201": { - "description": "OK - Returns the workspace." + "default": { + "description": "Error response describing why the operation failed." } } }, @@ -59,10 +59,10 @@ "description": "Deletes the workspace", "responses": { "200": { - "description": "OK - Returns the workspace." + "description": "OK - Deleted the workspace." }, - "201": { - "description": "OK - Returns the workspace." + "default": { + "description": "Error response describing why the operation failed." } } }, @@ -73,12 +73,12 @@ "operationId": "Workspaces_CreateOrUpdate", "description": "Creates a new workspace.", "responses": { - "200": { - "description": "OK - Returns the workspace." - }, - "201": { - "description": "OK - Returns the workspace." - } + "200": { + "description": "OK - Created or updated the workspace." + }, + "default": { + "description": "Error response describing why the operation failed." + } } }, "patch": { @@ -89,10 +89,13 @@ "description": "Updates a workspace.", "responses": { "200": { - "description": "OK - Returns the workspace." + "description": "OK - Updated the workspace." }, - "201": { - "description": "OK - Returns the workspace." + "202": { + "description": "Accepted" + }, + "default": { + "description": "Error response describing why the operation failed." } } } diff --git a/tests-upgrade/component-definitions-combined/swagger.json b/tests-upgrade/component-definitions-combined/swagger.json index 74275d3ea50..1330299ffdf 100644 --- a/tests-upgrade/component-definitions-combined/swagger.json +++ b/tests-upgrade/component-definitions-combined/swagger.json @@ -45,6 +45,12 @@ "responses": { "200": { "description": "OK-Return workspace." + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "#/definitions/ExtendedErrorModel" + } } } } diff --git a/tests-upgrade/component-definitions-local/swagger.json b/tests-upgrade/component-definitions-local/swagger.json index abe8d4ae8da..3f8d3819459 100644 --- a/tests-upgrade/component-definitions-local/swagger.json +++ b/tests-upgrade/component-definitions-local/swagger.json @@ -45,6 +45,12 @@ "responses": { "200": { "description": "OK - Returns an array of workspaces." + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } } } } diff --git a/tests-upgrade/component-multiparam/swagger.json b/tests-upgrade/component-multiparam/swagger.json index 65059d19396..ce72f5a4f15 100644 --- a/tests-upgrade/component-multiparam/swagger.json +++ b/tests-upgrade/component-multiparam/swagger.json @@ -61,6 +61,9 @@ "responses": { "200": { "description": "OK - Returns the workspace." + }, + "default": { + "description": "Error response describing why the operation failed." } } }, @@ -90,6 +93,9 @@ "responses": { "200": { "description": "OK - Deleted the workspace." + }, + "default": { + "description": "Error response describing why the operation failed." } } }, @@ -119,6 +125,9 @@ "responses": { "200": { "description": "OK - Created or updated the workspace." + }, + "default": { + "description": "Error response describing why the operation failed." } } }, @@ -148,6 +157,9 @@ "responses": { "200": { "description": "OK - Updated the workspace." + }, + "default": { + "description": "Error response describing why the operation failed." } } } diff --git a/tests-upgrade/component-param-inbody/swagger.json b/tests-upgrade/component-param-inbody/swagger.json index 92f69beb418..5f514f3db2e 100644 --- a/tests-upgrade/component-param-inbody/swagger.json +++ b/tests-upgrade/component-param-inbody/swagger.json @@ -67,6 +67,9 @@ "responses": { "200": { "description": "OK - Created or updated the workspace." + }, + "default": { + "description": "Error response describing why the operation failed." } } } diff --git a/tests-upgrade/component-param-localremote/swagger.json b/tests-upgrade/component-param-localremote/swagger.json index e40621844c2..2ee6b92080d 100644 --- a/tests-upgrade/component-param-localremote/swagger.json +++ b/tests-upgrade/component-param-localremote/swagger.json @@ -62,6 +62,9 @@ "responses": { "200": { "description": "OK - Returns the workspace." + }, + "default": { + "description": "Error response describing why the operation failed." } } }, @@ -92,6 +95,9 @@ "responses": { "200": { "description": "OK - Deleted the workspace." + }, + "default": { + "description": "Error response describing why the operation failed." } } }, @@ -122,6 +128,9 @@ "responses": { "200": { "description": "OK - Created or updated the workspace." + }, + "default": { + "description": "Error response describing why the operation failed." } } }, @@ -152,6 +161,9 @@ "responses": { "200": { "description": "OK - Updated the workspace." + }, + "default": { + "description": "Error response describing why the operation failed." } } } diff --git a/tests-upgrade/component-param-remote/swagger.json b/tests-upgrade/component-param-remote/swagger.json index ad2e13269ca..eed1f4fca06 100644 --- a/tests-upgrade/component-param-remote/swagger.json +++ b/tests-upgrade/component-param-remote/swagger.json @@ -58,6 +58,9 @@ "responses": { "200": { "description": "OK - Returns the workspace." + }, + "default": { + "description": "Error response describing why the operation failed." } } }, @@ -84,6 +87,9 @@ "responses": { "200": { "description": "OK - Deleted the workspace." + }, + "default": { + "description": "Error response describing why the operation failed." } } }, @@ -110,6 +116,9 @@ "responses": { "200": { "description": "OK - Created or updated the workspace." + }, + "default": { + "description": "Error response describing why the operation failed." } } }, @@ -136,6 +145,9 @@ "responses": { "200": { "description": "OK - Updated the workspace." + }, + "default": { + "description": "Error response describing why the operation failed." } } } diff --git a/tests-upgrade/component-param/swagger.json b/tests-upgrade/component-param/swagger.json index f61120bf5bb..731b8c5688d 100644 --- a/tests-upgrade/component-param/swagger.json +++ b/tests-upgrade/component-param/swagger.json @@ -53,6 +53,9 @@ "responses": { "200": { "description": "OK - Returns the workspace." + }, + "default": { + "description": "Error response describing why the operation failed." } } }, @@ -74,6 +77,9 @@ "responses": { "200": { "description": "OK - Deleted the workspace." + }, + "default": { + "description": "Error response describing why the operation failed." } } }, @@ -95,6 +101,9 @@ "responses": { "200": { "description": "OK - Created or updated the workspace." + }, + "default": { + "description": "Error response describing why the operation failed." } } }, @@ -119,6 +128,9 @@ "responses": { "200": { "description": "OK - Updated the workspace." + }, + "default": { + "description": "Error response describing why the operation failed." } } } diff --git a/tests-upgrade/datamodels-combineschema/readme.md b/tests-upgrade/datamodels-combineschema/readme.md deleted file mode 100644 index cd6b9c0ac24..00000000000 --- a/tests-upgrade/datamodels-combineschema/readme.md +++ /dev/null @@ -1,10 +0,0 @@ -### AutoRest Configuration -> see https://aka.ms/autorest - -``` yaml -require: - - $(this-folder)/../readme.azure.noprofile.md -input-file: - - $(this-folder)/swagger.json - -``` diff --git a/tests-upgrade/datamodels-combineschema/swagger.json b/tests-upgrade/datamodels-combineschema/swagger.json deleted file mode 100644 index 9f83a802c31..00000000000 --- a/tests-upgrade/datamodels-combineschema/swagger.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - - "swagger": "2.0", - "info": { - "title": "DatabricksClient", - "version": "2018-04-01", - "description": "ARM Databricks" - }, - "host": "management.azure.com", - "schemes": [ - "https" - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "security": [ - { - "azure_auth": [ - "user_impersonation" - ] - } - ], - "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": { - "/pets": { - "patch": { - "tags": [ - "pets" - ], - "operationId": "Pets_Update", - "description": "Gets pet list.", - "parameters": [ - { - "name": "pets", - "in": "body", - "required": true, - "description": "The pets update.", - "schema": { - "$ref":"#/definitions/Dog" - } - } - ], - "responses": { - "200": { - "description": "OK-Return workspace." - } - } - } - } - }, - "definitions": { - "Pet": { - "type": "object", - "properties": { - "petType": { - "type": "string" - } - } - }, - "Dog":{ - "type": "object", - "properties": { - "bark": { - "type": "boolean" - }, - "breed": { - "type": "string" - } - } - }, - "Cat": { - "allOf": [ - { - "$ref": "#/definitions/Pet" - - }, - { - "type": "object", - "properties": { - "hunts": { - "type": "boolean" - }, - "age": { - "type": "integer" - } - } - } - ] - - } - } -} \ No newline at end of file diff --git a/tests-upgrade/datamodels-datatypes-anytype/readme.md b/tests-upgrade/datamodels-datatypes-anytype/readme.md deleted file mode 100644 index cd6b9c0ac24..00000000000 --- a/tests-upgrade/datamodels-datatypes-anytype/readme.md +++ /dev/null @@ -1,10 +0,0 @@ -### AutoRest Configuration -> see https://aka.ms/autorest - -``` yaml -require: - - $(this-folder)/../readme.azure.noprofile.md -input-file: - - $(this-folder)/swagger.json - -``` diff --git a/tests-upgrade/datamodels-datatypes-anytype/swagger.json b/tests-upgrade/datamodels-datatypes-anytype/swagger.json deleted file mode 100644 index e5adebe0807..00000000000 --- a/tests-upgrade/datamodels-datatypes-anytype/swagger.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - - "swagger": "2.0", - "info": { - "title": "DatabricksClient", - "version": "2018-04-01", - "description": "ARM Databricks" - }, - "host": "management.azure.com", - "schemes": [ - "https" - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "security": [ - { - "azure_auth": [ - "user_impersonation" - ] - } - ], - "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/resourceGroup": { - "get": { - "tags": [ - "Workspaces" - ], - "operationId": "Workspaces_Get", - "description": "Gets the workspace.", - "responses": { - "200": { - "description": "OK-Return workspace." - } - } - } - } - }, - "definitions": { - "FilesModel": { - "description": "Can be any value - string, number, boolean, array or object." - } - } -} \ No newline at end of file diff --git a/tests-upgrade/datamodels-datatypes-array/swagger.json b/tests-upgrade/datamodels-datatypes-array/swagger.json index d0276ce0819..6e69cbf3baa 100644 --- a/tests-upgrade/datamodels-datatypes-array/swagger.json +++ b/tests-upgrade/datamodels-datatypes-array/swagger.json @@ -48,6 +48,9 @@ "schema":{ "$ref": "#/definitions/Workspace" } + }, + "default": { + "description": "Error response describing why the operation failed." } } } diff --git a/tests-upgrade/datamodels-datatypes-file/readme.md b/tests-upgrade/datamodels-datatypes-file/readme.md deleted file mode 100644 index cd6b9c0ac24..00000000000 --- a/tests-upgrade/datamodels-datatypes-file/readme.md +++ /dev/null @@ -1,10 +0,0 @@ -### AutoRest Configuration -> see https://aka.ms/autorest - -``` yaml -require: - - $(this-folder)/../readme.azure.noprofile.md -input-file: - - $(this-folder)/swagger.json - -``` diff --git a/tests-upgrade/datamodels-datatypes-file/swagger.json b/tests-upgrade/datamodels-datatypes-file/swagger.json deleted file mode 100644 index 88f1a2f3320..00000000000 --- a/tests-upgrade/datamodels-datatypes-file/swagger.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - - "swagger": "2.0", - "info": { - "title": "DatabricksClient", - "version": "2018-04-01", - "description": "ARM Databricks" - }, - "host": "management.azure.com", - "schemes": [ - "https" - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "security": [ - { - "azure_auth": [ - "user_impersonation" - ] - } - ], - "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/resourceGroup": { - "get": { - "tags": [ - "Workspaces" - ], - "operationId": "Workspaces_Get", - "description": "Gets the workspace.", - "responses": { - "200": { - "description": "OK-Return workspace." - } - } - } - } - }, - "definitions": { - "FilesModel": { - "type": "object", - "properties": { - "file": { - "type": "string", - "format": "binary" - } - } - } - } -} \ No newline at end of file diff --git a/tests-upgrade/datamodels-datatypes-integer/swagger.json b/tests-upgrade/datamodels-datatypes-integer/swagger.json index ba95966f003..a08d8d9e3c8 100644 --- a/tests-upgrade/datamodels-datatypes-integer/swagger.json +++ b/tests-upgrade/datamodels-datatypes-integer/swagger.json @@ -44,10 +44,13 @@ "description": "Gets the workspace.", "responses": { "200": { - "description": "OK-Return workspace.", - "schema": { + "description": "OK-Return workspace." + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { "$ref": "#/definitions/BasicErrorModel" - } + } } } } diff --git a/tests-upgrade/datamodels-datatypes-mixedtypes/swagger.json b/tests-upgrade/datamodels-datatypes-mixedtypes/swagger.json index 2bc5d4658a2..a9dca898e4e 100644 --- a/tests-upgrade/datamodels-datatypes-mixedtypes/swagger.json +++ b/tests-upgrade/datamodels-datatypes-mixedtypes/swagger.json @@ -44,10 +44,13 @@ "description": "Gets the workspace.", "responses": { "200": { - "description": "OK-Return workspace.", - "schema": { + "description": "OK-Return workspace." + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { "$ref": "#/definitions/BasicErrorModel" - } + } } } } diff --git a/tests-upgrade/datamodels-datatypes-nullable/swagger.json b/tests-upgrade/datamodels-datatypes-nullable/swagger.json index 1c302ab5180..e3832914d01 100644 --- a/tests-upgrade/datamodels-datatypes-nullable/swagger.json +++ b/tests-upgrade/datamodels-datatypes-nullable/swagger.json @@ -44,10 +44,13 @@ "description": "Gets the workspace.", "responses": { "200": { - "description": "OK-Return workspace.", - "schema": { + "description": "OK-Return workspace." + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { "$ref": "#/definitions/BasicErrorModel" - } + } } } } diff --git a/tests-upgrade/datamodels-datatypes-object/readme.md b/tests-upgrade/datamodels-datatypes-object/readme.md deleted file mode 100644 index cd6b9c0ac24..00000000000 --- a/tests-upgrade/datamodels-datatypes-object/readme.md +++ /dev/null @@ -1,10 +0,0 @@ -### AutoRest Configuration -> see https://aka.ms/autorest - -``` yaml -require: - - $(this-folder)/../readme.azure.noprofile.md -input-file: - - $(this-folder)/swagger.json - -``` diff --git a/tests-upgrade/datamodels-datatypes-object/swagger.json b/tests-upgrade/datamodels-datatypes-object/swagger.json deleted file mode 100644 index b82571a6750..00000000000 --- a/tests-upgrade/datamodels-datatypes-object/swagger.json +++ /dev/null @@ -1,131 +0,0 @@ -{ - - "swagger": "2.0", - "info": { - "title": "DatabricksClient", - "version": "2018-04-01", - "description": "ARM Databricks" - }, - "host": "management.azure.com", - "schemes": [ - "https" - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "security": [ - { - "azure_auth": [ - "user_impersonation" - ] - } - ], - "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/resourceGroup": { - "get": { - "tags": [ - "Workspaces" - ], - "operationId": "Workspaces_Get", - "description": "Gets the workspace.", - "responses": { - "200": { - "description": "OK-Return workspace." - } - } - } - } - }, - "definitions": { - "Model": { - "type": "object", - "properties": { - "message": { - "type": "string" - }, - "code": { - "type": "integer" - } - } - }, - "Model2": { - "type": "object", - "properties": { - "id": { - "type": "integer" - }, - "username": { - "type": "string" - }, - "name": { - "type": "string" - } - }, - "required": [ - "id", - "username" - ] - }, - "Model3": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "readOnly": true - }, - "password": { - "type": "string" - } - }, - "required": [ - "id", - "username" - ] - }, - "ContactInfo": { - "type": "object", - "properties": { - "email": { - "type": "string", - "format": "email" - }, - "phone": { - "type": "string" - } - } - }, - "User": { - "type": "object", - "properties": { - "id": { - "type": "integer" - }, - "name": { - "type": "string" - }, - "contact_info": { - "$ref": "#/definitions/ContactInfo" - } - } - }, - "Model4": { - "type": "object", - "minProperties": 2, - "maxProperties": 10 - } - } -} \ No newline at end of file diff --git a/tests-upgrade/datamodels-datatypes-string/swagger.json b/tests-upgrade/datamodels-datatypes-string/swagger.json index 67c6bf4fc54..f1f9d58cb9d 100644 --- a/tests-upgrade/datamodels-datatypes-string/swagger.json +++ b/tests-upgrade/datamodels-datatypes-string/swagger.json @@ -45,6 +45,12 @@ "responses": { "200": { "description": "OK-Return workspace." + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "#/definitions/BasicErrorModel" + } } } } diff --git a/tests-upgrade/datamodels-enums/readme.md b/tests-upgrade/datamodels-enums/readme.md deleted file mode 100644 index cd6b9c0ac24..00000000000 --- a/tests-upgrade/datamodels-enums/readme.md +++ /dev/null @@ -1,10 +0,0 @@ -### AutoRest Configuration -> see https://aka.ms/autorest - -``` yaml -require: - - $(this-folder)/../readme.azure.noprofile.md -input-file: - - $(this-folder)/swagger.json - -``` diff --git a/tests-upgrade/datamodels-enums/swagger.json b/tests-upgrade/datamodels-enums/swagger.json deleted file mode 100644 index efa7111df69..00000000000 --- a/tests-upgrade/datamodels-enums/swagger.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - - "swagger": "2.0", - "info": { - "title": "DatabricksClient", - "version": "2018-04-01", - "description": "ARM Databricks" - }, - "host": "management.azure.com", - "schemes": [ - "https" - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "security": [ - { - "azure_auth": [ - "user_impersonation" - ] - } - ], - "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/resourceGroup/{resourceGroup}": { - "get": { - "tags": [ - "Workspaces" - ], - "operationId": "Workspaces_Get", - "description": "Gets the workspace.", - "parameters": [ - { - "$ref": "#/parameters/ResourceGroupName" - } - ], - "responses": { - "200": { - "description": "OK-Return workspace." - } - } - } - } - }, - "parameters": { - "ResourceGroupName":{ - "in": "path", - "name": "resourceGroup", - "description": "Resource group name", - "required": true, - "schema": { - "type": "string", - "enum": [ - "azure cloud", - "azure prod" - ] - } - } - } -} \ No newline at end of file diff --git a/tests-upgrade/sample-swagger.json b/tests-upgrade/sample-swagger.json new file mode 100644 index 00000000000..8db4896d3dd --- /dev/null +++ b/tests-upgrade/sample-swagger.json @@ -0,0 +1,1266 @@ +{ + "swagger": "2.0", + "info": { + "title": "DatabricksClient", + "version": "2018-04-01", + "description": "ARM Databricks" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "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.Databricks/workspaces/{workspaceName}": { + "get": { + "tags": [ + "Workspaces" + ], + "operationId": "Workspaces_Get", + "description": "Gets the workspace.", + "x-ms-examples": { + "Get a workspace": { + "$ref": "./examples/WorkspaceGet.json" + }, + "Get a workspace with custom parameters": { + "$ref": "./examples/WorkspaceGetParameters.json" + } + }, + "parameters": [ + { + "$ref": "#/parameters/ResourceGroupName" + }, + { + "$ref": "#/parameters/WorkspaceName" + }, + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/SubscriptionIdParameter" + } + ], + "responses": { + "200": { + "description": "OK - Returns the workspace.", + "schema": { + "$ref": "#/definitions/Workspace" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + } + }, + "delete": { + "tags": [ + "Workspaces" + ], + "operationId": "Workspaces_Delete", + "description": "Deletes the workspace.", + "x-ms-examples": { + "Delete a workspace": { + "$ref": "./examples/WorkspaceDelete.json" + } + }, + "parameters": [ + { + "$ref": "#/parameters/ResourceGroupName" + }, + { + "$ref": "#/parameters/WorkspaceName" + }, + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/SubscriptionIdParameter" + } + ], + "responses": { + "204": { + "description": "NoContent" + }, + "202": { + "description": "Accepted - Returns this status until the asynchronous operation has completed." + }, + "200": { + "description": "OK. The request has succeeded." + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-long-running-operation": true + }, + "put": { + "tags": [ + "Workspaces" + ], + "operationId": "Workspaces_CreateOrUpdate", + "description": "Creates a new workspace.", + "x-ms-examples": { + "Create or update workspace": { + "$ref": "./examples/WorkspaceCreate.json" + }, + "Create or update workspace with custom parameters": { + "$ref": "./examples/WorkspaceCreateWithParameters.json" + }, + "Create a workspace which is ready for Customer-Managed Key (CMK) encryption": { + "$ref": "./examples/PrepareEncryption.json" + }, + "Enable Customer-Managed Key (CMK) encryption on a workspace which is prepared for encryption": { + "$ref": "./examples/EnableEncryption.json" + }, + "Revert Customer-Managed Key (CMK) encryption to Microsoft Managed Keys encryption on a workspace": { + "$ref": "./examples/DisableEncryption.json" + } + }, + "parameters": [ + { + "name": "parameters", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/Workspace" + }, + "description": "Parameters supplied to the create or update a workspace." + }, + { + "$ref": "#/parameters/ResourceGroupName" + }, + { + "$ref": "#/parameters/WorkspaceName" + }, + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/SubscriptionIdParameter" + } + ], + "responses": { + "200": { + "description": "Created - Returns information about the workspace, including provisioning status.", + "schema": { + "$ref": "#/definitions/Workspace" + } + }, + "201": { + "description": "Created - Returns information about the workspace, including provisioning status.", + "schema": { + "$ref": "#/definitions/Workspace" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-long-running-operation": true + }, + "patch": { + "tags": [ + "Workspaces" + ], + "operationId": "Workspaces_Update", + "description": "Updates a workspace.", + "parameters": [ + { + "name": "parameters", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/WorkspaceUpdate" + }, + "description": "The update to the workspace." + }, + { + "$ref": "#/parameters/ResourceGroupName" + }, + { + "$ref": "#/parameters/WorkspaceName" + }, + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/SubscriptionIdParameter" + } + ], + "responses": { + "200": { + "description": "Successfully updated the workspace.", + "schema": { + "$ref": "#/definitions/Workspace" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "202": { + "description": "Accepted" + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "Update a workspace's tags.": { + "$ref": "./examples/WorkspaceUpdate.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces": { + "get": { + "tags": [ + "Workspaces" + ], + "operationId": "Workspaces_ListByResourceGroup", + "description": "Gets all the workspaces within a resource group.", + "x-ms-examples": { + "Lists workspaces": { + "$ref": "./examples/WorkspacesListByResourceGroup.json" + } + }, + "parameters": [ + { + "$ref": "#/parameters/ResourceGroupName" + }, + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/SubscriptionIdParameter" + } + ], + "responses": { + "200": { + "description": "OK - Returns an array of workspaces.", + "schema": { + "$ref": "#/definitions/WorkspaceListResult" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.Databricks/workspaces": { + "get": { + "tags": [ + "Workspaces" + ], + "operationId": "Workspaces_ListBySubscription", + "description": "Gets all the workspaces within a subscription.", + "x-ms-examples": { + "Lists workspaces": { + "$ref": "./examples/WorkspacesListBySubscription.json" + } + }, + "parameters": [ + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/SubscriptionIdParameter" + } + ], + "responses": { + "200": { + "description": "OK - Returns an array of workspaces.", + "schema": { + "$ref": "#/definitions/WorkspaceListResult" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/virtualNetworkPeerings/{peeringName}": { + "get": { + "tags": [ + "vNetPeering" + ], + "operationId": "vNetPeering_Get", + "description": "Gets the workspace vNet Peering.", + "x-ms-examples": { + "Get a workspace with vNet Peering Configured": { + "$ref": "./examples/WorkspaceVirtualNetPeeringGet.json" + } + }, + "parameters": [ + { + "$ref": "#/parameters/ResourceGroupName" + }, + { + "$ref": "#/parameters/WorkspaceName" + }, + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "#/parameters/PeeringNameParameter" + } + ], + "responses": { + "200": { + "description": "OK. The request has succeeded.", + "schema": { + "$ref": "#/definitions/VirtualNetworkPeering" + } + }, + "204": { + "description": "OK - NoContent" + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + } + }, + "delete": { + "tags": [ + "vNetPeering" + ], + "operationId": "vNetPeering_Delete", + "description": "Deletes the workspace vNetPeering.", + "x-ms-examples": { + "Delete a workspace vNet Peering": { + "$ref": "./examples/WorkspaceVirtualNetworkPeeringDelete.json" + } + }, + "parameters": [ + { + "$ref": "#/parameters/ResourceGroupName" + }, + { + "$ref": "#/parameters/WorkspaceName" + }, + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "#/parameters/PeeringNameParameter" + } + ], + "responses": { + "202": { + "description": "Accepted - Returns this status until the asynchronous operation has completed." + }, + "204": { + "description": "NoContent" + }, + "200": { + "description": "OK. The request has succeeded." + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-long-running-operation": true + }, + "put": { + "tags": [ + "vNetPeering" + ], + "operationId": "vNetPeering_CreateOrUpdate", + "description": "Creates vNet Peering for workspace.", + "x-ms-examples": { + "Create vNet Peering for Workspace": { + "$ref": "./examples/WorkspaceVirtualNetworkPeeringCreateOrUpdate.json" + } + }, + "parameters": [ + { + "name": "VirtualNetworkPeeringParameters", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/VirtualNetworkPeering" + }, + "description": "Parameters supplied to the create workspace vNet Peering." + }, + { + "$ref": "#/parameters/ResourceGroupName" + }, + { + "$ref": "#/parameters/WorkspaceName" + }, + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "#/parameters/PeeringNameParameter" + } + ], + "responses": { + "201": { + "description": "Created - Returns information about the workspace vNet peering, including provisioning status.", + "schema": { + "$ref": "#/definitions/VirtualNetworkPeering" + } + }, + "200": { + "description": "Update succeeded - Returns information about the workspace vNet peering.", + "schema": { + "$ref": "#/definitions/VirtualNetworkPeering" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-long-running-operation": true + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/virtualNetworkPeerings": { + "get": { + "tags": [ + "vNetPeering" + ], + "operationId": "vNetPeering_ListByWorkspace", + "description": "Lists the workspace vNet Peerings.", + "x-ms-examples": { + "List all vNet Peerings for the workspace": { + "$ref": "./examples/WorkspaceVirtualNetPeeringList.json" + } + }, + "parameters": [ + { + "$ref": "#/parameters/ResourceGroupName" + }, + { + "$ref": "#/parameters/WorkspaceName" + }, + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/SubscriptionIdParameter" + } + ], + "responses": { + "200": { + "description": "List succeeded. Returns the resulting resource objects in response body.", + "schema": { + "$ref": "#/definitions/VirtualNetworkPeeringList" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/providers/Microsoft.Databricks/operations": { + "get": { + "tags": [ + "Operations" + ], + "description": "Lists all of the available RP operations.", + "x-ms-examples": { + "Operations": { + "$ref": "./examples/OperationsList.json" + } + }, + "operationId": "Operations_List", + "parameters": [ + { + "$ref": "#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "OK. The request has succeeded.", + "schema": { + "$ref": "#/definitions/OperationListResult" + } + }, + "default": { + "description": "Resource Provider error response describing why the operation failed.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + } + }, + "definitions": { + "Workspace": { + "properties": { + "properties": { + "x-ms-client-flatten": true, + "$ref": "#/definitions/WorkspaceProperties", + "description": "The workspace properties." + }, + "sku": { + "$ref": "#/definitions/Sku", + "description": "The SKU of the resource." + } + }, + "required": [ + "properties" + ], + "allOf": [ + { + "$ref": "#/definitions/TrackedResource" + } + ], + "description": "Information about workspace." + }, + "WorkspaceProperties": { + "properties": { + "managedResourceGroupId": { + "type": "string", + "description": "The managed resource group Id." + }, + "parameters": { + "$ref": "#/definitions/WorkspaceCustomParameters", + "description": "The workspace's custom parameters." + }, + "provisioningState": { + "readOnly": true, + "$ref": "#/definitions/ProvisioningState", + "description": "The workspace provisioning state." + }, + "uiDefinitionUri": { + "type": "string", + "description": "The blob URI where the UI definition file is located." + }, + "authorizations": { + "description": "The workspace provider authorizations.", + "type": "array", + "items": { + "$ref": "#/definitions/WorkspaceProviderAuthorization" + } + }, + "createdBy": { + "description": "Indicates the Object ID, PUID and Application ID of entity that created the workspace.", + "$ref": "#/definitions/CreatedBy" + }, + "updatedBy": { + "description": "Indicates the Object ID, PUID and Application ID of entity that last updated the workspace.", + "$ref": "#/definitions/CreatedBy" + }, + "createdDateTime": { + "description": "Specifies the date and time when the workspace is created.", + "$ref": "#/definitions/CreatedDateTime" + }, + "workspaceId": { + "readOnly": true, + "description": "The unique identifier of the databricks workspace in databricks control plane.", + "type": "string" + }, + "workspaceUrl": { + "readOnly": true, + "description": "The workspace URL which is of the format 'adb-{workspaceId}.{random}.azuredatabricks.net'", + "type": "string" + }, + "storageAccountIdentity": { + "description": "The details of Managed Identity of Storage Account", + "$ref": "#/definitions/ManagedIdentityConfiguration" + } + }, + "required": [ + "managedResourceGroupId" + ], + "description": "The workspace properties." + }, + "TrackedResource": { + "description": "The resource model definition for a ARM tracked top level resource", + "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" + } + ] + }, + "Resource": { + "description": "The core properties of ARM resources", + "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. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts." + } + }, + "x-ms-azure-resource": true + }, + "Sku": { + "properties": { + "name": { + "type": "string", + "description": "The SKU name." + }, + "tier": { + "type": "string", + "description": "The SKU tier." + } + }, + "required": [ + "name" + ], + "description": "SKU for the resource." + }, + "ProvisioningState": { + "description": "Provisioning status of the workspace.", + "readOnly": true, + "enum": [ + "Accepted", + "Running", + "Ready", + "Creating", + "Created", + "Deleting", + "Deleted", + "Canceled", + "Failed", + "Succeeded", + "Updating" + ], + "type": "string", + "x-ms-enum": { + "name": "ProvisioningState", + "modelAsString": true + } + }, + "PeeringProvisioningState": { + "type": "string", + "readOnly": true, + "description": "The current provisioning state.", + "enum": [ + "Succeeded", + "Updating", + "Deleting", + "Failed" + ], + "x-ms-enum": { + "name": "PeeringProvisioningState", + "modelAsString": true + } + }, + "ManagedIdentityConfiguration": { + "description": "The Managed Identity details for storage account.", + "properties": { + "principalId": { + "type": "string", + "format": "uuid", + "description": "The objectId of the Managed Identity that is linked to the Managed Storage account.", + "readOnly": true + }, + "tenantId": { + "type": "string", + "format": "uuid", + "description": "The tenant Id where the Managed Identity is created.", + "readOnly": true + }, + "type": { + "type": "string", + "description": "The type of Identity created. It can be either SystemAssigned or UserAssigned.", + "readOnly": true + } + } + }, + "WorkspaceCustomParameterType": { + "description": "Provisioning status of the workspace.", + "readOnly": true, + "enum": [ + "Bool", + "Object", + "String" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomParameterType", + "modelAsString": true + } + }, + "WorkspaceCustomBooleanParameter": { + "properties": { + "type": { + "$ref": "#/definitions/WorkspaceCustomParameterType", + "description": "The type of variable that this is" + }, + "value": { + "type": "boolean", + "description": "The value which should be used for this field." + } + }, + "required": [ + "value" + ], + "description": "The value which should be used for this field." + }, + "WorkspaceCustomObjectParameter": { + "properties": { + "type": { + "$ref": "#/definitions/WorkspaceCustomParameterType", + "description": "The type of variable that this is" + }, + "value": { + "type": "object", + "description": "The value which should be used for this field." + } + }, + "required": [ + "value" + ], + "description": "The value which should be used for this field." + }, + "WorkspaceCustomStringParameter": { + "properties": { + "type": { + "$ref": "#/definitions/WorkspaceCustomParameterType", + "description": "The type of variable that this is" + }, + "value": { + "type": "string", + "description": "The value which should be used for this field." + } + }, + "required": [ + "value" + ], + "description": "The Value." + }, + "WorkspaceCustomParameters": { + "properties": { + "customVirtualNetworkId": { + "$ref": "#/definitions/WorkspaceCustomStringParameter", + "description": "The ID of a Virtual Network where this Databricks Cluster should be created" + }, + "customPublicSubnetName": { + "$ref": "#/definitions/WorkspaceCustomStringParameter", + "description": "The name of a Public Subnet within the Virtual Network" + }, + "customPrivateSubnetName": { + "$ref": "#/definitions/WorkspaceCustomStringParameter", + "description": "The name of the Private Subnet within the Virtual Network" + }, + "enableNoPublicIp": { + "$ref": "#/definitions/WorkspaceCustomBooleanParameter", + "description": "Should the Public IP be Disabled?" + }, + "prepareEncryption": { + "$ref": "#/definitions/WorkspaceCustomBooleanParameter", + "description": "Prepare the workspace for encryption. Enables the Managed Identity for managed storage account." + }, + "encryption": { + "$ref": "#/definitions/WorkspaceEncryptionParameter", + "description": "Contains the encryption details for Customer-Managed Key (CMK) enabled workspace." + } + }, + "description": "Custom Parameters used for Cluster Creation." + }, + "CreatedDateTime": { + "type": "string", + "format": "date-time", + "description": "The date and time stamp when the workspace was created.", + "readOnly": true + }, + "CreatedBy": { + "properties": { + "oid": { + "type": "string", + "format": "uuid", + "description": "The Object ID that created the workspace.", + "readOnly": true + }, + "puid": { + "type": "string", + "description": "The Personal Object ID corresponding to the object ID above", + "readOnly": true + }, + "applicationId": { + "type": "string", + "format": "uuid", + "description": "The application ID of the application that initiated the creation of the workspace. For example, Azure Portal.", + "readOnly": true + } + }, + "description": "Provides details of the entity that created/updated the workspace." + }, + "WorkspaceEncryptionParameter": { + "properties": { + "type": { + "$ref": "#/definitions/WorkspaceCustomParameterType", + "description": "The type of variable that this is" + }, + "value": { + "$ref": "#/definitions/Encryption", + "description": "The value which should be used for this field." + } + }, + "description": "The object that contains details of encryption used on the workspace." + }, + "Encryption": { + "properties": { + "keySource": { + "type": "string", + "description": "The encryption keySource (provider). Possible values (case-insensitive): Default, Microsoft.Keyvault", + "enum": [ + "Default", + "Microsoft.Keyvault" + ], + "x-ms-enum": { + "name": "KeySource", + "modelAsString": true + }, + "default": "Default" + }, + "KeyName": { + "type": "string", + "description": "The name of KeyVault key." + }, + "keyversion": { + "type": "string", + "description": "The version of KeyVault key.", + "x-ms-client-name": "KeyVersion" + }, + "keyvaulturi": { + "type": "string", + "description": "The Uri of KeyVault.", + "x-ms-client-name": "KeyVaultUri" + } + }, + "description": "The object that contains details of encryption used on the workspace." + }, + "WorkspaceProviderAuthorization": { + "properties": { + "principalId": { + "type": "string", + "format": "uuid", + "description": "The provider's principal identifier. This is the identity that the provider will use to call ARM to manage the workspace resources." + }, + "roleDefinitionId": { + "type": "string", + "format": "uuid", + "description": "The provider's role definition identifier. This role will define all the permissions that the provider must have on the workspace's container resource group. This role definition cannot have permission to delete the resource group." + } + }, + "required": [ + "principalId", + "roleDefinitionId" + ], + "description": "The workspace provider authorization." + }, + "WorkspaceUpdate": { + "description": "An update to a workspace.", + "type": "object", + "properties": { + "tags": { + "description": "Resource tags.", + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + }, + "ErrorDetail": { + "title": "Error details.", + "type": "object", + "properties": { + "code": { + "description": "The error's code.", + "type": "string" + }, + "message": { + "description": "A human readable error message.", + "type": "string" + }, + "target": { + "description": "Indicates which property in the request is responsible for the error.", + "type": "string" + } + }, + "required": [ + "code", + "message" + ] + }, + "ErrorInfo": { + "title": "The code and message for an error.", + "type": "object", + "properties": { + "code": { + "description": "A machine readable error code.", + "type": "string" + }, + "message": { + "description": "A human readable error message.", + "type": "string" + }, + "details": { + "description": "error details.", + "type": "array", + "items": { + "$ref": "#/definitions/ErrorDetail" + } + }, + "innererror": { + "description": "Inner error details if they exist.", + "type": "string" + } + }, + "required": [ + "code", + "message" + ] + }, + "ErrorResponse": { + "title": "Error response.", + "description": "Contains details when the response code indicates an error.", + "type": "object", + "properties": { + "error": { + "description": "The error details.", + "$ref": "#/definitions/ErrorInfo" + } + }, + "required": [ + "error" + ] + }, + "WorkspaceListResult": { + "properties": { + "value": { + "type": "array", + "items": { + "$ref": "#/definitions/Workspace" + }, + "description": "The array of workspaces." + }, + "nextLink": { + "type": "string", + "description": "The URL to use for getting the next set of results." + } + }, + "description": "List of workspaces." + }, + "Operation": { + "description": "REST API operation", + "type": "object", + "properties": { + "name": { + "description": "Operation name: {provider}/{resource}/{operation}", + "type": "string" + }, + "display": { + "description": "The object that represents the operation.", + "properties": { + "provider": { + "description": "Service provider: Microsoft.ResourceProvider", + "type": "string" + }, + "resource": { + "description": "Resource on which the operation is performed.", + "type": "string" + }, + "operation": { + "description": "Operation type: Read, write, delete, etc.", + "type": "string" + } + } + } + } + }, + "OperationListResult": { + "description": "Result of the request to list Resource Provider operations. It contains a list of operations and a URL link to get the next set of results.", + "properties": { + "value": { + "type": "array", + "items": { + "$ref": "#/definitions/Operation" + }, + "description": "List of Resource Provider operations supported by the Resource Provider resource provider." + }, + "nextLink": { + "type": "string", + "description": "URL to get the next set of operation list results if there are any." + } + } + }, + "VirtualNetworkPeeringList": { + "properties": { + "value": { + "type": "array", + "items": { + "$ref": "#/definitions/VirtualNetworkPeering" + }, + "description": "List of virtual network peerings on workspace." + }, + "nextLink": { + "type": "string", + "description": "URL to get the next set of virtual network peering list results if there are any." + } + }, + "description": "Gets all virtual network peerings under a workspace." + }, + "VirtualNetworkPeering": { + "properties": { + "properties": { + "x-ms-client-flatten": true, + "$ref": "#/definitions/VirtualNetworkPeeringPropertiesFormat", + "description": "List of properties for vNet Peering" + }, + "name": { + "type": "string", + "description": "Name of the virtual network peering resource", + "readOnly": true + }, + "id": { + "type": "string", + "description": "Resource ID.", + "readOnly": true + }, + "type": { + "type": "string", + "description": "type of the virtual network peering resource", + "readOnly": true + } + }, + "required": [ + "properties" + ], + "description": "Peerings in a VirtualNetwork resource", + "x-ms-azure-resource": true + }, + "VirtualNetworkPeeringPropertiesFormat": { + "properties": { + "allowVirtualNetworkAccess": { + "type": "boolean", + "description": "Whether the VMs in the local virtual network space would be able to access the VMs in remote virtual network space." + }, + "allowForwardedTraffic": { + "type": "boolean", + "description": "Whether the forwarded traffic from the VMs in the local virtual network will be allowed/disallowed in remote virtual network." + }, + "allowGatewayTransit": { + "type": "boolean", + "description": "If gateway links can be used in remote virtual networking to link to this virtual network." + }, + "useRemoteGateways": { + "type": "boolean", + "description": "If remote gateways can be used on this virtual network. If the flag is set to true, and allowGatewayTransit on remote peering is also true, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set to true. This flag cannot be set if virtual network already has a gateway." + }, + "databricksVirtualNetwork": { + "properties": { + "id": { + "type": "string", + "description": "The Id of the databricks virtual network." + } + }, + "description": " The remote virtual network should be in the same region. See here to learn more (https://docs.microsoft.com/en-us/azure/databricks/administration-guide/cloud-configurations/azure/vnet-peering)." + }, + "databricksAddressSpace": { + "$ref": "#/definitions/AddressSpace", + "description": "The reference to the databricks virtual network address space." + }, + "remoteVirtualNetwork": { + "properties": { + "id": { + "type": "string", + "description": "The Id of the remote virtual network." + } + }, + "description": " The remote virtual network should be in the same region. See here to learn more (https://docs.microsoft.com/en-us/azure/databricks/administration-guide/cloud-configurations/azure/vnet-peering)." + }, + "remoteAddressSpace": { + "$ref": "#/definitions/AddressSpace", + "description": "The reference to the remote virtual network address space." + }, + "peeringState": { + "type": "string", + "description": "The status of the virtual network peering.", + "enum": [ + "Initiated", + "Connected", + "Disconnected" + ], + "x-ms-enum": { + "name": "peeringState", + "modelAsString": true + }, + "readOnly": true + }, + "provisioningState": { + "readOnly": true, + "$ref": "#/definitions/PeeringProvisioningState", + "description": "The provisioning state of the virtual network peering resource." + } + }, + "required": [ + "remoteVirtualNetwork" + ], + "description": "Properties of the virtual network peering." + }, + "AddressSpace": { + "properties": { + "addressPrefixes": { + "type": "array", + "items": { + "type": "string" + }, + "description": "A list of address blocks reserved for this virtual network in CIDR notation." + } + }, + "description": "AddressSpace contains an array of IP address ranges that can be used by subnets of the virtual network." + } + }, + "parameters": { + "SubscriptionIdParameter": { + "name": "subscriptionId", + "in": "path", + "required": true, + "type": "string", + "description": "The ID of the target subscription." + }, + "ApiVersionParameter": { + "name": "api-version", + "in": "query", + "required": true, + "type": "string", + "description": "The API version to use for this operation." + }, + "ResourceGroupName": { + "name": "resourceGroupName", + "in": "path", + "required": true, + "type": "string", + "description": "The name of the resource group. The name is case insensitive.", + "pattern": "^[-\\w\\._\\(\\)]+$", + "minLength": 1, + "maxLength": 90, + "x-ms-parameter-location": "method" + }, + "WorkspaceName": { + "name": "workspaceName", + "in": "path", + "required": true, + "type": "string", + "description": "The name of the workspace.", + "minLength": 3, + "maxLength": 64, + "x-ms-parameter-location": "method" + }, + "PeeringNameParameter": { + "name": "peeringName", + "in": "path", + "required": true, + "type": "string", + "description": "The name of the workspace vNet peering.", + "x-ms-parameter-location": "method" + } + } + } \ No newline at end of file From ecb8d33465e27fe9f83d9d52754c78acd2ea1237 Mon Sep 17 00:00:00 2001 From: Youri Date: Wed, 22 Jul 2020 15:10:43 +0800 Subject: [PATCH 8/8] Update the script --- tests-upgrade/AutoRestUpgradeTest.ps1 | 217 +++++++++++------- tests-upgrade/Configuration.json | 35 ++- .../basic-disableazure-get/readme.md | 13 ++ .../basic-disableazure-get/swagger.json | 53 +++++ .../basic-disableazure-response/readme.md | 13 ++ .../basic-disableazure-response/swagger.json | 61 +++++ 6 files changed, 303 insertions(+), 89 deletions(-) create mode 100644 tests-upgrade/basic-disableazure-get/readme.md create mode 100644 tests-upgrade/basic-disableazure-get/swagger.json create mode 100644 tests-upgrade/basic-disableazure-response/readme.md create mode 100644 tests-upgrade/basic-disableazure-response/swagger.json diff --git a/tests-upgrade/AutoRestUpgradeTest.ps1 b/tests-upgrade/AutoRestUpgradeTest.ps1 index e6b2cc46e01..c5d01e21166 100644 --- a/tests-upgrade/AutoRestUpgradeTest.ps1 +++ b/tests-upgrade/AutoRestUpgradeTest.ps1 @@ -1,29 +1,28 @@ -param([switch]$Generate,[string]$TestName,[switch]$M3,[switch]$M4,[switch]$AllowList,[switch]$BlackList) -#need to use the right version of node.js -# nvs use 10.16.0 -# #please use substring to select the compare path -# $m3Path='.\generate\m3' -# $m4Path='.\generate\m4' -$scriptPath = Get-Location +param([switch]$Generate,[string]$TestName,[switch]$SourceVersion,[switch]$TargetVersion,[switch]$AllowList,[switch]$BlackList) +#Need to use the right version of node.js +#nvs use 10.16.0 +#Create folder to save Compare Results +New-Item CompareResult -ItemType "directory" +#Define the global param 'isError' to determine wheather throw the error $global:isError = $false +#Import the Configuration Json $conf = (Get-Content 'Configuration.json') | ConvertFrom-Json -$conf if($AllowList) { - # $configurationFileName = $scriptPath.path +'\AllowListConfiguration.csv' - # $testList = import-Csv $configurationFileName - $testList = $conf.WhiteList + #Get the whiteList from json + $whiteList = $conf.WhiteList } if($BlackList) { - # $blackConfigurationFileName = $scriptPath.path +'\BlackListConfiguration.csv' - # $blackTestList = import-Csv $blackConfigurationFileName + #Get the blackList from json $blackTestList = $conf.BlackList } -function isCommand([Object]$Object1 , [Object]$Object2) + +#Determine whether the difference is command +function IsCommand([Object]$SourceFile , [Object]$TargetFile) { $isCommandResult = $True - $difference = Compare-Object $Object1 $Object2 + $difference = Compare-Object $SourceFile $TargetFile foreach($line in $difference) { $lineInfo = $line.InputObject.Replace(' ','') @@ -37,7 +36,8 @@ function isCommand([Object]$Object1 , [Object]$Object2) return $isCommandResult } -function isNeedIgnore([string]$inputFileName , [Array]$ignoreArray) +#Determine whether the file needs to be ignored +function IsNeedIgnore([string]$inputFileName , [Array]$ignoreArray) { $Ignore = $false foreach($ignoreDetail in $ignoreArray) @@ -47,46 +47,62 @@ function isNeedIgnore([string]$inputFileName , [Array]$ignoreArray) $Ignore =$True break } - } + } return $Ignore } -function Generate() +#Code generation +function GenerateCode() { - ##m3 and m4 all need to be generated - if((-not $M3) -and (-not $M4)) + $GenerateResult=$Ture + #source and generate codes all need to be generated + if((-not $SourceVersion) -and (-not $TargetVersion)) { - ##generate m3 code - autorest-beta --use:@autorest/powershell@2.1.386 --output-folder:.\generate\m3 --Debug - ##generate m4 code - autorest-beta --use:..\..\ --output-folder:.\generate\m4 --Debug - }elseif($M3) + #generate source code + Write-Host -ForegroundColor Green 'M3' + $GenerateSourceResult = autorest-beta --use:@autorest/powershell@2.1.386 --output-folder:.\generate\m3 --Debug | Out-string + #generate target code + Write-Host -ForegroundColor Green 'M4' + $GenerateTargetResult = autorest-beta --use:..\..\ --output-folder:.\generate\m4 --Debug | Out-string + if(!$GenerateSourceResult.Contains('Generation Complete') -or !$GenerateTargetResult.Contains('Generation Complete')) + { + $GenerateResult = $false + } + }elseif($SourceVersion) { - autorest-beta --use:@autorest/powershell@2.1.386 --output-folder:.\generate\m3 --Debug + Write-Host -ForegroundColor Green 'M3' + $GenerateSourceResult = autorest-beta --use:@autorest/powershell@2.1.386 --output-folder:.\generate\m3 --Debug | Out-string + if(!$GenerateSourceResult.Contains('Generation Complete')) + { + $GenerateResult = $false + } }else { - autorest-beta --use:..\..\ --output-folder:.\generate\m4 --Debug + Write-Host -ForegroundColor Green 'M4' + $GenerateTargetResult = autorest-beta --use:..\..\ --output-folder:.\generate\m4 --Debug | Out-string + if(!$GenerateTargetResult.Contains('Generation Complete')) + { + $GenerateResult = $false + } } + return $GenerateResult } -function CompareTest([string]$inputm3Path,[string]$inputm4Path,[string]$testFileName) +#Compare the gap between the two versions +function CompareGeneratedCode([string]$inputSourcePath,[string]$inputTargetPath,[string]$testFileName) { - $testFileName #to creare ecah dictionary (the struct is (string,obj)) #the key is the path of each file,and the obj has two parameters(hashcodevalue,status) $initialDict = @{} #in m3Path - cd $inputm3Path + cd $inputSourcePath $initFileList = Get-ChildItem -Recurse -force - # $initIgnoreFileList = $inputm3Path + '\generated\modules' - # $targetIgnoreFileList = $inputm4Path + '\generated\modules' - $initIgnoreFileList = (($inputm3Path+'\generated\modules'), ($inputm3Path+'\.gitignore')) - $targetIgnoreFileList = (($inputm4Path+'\generated\modules'), ($inputm4Path+'\.gitignore')) - # $initFileList + $initIgnoreFileList = (($inputSourcePath+'\generated\modules'), ($inputSourcePath+'\.gitignore'),($inputSourcePath+'\tools\Resources\.gitignore')) + $targetIgnoreFileList = (($inputTargetPath+'\generated\modules'), ($inputTargetPath+'\.gitignore'),($inputTargetPath+'\tools\Resources\.gitignore')) #foreach initFileList and get the hashcode of them foreach( $initFile in $initFileList) { - $ignoreResult = isNeedIgnore -inputFileName $initFile.FullName -ignoreArray $initIgnoreFileList + $ignoreResult = IsNeedIgnore -inputFileName $initFile.FullName -ignoreArray $initIgnoreFileList if(!$ignoreResult) { # if(!$initFile.FullName.Startswith($initIgnoreFileList)){ @@ -100,19 +116,19 @@ function CompareTest([string]$inputm3Path,[string]$inputm4Path,[string]$testFile # $hashTable $obj.HashCode = $hashTable.Hash #get the path of the file - $detailPath = $hashTable.Path.Replace($inputm3Path,'') + $detailPath = $hashTable.Path.Replace($inputSourcePath,'') $initialDict.Add($detailPath,$obj) } } } $targetDict = @{} - #in m4Path - cd $inputm4Path + #in TargetPath + cd $inputTargetPath $targetFileList = Get-ChildItem -Recurse -force #foreach initFileList and get the hashcode of them foreach( $targetFile in $targetFileList) { - $ignoreResult = isNeedIgnore -inputFileName $targetFile.FullName -ignoreArray $targetIgnoreFileList + $ignoreResult = IsNeedIgnore -inputFileName $targetFile.FullName -ignoreArray $targetIgnoreFileList if(!$ignoreResult) { $obj = "waht2" | Select-Object -Property HashCode, Status @@ -123,7 +139,7 @@ function CompareTest([string]$inputm3Path,[string]$inputm4Path,[string]$testFile $hashTable = $targetFile.PSPath.Replace('Microsoft.PowerShell.Core\FileSystem::','') | get-filehash $obj.HashCode = $hashTable.Hash #get the path of the file - $detailPath = $hashTable.path.Replace($inputm4Path,'') + $detailPath = $hashTable.path.Replace($inputTargetPath,'') $targetDict.Add($detailPath,$obj) } } @@ -150,9 +166,9 @@ function CompareTest([string]$inputm3Path,[string]$inputm4Path,[string]$testFile $difArray+= $difDetail }elseif($targetDict[$initDictDetail].HashCode -ne $initialDict[$initDictDetail].HashCode) { - $M3CompareFile = Get-Content ($inputm3Path + $initDictDetail) - $M4CompareFile = Get-Content ($inputm4Path + $initDictDetail) - $isCommandResult = isCommand -Object1 $M3CompareFile -Object2 $M4CompareFile + $M3CompareFile = Get-Content ($inputSourcePath + $initDictDetail) + $M4CompareFile = Get-Content ($inputTargetPath + $initDictDetail) + $isCommandResult = IsCommand -SourceFile $M3CompareFile -TargetFile $M4CompareFile if( $isCommandResult -ne $True) { $difDetail.Path = $initDictDetail @@ -193,7 +209,8 @@ function CompareTest([string]$inputm3Path,[string]$inputm4Path,[string]$testFile { $global:isError=$True } - $filename = $scriptPath.Path + '\CompareResult\' + $testFileName + (get-date -format 'yyyyMMddhhmmss')+'.csv' + #Export the differ csv to the 'CompareResult' folder + $filename = $PSScriptRoot + '\CompareResult\' + $testFileName + (get-date -format 'yyyyMMddhhmmss')+'.csv' $difArray | Select-Object -Property fileName,Path,fileFolderName,Status | Export-CSV -path $filename } @@ -202,55 +219,69 @@ $fileList = Get-ChildItem #if only one case if($TestName -ne $null -and ($TestName -ne '')) { - $currentDetailPath = Get-Location - cd ($currentDetailPath.Path+'\'+$TestName) - $deatilPath = $currentDetailPath.Path + 'generate' - Generate - if(-not $Generate) + cd ($PSScriptRoot+'\'+$TestName) + $deatilPath = $PSScriptRoot + 'generate' + try + { + $IsGenerateSuccess = GenerateCode + if(-not $Generate -and $IsGenerateSuccess) + { + $sourceFilePath = $PSScriptRoot +'\'+$TestName + '\generate\m3' + $targetFilePath = $PSScriptRoot +'\'+$TestName + '\generate\m4' + CompareGeneratedCode -inputSourcePath $sourceFilePath -inputTargetPath $targetFilePath -testFileName $TestName + } + } + catch { - $m3FilePath = $currentDetailPath.Path +'\'+$TestName + '\generate\m3' - $m4FilePath =$currentDetailPath.Path +'\'+$TestName + '\generate\m4' - CompareTest -inputm3Path $m3FilePath -inputm4Path $m4FilePath -testFileName $TestName + Write-Host -ForegroundColor yellow 'Generate error:' + $fileDetail.Name } }elseif($AllowList) { - $currentDetailPath = Get-Location - #get each testfolder - foreach($eachTest in $testList) + #get each testfolder in whiteList + foreach($eachTest in $whiteList) { - # Write-Host -ForegroundColor green $eachTest - # if(($fileDeatil.Mode -eq 'd----') -and ($fileDeatil.Name -eq $TestName)) - # { - cd ($currentDetailPath.Path+'\'+$eachTest) - $deatilPath = $currentDetailPath.Path + 'generate' - Generate - # } - if(-not $Generate) + $eachTest + cd ($PSScriptRoot+'\'+$eachTest) + $deatilPath = $PSScriptRoot + 'generate' + try { - $m3FilePath = $currentDetailPath.Path +'\'+$eachTest + '\generate\m3' - $m4FilePath =$currentDetailPath.Path +'\'+$eachTest + '\generate\m4' - CompareTest -inputm3Path $m3FilePath -inputm4Path $m4FilePath -testFileName $eachTest + $IsGenerateSuccess = GenerateCode + if(-not $Generate -and $IsGenerateSuccess) + { + $sourceFilePath = $PSScriptRoot +'\'+$eachTest + '\generate\m3' + $targetFilePath = $PSScriptRoot +'\'+$eachTest + '\generate\m4' + CompareGeneratedCode -inputSourcePath $sourceFilePath -inputTargetPath $targetFilePath -testFileName $eachTest + } + } + catch + { + Write-Host -ForegroundColor yellow 'Generate error:' + $fileDetail.Name } } }elseif($BlackList) { - $currentDetailPath = Get-Location - $currentDetailPath - #get each testfolder + #get each testfolder and except those tests in blacklist foreach($fileDetail in $fileList) { foreach($blackTestName in $blackTestList) { if(($fileDetail.Mode -eq 'd----') -and (!$fileDetail.Name.Startswith($blackTestName))) { - cd ($currentDetailPath.Path+'\'+$fileDetail.Name) - $deatilPath = $currentDetailPath.Path + 'generate' - Generate - if(-not $Generate) + try + { + cd ($PSScriptRoot+'\'+$fileDetail.Name) + $deatilPath = $PSScriptRoot + 'generate' + $IsGenerateSuccess = GenerateCode + if(-not $Generate -and $IsGenerateSuccess) + { + $sourceFilePath = $PSScriptRoot +'\'+$fileDetail.Name + '\generate\m3' + $targetFilePath = $PSScriptRoot +'\'+$fileDetail.Name + '\generate\m4' + CompareGeneratedCode -inputSourcePath $sourceFilePath -inputTargetPath $targetFilePath -testFileName $fileDeatil.path + } + } + catch { - $m3FilePath = $currentDetailPath.Path +'\'+$fileDetail.Name + '\generate\m3' - $m4FilePath =$currentDetailPath.Path +'\'+$fileDetail.Name + '\generate\m4' - CompareTest -inputm3Path $m3FilePath -inputm4Path $m4FilePath -testFileName $fileDeatil.path + Write-Host -ForegroundColor yellow 'Generate error:' + $fileDetail.Name } } } @@ -260,25 +291,35 @@ else { foreach($fileDetail in $fileList) { - # $currentDetailPath = Get-Location if($fileDetail.Mode -eq 'd----' -and (!$fileDetail.Name.Startswith('Compare'))) { - $g1 = $scriptPath.Path +'\' +$fileDetail.Name - cd ($scriptPath.Path +'\' +$fileDetail.Name) - $deatilPath = $scriptPath.Path +'\' +$fileDetail.Name - Generate - if(-not $Generate) + $g1 = $PSScriptRoot +'\' +$fileDetail.Name + cd ($PSScriptRoot +'\' +$fileDetail.Name) + $deatilPath = $PSScriptRoot +'\' +$fileDetail.Name + try { - $m3FilePath = $deatilPath + '\generate\m3' - $m4FilePath = $deatilPath + '\generate\m4' - CompareTest -inputm3Path $m3FilePath -inputm4Path $m4FilePath -testFileName $fileDetail.Name - # CompareTest -inputm3Path (($currentDetailPath.Path +'\'+$fileDetail.Name+'\generate\m3') -inputm4Path ($currentDetailPath.Path +'\'+$fileDetail.Name+'\generate\m4')) -testFileName $fileDeatil.path + Write-Host -ForegroundColor Blue $fileDetail.Name + $IsGenerateSuccess = GenerateCode + if(-not $Generate -and $IsGenerateSuccess) + { + $sourceFilePath = $deatilPath + '\generate\m3' + $targetFilePath = $deatilPath + '\generate\m4' + CompareGeneratedCode -inputSourcePath $sourceFilePath -inputTargetPath $targetFilePath -testFileName $fileDetail.Name + } + } + catch + { + Write-Host -ForegroundColor yellow 'Generate error:' + $fileDetail.Name } } } } -cd $currentPath.Path +cd $PSScriptRoot +#Throw error if there are some different if($global:isError) { throw 'Error: The code generated by the target file is different from the code generated by the source file.' +}else +{ + Write-Host -ForegroundColor blue 'All generated codes are the same' } diff --git a/tests-upgrade/Configuration.json b/tests-upgrade/Configuration.json index ff193de0224..510add0a1fd 100644 --- a/tests-upgrade/Configuration.json +++ b/tests-upgrade/Configuration.json @@ -1,3 +1,36 @@ { - "WhiteList":["basic-get","basic-get-delete"] + "WhiteList": [ + "basic-disableazure-get", + "basic-disableazure-response" + ], + "BlackList": [ + "basic-get-querystr", + "basic-get-delete", + "basic-get-delete-put-patch", + "basic-request-methods", + "basic-get-response-operation", + "basic-response-multioperation", + "basic-response-defaultoperation", + "basic-disableazure-get", + "component-param", + "component-multiparam", + "component-param-remote", + "component--param-localremote", + "component-param-inbody", + "component-definitions-local", + "component-definitions-remote", + "component-definitions-combined", + "datamodels-datatypes-mixedtypes", + "datamodels-datatypes-integer", + "datamodels-datatypes-string", + "datamodels-datatypes-nullable", + "datamodels-datatypes-array", + "datamodels-datatypes-object", + "datamodels-datatypes-file", + "datamodels-datatypes-anytype", + "datamodels-enums", + "datamodels-keyvalue", + "datamodels-combineschema", + "datamodels-inheritpolymorphism" + ] } \ No newline at end of file diff --git a/tests-upgrade/basic-disableazure-get/readme.md b/tests-upgrade/basic-disableazure-get/readme.md new file mode 100644 index 00000000000..f64f8c74647 --- /dev/null +++ b/tests-upgrade/basic-disableazure-get/readme.md @@ -0,0 +1,13 @@ +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +require: + - $(this-folder)/../readme.azure.noprofile.md + +azure: false + +input-file: + - $(this-folder)/swagger.json + +``` diff --git a/tests-upgrade/basic-disableazure-get/swagger.json b/tests-upgrade/basic-disableazure-get/swagger.json new file mode 100644 index 00000000000..ec29bdce647 --- /dev/null +++ b/tests-upgrade/basic-disableazure-get/swagger.json @@ -0,0 +1,53 @@ +{ + + "swagger": "2.0", + "info": { + "title": "AutoRestUpgradeClient", + "version": "2018-04-01", + "description": "ARM AutoRestUpgrade" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "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/resourceGroup": { + "get": { + "tags": [ + "Workspaces" + ], + "operationId": "Workspaces_Get", + "description": "Gets the workspace.", + "responses": { + "200": { + "description": "Ok-Return" + } + } + } + } + } +} \ No newline at end of file diff --git a/tests-upgrade/basic-disableazure-response/readme.md b/tests-upgrade/basic-disableazure-response/readme.md new file mode 100644 index 00000000000..f64f8c74647 --- /dev/null +++ b/tests-upgrade/basic-disableazure-response/readme.md @@ -0,0 +1,13 @@ +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +require: + - $(this-folder)/../readme.azure.noprofile.md + +azure: false + +input-file: + - $(this-folder)/swagger.json + +``` diff --git a/tests-upgrade/basic-disableazure-response/swagger.json b/tests-upgrade/basic-disableazure-response/swagger.json new file mode 100644 index 00000000000..4e3ddee1c72 --- /dev/null +++ b/tests-upgrade/basic-disableazure-response/swagger.json @@ -0,0 +1,61 @@ +{ + + "swagger": "2.0", + "info": { + "title": "AutoRestUpgradeClient", + "version": "2018-04-01", + "description": "ARM AutoRestUpgrade" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "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/resourceGroup": { + "get": { + "tags": [ + "Workspaces" + ], + "operationId": "Workspaces_Get", + "description": "Gets the workspace.", + "responses": { + "200": { + "description": "Ok-Return", + "schema": { + "$ref": "#/definitions/Workspaces" + } + } + } + } + } + }, + "definitions": { + "Workspaces": { + "type": "string" + } + } +} \ No newline at end of file