Skip to content

Commit

Permalink
make the script backward compat
Browse files Browse the repository at this point in the history
  • Loading branch information
RodgeFu committed Mar 15, 2024
1 parent 9ed39ea commit b62b859
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/extensions/openapi-to-typespec/convert.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ param(
[string]
# Specifies the swagger config file, not the swagger json, but the readme config.
$swaggerConfigFile,
[Parameter(Mandatory)]
[string]
# Specifies the corresponding autorest.md file in azure-sdk-for-net repo used by autorest.csharp codegen.
$csharpAutorestFile,
[string]
# Specified the output folder, deafult to current folder.
$outputFolder,
Expand All @@ -26,12 +22,18 @@ param(
$csharpCodegen = "https://aka.ms/azsdk/openapi-to-typespec-csharp",
[string]
# Specified the converter codegen, default to https://aka.ms/azsdk/openapi-to-typespec.
$converterCodegen = "."
)
$converterCodegen = ".",
[string]
# Specifies the corresponding autorest.md file in the azure-sdk-for-net repo so that the convert will load it instead of the swagger config file when generating metadata which would include more csharp configurations (i.e. rename rules)
$csharpAutorestFile = "")

function GenerateMetadata ()
{
Write-Host "##Generating metadata with csharp codegen in $outputFolder with $csharpCodegen"
if($csharpAutorestFile -eq "")
{
$csharpAutorestFile = $swaggerConfigFile
}
$cmd = "autorest --version=3.10.1 --csharp --isAzureSpec --isArm --max-memory-size=8192 --use=`"$csharpCodegen`" --output-folder=$outputFolder --mgmt-debug.only-generate-metadata --azure-arm --skip-csproj $csharpAutorestFile"
Write-Host "$cmd"
Invoke-Expression $cmd
Expand Down

0 comments on commit b62b859

Please sign in to comment.