diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 5e6140f3fc..ff2e57ba4d 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -8,7 +8,7 @@ This is a **multi-platform code generation tool** that wraps external OpenAPI/Sw - **Core**: Shared .NET libraries implementing `ICodeGenerator` interface pattern - **CLI Tool** (`rapicgen`): Cross-platform command-line interface - **IDE Extensions**: Visual Studio (VSIX), VS Code (TypeScript), Visual Studio for Mac, IntelliJ/Rider -- **External Dependencies**: Wraps NSwag, OpenAPI Generator (Java), Swagger Codegen (Java), AutoRest (NPM), Refitter (.NET), Kiota (.NET) +- **External Dependencies**: Wraps NSwag, OpenAPI Generator (Java), Swagger Codegen (Java), Refitter (.NET), Kiota (.NET) ### Key Design Patterns - **Factory Pattern**: `ICodeGeneratorFactory` creates generators based on `SupportedCodeGenerator` enum @@ -29,7 +29,7 @@ This is a **multi-platform code generation tool** that wraps external OpenAPI/Sw Install required dependencies in this order: - .NET 8.0 SDK (required for all builds and CLI tool) - Java 17+ Runtime (required for code generators like Swagger Codegen, OpenAPI Generator) -- Node.js v20+ and NPM (required for VSCode extension and some code generators) +- Node.js v20+ and NPM (required for VSCode extension) Verify installations: ```bash @@ -241,7 +241,7 @@ src/ ### External Tool Integration Patterns **Dependency Installation Strategy** (`DependencyInstaller`): -- **NPM tools** (AutoRest, NSwag): Install via `npm install -g package-name` +- **NPM tools** (NSwag): Install via `npm install -g package-name` - **Java tools** (OpenAPI Generator, Swagger): Download JAR files with SHA verification - **.NET tools** (Kiota, Refitter): Install via `dotnet tool install --global` - **Version checking**: Parse tool output to determine if updates needed diff --git a/.github/workflows/intellij.yml b/.github/workflows/intellij.yml index df92dc8fde..13e7bd50cb 100644 --- a/.github/workflows/intellij.yml +++ b/.github/workflows/intellij.yml @@ -3,12 +3,12 @@ name: IntelliJ Plugin on: push: paths: - - 'src/IntelliJ/**' - - '.github/workflows/intellij.yml' + - "src/IntelliJ/**" + - ".github/workflows/intellij.yml" pull_request: paths: - - 'src/IntelliJ/**' - - '.github/workflows/intellij.yml' + - "src/IntelliJ/**" + - ".github/workflows/intellij.yml" env: VERSION: 1.41.${{ github.run_number }} @@ -41,9 +41,6 @@ jobs: - name: Build IntelliJ Plugin working-directory: src/IntelliJ run: ./gradlew buildPlugin --no-daemon - - name: Verify IntelliJ Plugin - working-directory: src/IntelliJ - run: ./gradlew verifyPlugin --no-daemon - name: Archive plugin artifact uses: actions/upload-artifact@v7 with: diff --git a/.github/workflows/production-tests.yml b/.github/workflows/production-tests.yml index ac3afb4675..893f4d1660 100644 --- a/.github/workflows/production-tests.yml +++ b/.github/workflows/production-tests.yml @@ -16,11 +16,10 @@ jobs: name: C# runs-on: ${{ matrix.os }} - continue-on-error: ${{ matrix.os == 'macos-10.15' || matrix.os == 'macos-12' || matrix.node == 12 }} + continue-on-error: ${{ matrix.os == 'macos-10.15' || matrix.os == 'macos-12' }} strategy: fail-fast: false matrix: - node: [12, 14, 15, 16, 18, 20] format: [ json, yaml ] version: [ V2, V3 ] os: [ @@ -36,10 +35,6 @@ jobs: steps: - uses: actions/checkout@v6 - - uses: actions/setup-node@v6 - with: - node-version: ${{ matrix.node }} - - name: Set up JDK 17 uses: actions/setup-java@v5 with: @@ -233,64 +228,6 @@ jobs: run: dotnet build ./GeneratedCode/SwaggerCodegen/NetStandard21/NetStandard21.csproj working-directory: test - - name: Generate code with AutoRest - run: | - rapicgen csharp autorest ./OpenApi.${{ matrix.format }} GeneratedCode ./GeneratedCode/AutoRest-${{ matrix.version }}/Output.cs --no-logging - cp ./GeneratedCode/AutoRest-${{ matrix.version }}/Output.cs ./GeneratedCode/AutoRest-${{ matrix.version }}/Net6/Output.cs - cp ./GeneratedCode/AutoRest-${{ matrix.version }}/Output.cs ./GeneratedCode/AutoRest-${{ matrix.version }}/Net7/Output.cs - cp ./GeneratedCode/AutoRest-${{ matrix.version }}/Output.cs ./GeneratedCode/AutoRest-${{ matrix.version }}/Net8/Output.cs - cp ./GeneratedCode/AutoRest-${{ matrix.version }}/Output.cs ./GeneratedCode/AutoRest-${{ matrix.version }}/Net9/Output.cs - cp ./GeneratedCode/AutoRest-${{ matrix.version }}/Output.cs ./GeneratedCode/AutoRest-${{ matrix.version }}/Net48/Output.cs - cp ./GeneratedCode/AutoRest-${{ matrix.version }}/Output.cs ./GeneratedCode/AutoRest-${{ matrix.version }}/Net472/Output.cs - cp ./GeneratedCode/AutoRest-${{ matrix.version }}/Output.cs ./GeneratedCode/AutoRest-${{ matrix.version }}/Net462/Output.cs - cp ./GeneratedCode/AutoRest-${{ matrix.version }}/Output.cs ./GeneratedCode/AutoRest-${{ matrix.version }}/Net481/Output.cs - cp ./GeneratedCode/AutoRest-${{ matrix.version }}/Output.cs ./GeneratedCode/AutoRest-${{ matrix.version }}/NetStandard20/Output.cs - cp ./GeneratedCode/AutoRest-${{ matrix.version }}/Output.cs ./GeneratedCode/AutoRest-${{ matrix.version }}/NetStandard21/Output.cs - working-directory: test - continue-on-error: true - - - name: Build .NET 6 AutoRest generated code - run: dotnet build ./GeneratedCode/AutoRest-${{ matrix.version }}/Net6/Net6.csproj - working-directory: test - - - name: Build .NET 7 AutoRest generated code - run: dotnet build ./GeneratedCode/AutoRest-${{ matrix.version }}/Net7/Net7.csproj - working-directory: test - - - name: Build .NET 8 AutoRest generated code - run: dotnet build ./GeneratedCode/AutoRest-${{ matrix.version }}/Net8/Net8.csproj - working-directory: test - - - name: Build .NET 9 AutoRest generated code - run: dotnet build ./GeneratedCode/AutoRest-${{ matrix.version }}/Net9/Net9.csproj - working-directory: test - - - name: Build .NET 4.8.1 AutoRest generated code - run: dotnet build ./GeneratedCode/AutoRest-${{ matrix.version }}/Net481/Net481.csproj - if: ${{ matrix.version == 'V2' && matrix.os == 'windows-2022' }} - working-directory: test - - - name: Build .NET 4.8 AutoRest generated code - run: dotnet build ./GeneratedCode/AutoRest-${{ matrix.version }}/Net48/Net48.csproj - working-directory: test - - - name: Build .NET 4.7.2 AutoRest generated code - run: dotnet build ./GeneratedCode/AutoRest-${{ matrix.version }}/Net472/Net472.csproj - working-directory: test - - - name: Build .NET 4.6.2 AutoRest generated code - run: dotnet build ./GeneratedCode/AutoRest-${{ matrix.version }}/Net462/Net462.csproj - if: ${{ matrix.version == 'V2' }} - working-directory: test - - - name: Build .NET Standard 2.0 AutoRest generated code - run: dotnet build ./GeneratedCode/AutoRest-${{ matrix.version }}/NetStandard20/NetStandard20.csproj - working-directory: test - - - name: Build .NET Standard 2.1 AutoRest generated code - run: dotnet build ./GeneratedCode/AutoRest-${{ matrix.version }}/NetStandard21/NetStandard21.csproj - working-directory: test - - name: Generate code with Refitter run: | rapicgen csharp refitter ./OpenApi.${{ matrix.format }} GeneratedCode ./GeneratedCode/Refitter/Output.cs --no-logging diff --git a/.github/workflows/regression-tests.yml b/.github/workflows/regression-tests.yml index d5102ba61f..db2faeef17 100644 --- a/.github/workflows/regression-tests.yml +++ b/.github/workflows/regression-tests.yml @@ -17,11 +17,10 @@ jobs: name: C# runs-on: ${{ matrix.os }} - continue-on-error: ${{ matrix.os == 'macos-10.15' || matrix.os == 'macos-12' || matrix.node == 12 }} + continue-on-error: ${{ matrix.os == 'macos-10.15' || matrix.os == 'macos-12' }} strategy: fail-fast: false matrix: - node: [12, 14, 15, 16, 18, 20] format: [ json, yaml ] version: [ V2, V3 ] os: [ @@ -37,10 +36,6 @@ jobs: steps: - uses: actions/checkout@v6 - - uses: actions/setup-node@v6 - with: - node-version: ${{ matrix.node }} - - name: Set up JDK 17 uses: actions/setup-java@v5 with: @@ -231,64 +226,6 @@ jobs: run: dotnet build ./GeneratedCode/SwaggerCodegen/NetStandard21/NetStandard21.csproj working-directory: test - - name: Generate code with AutoRest - run: | - dotnet run --project ../src/CLI/ApiClientCodeGen.CLI/ApiClientCodeGen.CLI.csproj -- csharp autorest ./OpenApi.${{ matrix.format }} GeneratedCode ./GeneratedCode/AutoRest-${{ matrix.version }}/Output.cs --no-logging - cp ./GeneratedCode/AutoRest-${{ matrix.version }}/Output.cs ./GeneratedCode/AutoRest-${{ matrix.version }}/Net6/Output.cs - cp ./GeneratedCode/AutoRest-${{ matrix.version }}/Output.cs ./GeneratedCode/AutoRest-${{ matrix.version }}/Net7/Output.cs - cp ./GeneratedCode/AutoRest-${{ matrix.version }}/Output.cs ./GeneratedCode/AutoRest-${{ matrix.version }}/Net8/Output.cs - cp ./GeneratedCode/AutoRest-${{ matrix.version }}/Output.cs ./GeneratedCode/AutoRest-${{ matrix.version }}/Net9/Output.cs - cp ./GeneratedCode/AutoRest-${{ matrix.version }}/Output.cs ./GeneratedCode/AutoRest-${{ matrix.version }}/Net48/Output.cs - cp ./GeneratedCode/AutoRest-${{ matrix.version }}/Output.cs ./GeneratedCode/AutoRest-${{ matrix.version }}/Net472/Output.cs - cp ./GeneratedCode/AutoRest-${{ matrix.version }}/Output.cs ./GeneratedCode/AutoRest-${{ matrix.version }}/Net462/Output.cs - cp ./GeneratedCode/AutoRest-${{ matrix.version }}/Output.cs ./GeneratedCode/AutoRest-${{ matrix.version }}/Net481/Output.cs - cp ./GeneratedCode/AutoRest-${{ matrix.version }}/Output.cs ./GeneratedCode/AutoRest-${{ matrix.version }}/NetStandard20/Output.cs - cp ./GeneratedCode/AutoRest-${{ matrix.version }}/Output.cs ./GeneratedCode/AutoRest-${{ matrix.version }}/NetStandard21/Output.cs - working-directory: test - continue-on-error: true - - - name: Build .NET 6 AutoRest generated code - run: dotnet build ./GeneratedCode/AutoRest-${{ matrix.version }}/Net6/Net6.csproj - working-directory: test - - - name: Build .NET 7 AutoRest generated code - run: dotnet build ./GeneratedCode/AutoRest-${{ matrix.version }}/Net7/Net7.csproj - working-directory: test - - - name: Build .NET 8 AutoRest generated code - run: dotnet build ./GeneratedCode/AutoRest-${{ matrix.version }}/Net8/Net8.csproj - working-directory: test - - - name: Build .NET 9 AutoRest generated code - run: dotnet build ./GeneratedCode/AutoRest-${{ matrix.version }}/Net9/Net9.csproj - working-directory: test - - - name: Build .NET 4.8.1 AutoRest generated code - run: dotnet build ./GeneratedCode/AutoRest-${{ matrix.version }}/Net481/Net481.csproj - if: ${{ matrix.version == 'V2' && matrix.os == 'windows-2022' }} - working-directory: test - - - name: Build .NET 4.8 AutoRest generated code - run: dotnet build ./GeneratedCode/AutoRest-${{ matrix.version }}/Net48/Net48.csproj - working-directory: test - - - name: Build .NET 4.7.2 AutoRest generated code - run: dotnet build ./GeneratedCode/AutoRest-${{ matrix.version }}/Net472/Net472.csproj - working-directory: test - - - name: Build .NET 4.6.2 AutoRest generated code - run: dotnet build ./GeneratedCode/AutoRest-${{ matrix.version }}/Net462/Net462.csproj - if: ${{ matrix.version == 'V2' }} - working-directory: test - - - name: Build .NET Standard 2.0 AutoRest generated code - run: dotnet build ./GeneratedCode/AutoRest-${{ matrix.version }}/NetStandard20/NetStandard20.csproj - working-directory: test - - - name: Build .NET Standard 2.1 AutoRest generated code - run: dotnet build ./GeneratedCode/AutoRest-${{ matrix.version }}/NetStandard21/NetStandard21.csproj - working-directory: test - - name: Generate code with Kiota run: dotnet run --project ../src/CLI/ApiClientCodeGen.CLI/ApiClientCodeGen.CLI.csproj -- csharp kiota ./OpenApi.${{ matrix.format }} GeneratedCode ./GeneratedCode/Kiota/Output.cs --no-logging working-directory: test diff --git a/.github/workflows/smoke-tests.yml b/.github/workflows/smoke-tests.yml index a2e1f7b070..e699a92ccd 100644 --- a/.github/workflows/smoke-tests.yml +++ b/.github/workflows/smoke-tests.yml @@ -38,8 +38,6 @@ jobs: steps: - uses: actions/checkout@v6 - - uses: actions/setup-node@v6 - - name: Set up JDK 17 uses: actions/setup-java@v5 with: @@ -228,64 +226,6 @@ jobs: run: dotnet build ./GeneratedCode/SwaggerCodegen/NetStandard21/NetStandard21.csproj working-directory: test - - name: Generate code with AutoRest - run: | - dotnet run --project ../src/CLI/ApiClientCodeGen.CLI/ApiClientCodeGen.CLI.csproj -- csharp autorest ./OpenApi.${{ matrix.format }} GeneratedCode ./GeneratedCode/AutoRest-${{ matrix.version }}/Output.cs --no-logging - cp ./GeneratedCode/AutoRest-${{ matrix.version }}/Output.cs ./GeneratedCode/AutoRest-${{ matrix.version }}/Net6/Output.cs - cp ./GeneratedCode/AutoRest-${{ matrix.version }}/Output.cs ./GeneratedCode/AutoRest-${{ matrix.version }}/Net7/Output.cs - cp ./GeneratedCode/AutoRest-${{ matrix.version }}/Output.cs ./GeneratedCode/AutoRest-${{ matrix.version }}/Net8/Output.cs - cp ./GeneratedCode/AutoRest-${{ matrix.version }}/Output.cs ./GeneratedCode/AutoRest-${{ matrix.version }}/Net9/Output.cs - cp ./GeneratedCode/AutoRest-${{ matrix.version }}/Output.cs ./GeneratedCode/AutoRest-${{ matrix.version }}/Net48/Output.cs - cp ./GeneratedCode/AutoRest-${{ matrix.version }}/Output.cs ./GeneratedCode/AutoRest-${{ matrix.version }}/Net472/Output.cs - cp ./GeneratedCode/AutoRest-${{ matrix.version }}/Output.cs ./GeneratedCode/AutoRest-${{ matrix.version }}/Net462/Output.cs - cp ./GeneratedCode/AutoRest-${{ matrix.version }}/Output.cs ./GeneratedCode/AutoRest-${{ matrix.version }}/Net481/Output.cs - cp ./GeneratedCode/AutoRest-${{ matrix.version }}/Output.cs ./GeneratedCode/AutoRest-${{ matrix.version }}/NetStandard20/Output.cs - cp ./GeneratedCode/AutoRest-${{ matrix.version }}/Output.cs ./GeneratedCode/AutoRest-${{ matrix.version }}/NetStandard21/Output.cs - working-directory: test - continue-on-error: true - - - name: Build .NET 6 AutoRest generated code - run: dotnet build ./GeneratedCode/AutoRest-${{ matrix.version }}/Net6/Net6.csproj - working-directory: test - - - name: Build .NET 7 AutoRest generated code - run: dotnet build ./GeneratedCode/AutoRest-${{ matrix.version }}/Net7/Net7.csproj - working-directory: test - - - name: Build .NET 8 AutoRest generated code - run: dotnet build ./GeneratedCode/AutoRest-${{ matrix.version }}/Net8/Net8.csproj - working-directory: test - - - name: Build .NET 9 AutoRest generated code - run: dotnet build ./GeneratedCode/AutoRest-${{ matrix.version }}/Net9/Net9.csproj - working-directory: test - - - name: Build .NET 4.8.1 AutoRest generated code - run: dotnet build ./GeneratedCode/AutoRest-${{ matrix.version }}/Net481/Net481.csproj - if: ${{ matrix.version == 'V2' && matrix.os == 'windows-latest' }} - working-directory: test - - - name: Build .NET 4.8 AutoRest generated code - run: dotnet build ./GeneratedCode/AutoRest-${{ matrix.version }}/Net48/Net48.csproj - working-directory: test - - - name: Build .NET 4.7.2 AutoRest generated code - run: dotnet build ./GeneratedCode/AutoRest-${{ matrix.version }}/Net472/Net472.csproj - working-directory: test - - - name: Build .NET 4.6.2 AutoRest generated code - run: dotnet build ./GeneratedCode/AutoRest-${{ matrix.version }}/Net462/Net462.csproj - if: ${{ matrix.version == 'V2' }} - working-directory: test - - - name: Build .NET Standard 2.0 AutoRest generated code - run: dotnet build ./GeneratedCode/AutoRest-${{ matrix.version }}/NetStandard20/NetStandard20.csproj - working-directory: test - - - name: Build .NET Standard 2.1 AutoRest generated code - run: dotnet build ./GeneratedCode/AutoRest-${{ matrix.version }}/NetStandard21/NetStandard21.csproj - working-directory: test - - name: Generate code with Kiota run: dotnet run --project ../src/CLI/ApiClientCodeGen.CLI/ApiClientCodeGen.CLI.csproj -- csharp kiota ./OpenApi.${{ matrix.format }} GeneratedCode ./GeneratedCode/Kiota/Output.cs --no-logging working-directory: test diff --git a/.gitignore b/.gitignore index fddfbac984..88dd151174 100644 --- a/.gitignore +++ b/.gitignore @@ -265,7 +265,6 @@ src/tools/ src/.ionide/ src/MigrationBackup/ src/ApiClientCodeGen.CLI/Swagger.cs -**/AutoRestOutput.cs **/NSwagOutput.cs **/OpenApiOutput.cs **/SwaggerOutput.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 278acb9d3e..c0266e6aef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ **Implemented enhancements:** +- Remove AutoRest after deprecation window [\#1520](https://github.com/christianhelle/apiclientcodegen/issues/1520) - Microsoft Kiota v1.32.4 [\#1607](https://github.com/christianhelle/apiclientcodegen/pull/1607) ([christianhelle](https://github.com/christianhelle)) - Microsoft Kiota v1.32.3 [\#1606](https://github.com/christianhelle/apiclientcodegen/pull/1606) ([christianhelle](https://github.com/christianhelle)) diff --git a/CONTEXT.md b/CONTEXT.md index 97a28b92fd..acef786e64 100644 --- a/CONTEXT.md +++ b/CONTEXT.md @@ -7,10 +7,10 @@ seams instead of reinventing them. Domain terms first, then the shared modules. - **Code generator** — a module that turns an OpenAPI/Swagger spec into client source. Each generator implements `ICodeGenerator.GenerateCode(...)` (`Rapicgen.Core.Generators`). Concrete - generators: NSwag, OpenAPI Generator, Swagger Codegen, AutoRest (`[Obsolete]`), Refitter, Kiota, + generators: NSwag, OpenAPI Generator, Swagger Codegen, Refitter, Kiota, plus TypeScript/JMeter variants. - **External tool** — the third-party CLI/JAR a generator shells out to (NSwag, refitter, kiota, - swagger-codegen, openapi-generator, autorest). Tools are installed on demand. + swagger-codegen, openapi-generator). Tools are installed on demand. - **Supported code generator** — the `SupportedCodeGenerator` enum the VSIX host dispatches on. ## Shared modules (the seams to reuse) diff --git a/README.md b/README.md index f292aed595..b666388418 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,6 @@ A collection of Visual Studio C# custom tool code generators for Swagger / OpenA - [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) - [Refitter](https://github.com/christianhelle/refitter) - [Microsoft Kiota](https://github.com/microsoft/kiota) - - [AutoRest](https://github.com/Azure/autorest) ⚠️ **Deprecated** - See [AutoRest Migration Guide](docs/AutoRestMigration.md) - Define custom namespace for the generated file - Auto-updating of generated code file when changes are made to the OpenAPI specification JSON or YAML file - Generate code using a configuration files using the following: @@ -71,17 +70,14 @@ The output file is the result of merging all the files generated using the OpenA The output file is the result of merging all the files generated using the Swagger Codegen CLI tool with: `generate -l csharp --input-spec [swagger file] --output [output file] -DapiTests=false -DmodelTests=false -DpackageName=[default namespace] --skip-overwrite` -- ***AutoRestCodeGenerator*** - ⚠️ **Deprecated** - Generates a single file C# REST API Client using **AutoRest v3.0.0-beta.20210504.2** for OpenAPI v3 and **AutoRest v2.0.4417** for OpenAPI v2. AutoRest is deprecated by Microsoft and will be retired on July 1, 2026. See the [AutoRest Migration Guide](docs/AutoRestMigration.md) for alternatives. The resulting file is the equivalent of using the AutoRest CLI tool with: - `--csharp --input-file=[swagger file] --output-file=[output file] --namespace=[default namespace] --add-credentials` - - ***RefitterCodeGenerator*** - Generates a single file C# REST API Client interface for [Refit](https://github.com/reactiveui/refit) using [Refitter.Core](https://github.com/christianhelle/refitter) [nuget package](https://www.nuget.org/packages/Refitter.Core/) **v2.0.0**. The output file contains a Refit interface generated by [Refitter](https://github.com/christianhelle/refitter) and contracts generated using [NSwag.CodeGeneration.CSharp](https://github.com/RSuter/NSwag/wiki/CSharpClientGenerator) [nuget package](https://www.nuget.org/packages/NSwag.CodeGeneration.CSharp/) ### Dependencies -The custom tool code generators piggy back on top of well known Open API client code generators like **NSwag**, **OpenAPI Generator**, **Microsoft Kiota**, **Refitter**, **Swagger Codegen CLI**, and **AutoRest** (deprecated). These tools require [.NET SDK](https://dotnet.microsoft.com/download), [NPM](https://www.npmjs.com/get-npm) and the [Java Runtime Environment](https://java.com/en/download/manual.jsp) to be installed on the developers machine. Alternative Java SDK implementations such as the [OpenJDK](https://adoptopenjdk.net) works fine with this extension. By default, the path to **java.exe** is read from the **JAVA_HOME** environment variable, but is also configurable in the Settings screen. Future versions of the extension will include the [OpenJDK](https://adoptopenjdk.net) in the VSIX package +The custom tool code generators piggy back on top of well known Open API client code generators like **NSwag**, **OpenAPI Generator**, **Microsoft Kiota**, **Refitter**, and **Swagger Codegen CLI**. These tools require [.NET SDK](https://dotnet.microsoft.com/download) and the [Java Runtime Environment](https://java.com/en/download/manual.jsp) to be installed on the developers machine. Alternative Java SDK implementations such as the [OpenJDK](https://adoptopenjdk.net) works fine with this extension. By default, the path to **java.exe** is read from the **JAVA_HOME** environment variable, but is also configurable in the Settings screen. Future versions of the extension will include the [OpenJDK](https://adoptopenjdk.net) in the VSIX package -The **Swagger Codegen CLI** and **OpenAPI Generator** are distributed as JAR files and are downloaded on demand but requires the Java SDK to be installed on the machine. **AutoRest** (deprecated) is installed on-demand via [NPM](https://www.npmjs.com/get-npm) as a global tool and uses the latest available version. **Microsoft Kiota** is installed on-demand as a .NET Tool and requires .NET 7.0. This means that using these custom tools have an initial delay upon first time use. +The **Swagger Codegen CLI** and **OpenAPI Generator** are distributed as JAR files and are downloaded on demand but requires the Java SDK to be installed on the machine. **Microsoft Kiota** is installed on-demand as a .NET Tool and requires .NET 7.0. This means that using these custom tools have an initial delay upon first time use. **NSwagStudio** is stand alone UI tool for editing a **.nswag** specification file for generating code. This tool is optional to install and official installation instructions are available on the [NSwag Wiki on Github](https://github.com/RicoSuter/NSwag/wiki/NSwagStudio). If **NSwagStudio** is not installed on the machine then the Visual Studio Extension will install the **NSwag CLI** as a [.NET global tool](https://www.nuget.org/packages/NSwag.ConsoleCore) from nuget.org using the latest available version. @@ -109,8 +105,6 @@ The **Microsoft Kiota** code generator produces code that depends on the followi The **Swagger Codegen CLI** code generator produces code that depends on the [RestSharp](https://www.nuget.org/packages/RestSharp/105.2.3) and [JsonSubTypes](https://www.nuget.org/packages/JsonSubTypes/1.9.0) NuGet packages -The **AutoRest** code generator produces code that depends on the [Microsoft.Rest.ClientRuntime](https://www.nuget.org/packages/Microsoft.Rest.ClientRuntime/2.3.24) and [Newtonsoft.Json](https://www.nuget.org/packages/Newtonsoft.Json/13.0.3) NuGet packages - This Visual Studio Extension will automatically add the required NuGet packages that the generated code depends on ### Using Generated Code @@ -118,7 +112,7 @@ This Visual Studio Extension will automatically add the required NuGet packages For detailed examples and best practices on how to use the code generated by each code generator, see the **[Generated Code Usage Guide](docs/GeneratedCodeUsage.md)**. The guide includes: -- Sample code for each generator (NSwag, AutoRest, Swagger Codegen CLI, OpenAPI Generator, Kiota, Refitter) +- Sample code for each generator (NSwag, Swagger Codegen CLI, OpenAPI Generator, Kiota, Refitter) - Dependency injection examples - Authentication patterns - Error handling @@ -140,14 +134,10 @@ The guide includes: ### Settings -This extension will by default make some assumptions on the installation paths for **Java** and **NPM** but also provides option pages for configuring this. The **Swagger Codegen CLI** and the **OpenAPI Generator** JAR files are by default downloaded to the user TEMP folder but it is also possible to specify to use existing JAR files +This extension will by default make some assumptions on the installation path for **Java** but also provides option pages for configuring this. The **Swagger Codegen CLI** and the **OpenAPI Generator** JAR files are by default downloaded to the user TEMP folder but it is also possible to specify to use existing JAR files ![Options - General](images/options-general.png) -Supports customising how AutoRest generates code based on the C# generator settings that the AutoRest CLI tool provides - -![Options - AutoRest](images/options-autorest.png) - Supports customising how NSwag generates code using the properties exposed by the NSwag NuGet package ![Options - NSwag](images/options-nswag.png) @@ -205,7 +195,7 @@ Download the VSIX file from the [GitHub releases](https://github.com/christianhe ### Features - Context menu on JSON and YAML files for generating code with various generators -- Supports all code generators: NSwag, Refitter, OpenAPI Generator, Microsoft Kiota, Swagger Codegen CLI, and AutoREST +- Supports all code generators: NSwag, Refitter, OpenAPI Generator, Microsoft Kiota, and Swagger Codegen CLI - Configuration options for namespace and output directory ### Usage @@ -307,7 +297,7 @@ Alternatively, you can install it from the [JetBrains Marketplace](https://plugi ### IntelliJ Plugin Features - Context menu on JSON and YAML files for generating code with various generators -- Supports all code generators: NSwag, Refitter, OpenAPI Generator, Microsoft Kiota, Swagger Codegen CLI, and AutoREST +- Supports all code generators: NSwag, Refitter, OpenAPI Generator, Microsoft Kiota, and Swagger Codegen CLI - Multiple language support: C#, TypeScript, and more - Configuration options for namespace and output directory - Integration with JetBrains project structure @@ -336,7 +326,6 @@ All custom tools mentioned above are also implemented in a cross platform comman - .NET 6.0 runtime - Java Runtime Environment -- NPM ### CLI Installation @@ -399,7 +388,6 @@ Options: -?|-h|--help Show help information. Commands: - autorest AutoRest (v3.0.0-beta.20210504.2) kiota Microsoft Kiota (v1.32.4) nswag NSwag (v14.7.1) openapi OpenAPI Generator (v7.23.0) @@ -410,28 +398,6 @@ Run 'csharp [command] -?|-h|--help' for more information about a command. ``` -and - -``` -rapicgen csharp autorest -? -``` - -will output this: - -``` -Generate Swagger / Open API client using AutoRest - -Usage: run autorest [options] - -Arguments: - swaggerFile Path to the Swagger / Open API specification file - namespace Default namespace to in the generated code - outputFile Output filename to write the generated code to. Default is the swaggerFile .cs - -Options: - -?|-h|--help Show help information -``` - or ``` @@ -475,12 +441,6 @@ In case you don't have the CLI tool installed you can install it by dotnet tool install --global rapicgen ``` -Here's an example of how to generate code using **AutoRest** - -``` -rapicgen csharp autorest Swagger.json GeneratedCode ./AutoRestOutput.cs -``` - Here's an example of how to generate code using **Kiota** ``` diff --git a/build/templates/all.yml b/build/templates/all.yml index 3ded3495d3..176bd4750c 100644 --- a/build/templates/all.yml +++ b/build/templates/all.yml @@ -15,11 +15,6 @@ jobs: steps: - - task: Npm@0 - displayName: 'npm install' - inputs: - arguments: '-g autorest' - - task: Npm@0 displayName: 'npm install' inputs: diff --git a/build/templates/script-test-template.yml b/build/templates/script-test-template.yml index d72ea2d4fb..d46bb64b7b 100644 --- a/build/templates/script-test-template.yml +++ b/build/templates/script-test-template.yml @@ -8,16 +8,10 @@ jobs: - job: ${{ parameters.name }} pool: vmImage: '${{ parameters.agentSpecification }}' - demands: npm displayName: 'Test on ${{ parameters.agentSpecification }}' steps: - - task: Npm@0 - displayName: 'npm install' - inputs: - arguments: '-g autorest' - - task: PowerShell@2 displayName: 'PowerShell Script' inputs: diff --git a/build/templates/vsix.yml b/build/templates/vsix.yml index 2a6370df4a..51fa6a5e54 100644 --- a/build/templates/vsix.yml +++ b/build/templates/vsix.yml @@ -15,11 +15,6 @@ jobs: steps: - - task: Npm@0 - displayName: 'npm install' - inputs: - arguments: '-g autorest' - - task: Npm@0 displayName: 'npm install' inputs: diff --git a/docs/AutoRestMigration.md b/docs/AutoRestMigration.md index 977066b460..6c7cbb839a 100644 --- a/docs/AutoRestMigration.md +++ b/docs/AutoRestMigration.md @@ -1,6 +1,6 @@ # AutoRest Migration Guide -⚠️ **IMPORTANT:** AutoRest is deprecated by Microsoft and will be retired on July 1, 2026. AutoRest support will be removed from this tool in a future major version. Use NSwag, Refitter, or Kiota instead. +🚫 **REMOVED:** AutoRest support has been removed from this tool. AutoRest was deprecated by Microsoft and retired on July 1, 2026. The `AutoRest` and `AutoRestV3` generators, CLI commands, Visual Studio custom tools, and options have been removed. Use NSwag, Refitter, or Kiota instead. ## Migration Recommendations @@ -115,9 +115,8 @@ rapicgen csharp kiota swagger.json GeneratedCode Output.cs ## Migration Timeline -- **Now through June 2026:** AutoRest remains functional with deprecation warnings -- **July 1, 2026:** Microsoft retires AutoRest -- **Future major version (estimated Q3-Q4 2026):** AutoRest support removed from this tool +- **July 1, 2026:** Microsoft retired AutoRest +- **Current version:** AutoRest support has been removed from this tool ## Need Help? diff --git a/docs/CLI.md b/docs/CLI.md index 17413580dd..c7f52859ca 100644 --- a/docs/CLI.md +++ b/docs/CLI.md @@ -6,7 +6,6 @@ All custom tools mentioned above are also implemented in a cross platform comman - .NET 6.0 runtime - Java Runtime Environment -- NPM ## Installation @@ -69,7 +68,6 @@ Options: -?|-h|--help Show help information. Commands: - autorest AutoRest (Deprecated - v3.0.0-beta.20210504.2, retires July 1, 2026 — use NSwag, Refit, or Kiota) kiota Microsoft Kiota (v1.32.4) nswag NSwag (v14.7.1) openapi OpenAPI Generator (v7.23.0) @@ -79,28 +77,6 @@ Commands: Run 'csharp [command] -?|-h|--help' for more information about a command. ``` -and - -```sh -rapicgen csharp autorest -? -``` - -will output this: - -```sh -Generate Swagger / Open API client using AutoRest - -Usage: run autorest [options] - -Arguments: - swaggerFile Path to the Swagger / Open API specification file - namespace Default namespace in the generated code - outputFile Output filename to write the generated code to. Default is the swaggerFile .cs - -Options: - -?|-h|--help Show help information -``` - or ```sh @@ -144,12 +120,6 @@ In case you don't have the CLI tool installed you can install it by dotnet tool install --global rapicgen ``` -Here's an example of how to generate code using **AutoRest** - -```sh -rapicgen csharp autorest Swagger.json GeneratedCode ./AutoRestOutput.cs -``` - Here's an example of how to generate code using **Kiota** ```sh diff --git a/docs/GeneratedCodeUsage.md b/docs/GeneratedCodeUsage.md index 1a1a90dd5a..640df54851 100644 --- a/docs/GeneratedCodeUsage.md +++ b/docs/GeneratedCodeUsage.md @@ -5,8 +5,6 @@ This guide explains how to use the code generated by the various code generators ## Table of Contents - [NSwag](#nswag) -- [AutoRest v2](#autorest-v2) -- [AutoRest v3](#autorest-v3) - [Swagger Codegen CLI](#swagger-codegen-cli) - [OpenAPI Generator](#openapi-generator) - [Kiota](#kiota) @@ -92,172 +90,6 @@ public class Startup --- -## AutoRest v2 - -⚠️ **DEPRECATED:** AutoRest is deprecated by Microsoft and will be retired on July 1, 2026. Please migrate to NSwag, Refitter, or Kiota. See the [AutoRest Migration Guide](AutoRestMigration.md) for details. - -AutoRest v2 generates clients for OpenAPI v2 specifications with comprehensive model and operation support. - -### Dependencies - -The generated code depends on: -- [Microsoft.Rest.ClientRuntime](https://www.nuget.org/packages/Microsoft.Rest.ClientRuntime/) (v2.3.24 or later) -- [Newtonsoft.Json](https://www.nuget.org/packages/Newtonsoft.Json/) (v13.0.3 or later) - -```bash -dotnet add package Microsoft.Rest.ClientRuntime -dotnet add package Newtonsoft.Json -``` - -### Basic Usage - -```csharp -using System; -using System.Threading.Tasks; -using Microsoft.Rest; - -public class Program -{ - public static async Task Main(string[] args) - { - // Create credentials (if required) - var credentials = new TokenCredentials("your-api-key"); - - // Create client with base URI - var client = new SwaggerPetstoreClient(new Uri("https://petstore.swagger.io/v2")) - { - Credentials = credentials - }; - - try - { - // Call API operations - var pet = await client.GetPetByIdAsync(1); - Console.WriteLine($"Pet Name: {pet.Name}"); - - // List pets by status - var pets = await client.FindPetsByStatusAsync(new[] { "available" }); - Console.WriteLine($"Found {pets.Count} pets"); - } - catch (HttpOperationException ex) - { - Console.WriteLine($"Request failed: {ex.Response.StatusCode}"); - Console.WriteLine($"Response: {ex.Response.Content}"); - } - } -} -``` - -### Using with Service Credentials - -```csharp -using Microsoft.Rest; - -// Token-based authentication (most common) -var tokenCreds = new TokenCredentials("your-bearer-token"); - -var client = new SwaggerPetstoreClient(new Uri("https://petstore.swagger.io/v2")) -{ - Credentials = tokenCreds -}; - -// Custom authentication header -var client2 = new SwaggerPetstoreClient(new Uri("https://api.example.com")); -client2.HttpClient.DefaultRequestHeaders.Add("X-API-Key", "your-api-key"); -``` - -### Further Reading - -- [AutoRest Documentation](https://github.com/Azure/autorest) -- [AutoRest for C#](https://github.com/Azure/autorest.csharp) -- [Microsoft.Rest.ClientRuntime Documentation](https://www.nuget.org/packages/Microsoft.Rest.ClientRuntime/) - ---- - -## AutoRest v3 - -⚠️ **DEPRECATED:** AutoRest is deprecated by Microsoft and will be retired on July 1, 2026. Please migrate to NSwag, Refitter, or Kiota. See the [AutoRest Migration Guide](AutoRestMigration.md) for details. - -AutoRest v3 generates clients for OpenAPI v3 specifications with improved support for modern OpenAPI features. - -### Dependencies - -The generated code depends on: -- [Azure.Core](https://www.nuget.org/packages/Azure.Core/) (v1.0.0 or later) -- [System.Text.Json](https://www.nuget.org/packages/System.Text.Json/) (v4.7.2 or later) - -```bash -dotnet add package Azure.Core -dotnet add package System.Text.Json -``` - -### Basic Usage - -```csharp -using System; -using System.Threading.Tasks; -using Azure; - -public class Program -{ - public static async Task Main(string[] args) - { - // Create client with credentials - var credentials = new TokenCredentials("your-api-key"); - var client = new GeneratedCodeClient(credentials) - { - BaseUri = new Uri("https://api.example.com") - }; - - try - { - // Use generated operations - var result = await client.Operations.GetResourceAsync("resource-id"); - Console.WriteLine($"Resource: {result.Name}"); - - // Create new resource - var newResource = new Resource - { - Name = "New Resource", - Description = "Created via API" - }; - var created = await client.Operations.CreateResourceAsync(newResource); - Console.WriteLine($"Created: {created.Id}"); - } - catch (RequestFailedException ex) - { - Console.WriteLine($"API Error: {ex.Status} - {ex.Message}"); - } - } -} -``` - -### Custom HTTP Client Configuration - -```csharp -using System.Net.Http; - -// Create custom HttpClient with handlers -var httpClient = new HttpClient(new HttpClientHandler -{ - AutomaticDecompression = System.Net.DecompressionMethods.GZip -}); - -// Create client with custom HttpClient -var client = new GeneratedCodeClient( - credentials, - httpClient, - disposeHttpClient: false); -``` - -### Further Reading - -- [AutoRest v3 Documentation](https://github.com/Azure/autorest) -- [AutoRest Configuration](https://github.com/Azure/autorest/blob/main/docs/generate/configuration.md) -- [Azure SDK for .NET Design Guidelines](https://azure.github.io/azure-sdk/dotnet_introduction.html) - ---- - ## Swagger Codegen CLI Swagger Codegen CLI generates a traditional REST client with RestSharp for making HTTP requests. @@ -775,7 +607,7 @@ catch (ApiException ex) // NSwag, OpenAPI Generator { Console.WriteLine($"API Error: {ex.StatusCode} - {ex.Message}"); } -catch (HttpOperationException ex) // AutoRest +catch (HttpOperationException ex) { Console.WriteLine($"HTTP Error: {ex.Response.StatusCode}"); } @@ -817,9 +649,6 @@ var client = new SwaggerClient(httpClient); // } // } -// AutoRest -client.HttpClient.DefaultRequestHeaders.Add("Custom-Header", "value"); - // OpenAPI Generator config.DefaultHeaders.Add("Custom-Header", "value"); @@ -854,7 +683,6 @@ services.AddRefitClient() For issues or questions specific to the code generators: - **NSwag**: [GitHub Issues](https://github.com/RicoSuter/NSwag/issues) -- **AutoRest**: [GitHub Issues](https://github.com/Azure/autorest/issues) - **Swagger Codegen**: [GitHub Issues](https://github.com/swagger-api/swagger-codegen/issues) - **OpenAPI Generator**: [GitHub Issues](https://github.com/OpenAPITools/openapi-generator/issues) - **Kiota**: [GitHub Issues](https://github.com/microsoft/kiota/issues) diff --git a/docs/Marketplace.md b/docs/Marketplace.md index a1aa09a6db..05796e85f0 100644 --- a/docs/Marketplace.md +++ b/docs/Marketplace.md @@ -15,7 +15,6 @@ A collection of Visual Studio C# custom tool code generators for Swagger / OpenA - [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) - [Refitter](https://github.com/christianhelle/refitter) - [Microsoft Kiota](https://github.com/microsoft/kiota) - - [AutoRest](https://github.com/Azure/autorest) - Define custom namespace for the generated file - Auto-updating of generated code file when changes are made to the OpenAPI specification JSON or YAML file - Generate code using a configuration files using the following: @@ -37,19 +36,14 @@ The output file is the result of merging all the files generated using the OpenA The output file is the result of merging all the files generated using the Swagger Codegen CLI tool with: `generate -l csharp --input-spec [swagger file] --output [output file] -DapiTests=false -DmodelTests=false -DpackageName=[default namespace] --skip-overwrite` -- ***AutoRestCodeGenerator*** - Generates a single file C# REST API Client using **AutoRest v3.0.0-beta.20210504.2** for OpenAPI v3 and **AutoRest v2.0.4417** for OpenAPI v2. The resulting file is the equivalent of using the AutoRest CLI tool with: - `--csharp --input-file=[swagger file] --output-file=[output file] --namespace=[default namespace] --add-credentials` - -**⚠️ Deprecation Notice:** AutoRest is deprecated by Microsoft and will be retired on July 1, 2026. AutoRest support will be removed from this tool in a future major version. For migration guidance, see [AutoRest Migration Guide](AutoRestMigration.md). Use NSwag, Refitter, or Kiota instead. - - ***RefitterCodeGenerator*** - Generates a single file C# REST API Client interface for [Refit](https://github.com/reactiveui/refit) using [Refitter.Core](https://github.com/christianhelle/refitter) [nuget package](https://www.nuget.org/packages/Refitter.Core/) **v2.0.0**. The output file contains a Refit interface generated by [Refitter](https://github.com/christianhelle/refitter) and contracts generated using [NSwag.CodeGeneration.CSharp](https://github.com/RSuter/NSwag/wiki/CSharpClientGenerator) [nuget package](https://www.nuget.org/packages/NSwag.CodeGeneration.CSharp/) ### Dependencies -The custom tool code generators piggy back on top of well known Open API client code generators like **AutoRest**, **NSwag**, **OpenAPI Generator**, **Microsoft Kiota**, **Refitter**, and **Swagger Codegen CLI**. These tools require [.NET SDK](https://dotnet.microsoft.com/download), [NPM](https://www.npmjs.com/get-npm) and the [Java Runtime Environment](https://java.com/en/download/manual.jsp) to be installed on the developers machine. Alternative Java SDK implementations such as the [OpenJDK](https://adoptopenjdk.net) works fine with this extension. By default, the path to **java.exe** is read from the **JAVA_HOME** environment variable, but is also configurable in the Settings screen. Future versions of the extension will include the [OpenJDK](https://adoptopenjdk.net) in the VSIX package +The custom tool code generators piggy back on top of well known Open API client code generators like **NSwag**, **OpenAPI Generator**, **Microsoft Kiota**, **Refitter**, and **Swagger Codegen CLI**. These tools require [.NET SDK](https://dotnet.microsoft.com/download) and the [Java Runtime Environment](https://java.com/en/download/manual.jsp) to be installed on the developers machine. Alternative Java SDK implementations such as the [OpenJDK](https://adoptopenjdk.net) works fine with this extension. By default, the path to **java.exe** is read from the **JAVA_HOME** environment variable, but is also configurable in the Settings screen. Future versions of the extension will include the [OpenJDK](https://adoptopenjdk.net) in the VSIX package -The **Swagger Codegen CLI** and **OpenAPI Generator** are distributed as JAR files and are downloaded on demand but requires the Java SDK to be installed on the machine. **AutoRest** is installed on-demand via [NPM](https://www.npmjs.com/get-npm) as a global tool and uses the latest available version. **Microsoft Kiota** is installed on-demand as a .NET Tool and requires .NET 7.0. This means that using these custom tools have an initial delay upon first time use. +The **Swagger Codegen CLI** and **OpenAPI Generator** are distributed as JAR files and are downloaded on demand but requires the Java SDK to be installed on the machine. **Microsoft Kiota** is installed on-demand as a .NET Tool and requires .NET 7.0. This means that using these custom tools have an initial delay upon first time use. **NSwagStudio** is stand alone UI tool for editing a **.nswag** specification file for generating code. This tool is optional to install and official installation instructions are available on the [NSwag Wiki on Github](https://github.com/RicoSuter/NSwag/wiki/NSwagStudio). If **NSwagStudio** is not installed on the machine then the Visual Studio Extension will install the **NSwag CLI** as a [.NET global tool](https://www.nuget.org/packages/NSwag.ConsoleCore) from nuget.org using the latest available version. @@ -77,8 +71,6 @@ The project **Kiota** code generator produces code that depends on the following The **Swagger Codegen CLI** code generator produces code that depends on the [RestSharp](https://www.nuget.org/packages/RestSharp/105.2.3) and [JsonSubTypes](https://www.nuget.org/packages/JsonSubTypes/1.9.0) NuGet packages -The **AutoRest** code generator produces code that depends on the [Microsoft.Rest.ClientRuntime](https://www.nuget.org/packages/Microsoft.Rest.ClientRuntime/2.3.24) and [Newtonsoft.Json](https://www.nuget.org/packages/Newtonsoft.Json/13.0.3) NuGet packages - This Visual Studio Extension will automatically add the required NuGet packages that the generated code depends on ## Screenshots @@ -97,14 +89,10 @@ This Visual Studio Extension will automatically add the required NuGet packages ### Settings -This extension will by default make some assumptions on the installation paths for **Java** and **NPM** but also provides option pages for configuring this. The **Swagger Codegen CLI** and the **OpenAPI Generator** JAR files are by default downloaded to the user TEMP folder but it is also possible to specify to use existing JAR files +This extension will by default make some assumptions on the installation path for **Java** but also provides option pages for configuring this. The **Swagger Codegen CLI** and the **OpenAPI Generator** JAR files are by default downloaded to the user TEMP folder but it is also possible to specify to use existing JAR files ![Options - General](https://github.com/christianhelle/apiclientcodegen/raw/master/images/options-general.png) -Supports customising how AutoRest generates code based on the C# generator settings that the AutoRest CLI tool provides - -![Options - AutoRest](https://github.com/christianhelle/apiclientcodegen/raw/master/images/options-autorest.png) - Supports customising how NSwag generates code using the properties exposed by the NSwag NuGet package ![Options - NSwag](https://github.com/christianhelle/apiclientcodegen/raw/master/images/options-nswag.png) diff --git a/docs/Marketplace2022.md b/docs/Marketplace2022.md index 9462b0ab69..3893d9a573 100644 --- a/docs/Marketplace2022.md +++ b/docs/Marketplace2022.md @@ -15,7 +15,6 @@ A collection of Visual Studio C# custom tool code generators for Swagger / OpenA - [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) - [Refitter](https://github.com/christianhelle/refitter) - [Microsoft Kiota](https://github.com/microsoft/kiota) - - [AutoRest](https://github.com/Azure/autorest) - Define custom namespace for the generated file - Auto-updating of generated code file when changes are made to the OpenAPI specification JSON or YAML file - Generate code using a configuration files using the following: @@ -37,19 +36,14 @@ The output file is the result of merging all the files generated using the OpenA The output file is the result of merging all the files generated using the Swagger Codegen CLI tool with: `generate -l csharp --input-spec [swagger file] --output [output file] -DapiTests=false -DmodelTests=false -DpackageName=[default namespace] --skip-overwrite` -- ***AutoRestCodeGenerator*** - Generates a single file C# REST API Client using **AutoRest v3.0.0-beta.20210504.2** for OpenAPI v3 and **AutoRest v2.0.4417** for OpenAPI v2. The resulting file is the equivalent of using the AutoRest CLI tool with: - `--csharp --input-file=[swagger file] --output-file=[output file] --namespace=[default namespace] --add-credentials` - -**⚠️ Deprecation Notice:** AutoRest is deprecated by Microsoft and will be retired on July 1, 2026. AutoRest support will be removed from this tool in a future major version. For migration guidance, see [AutoRest Migration Guide](AutoRestMigration.md). Use NSwag, Refitter, or Kiota instead. - - ***RefitterCodeGenerator*** - Generates a single file C# REST API Client interface for [Refit](https://github.com/reactiveui/refit) using [Refitter.Core](https://github.com/christianhelle/refitter) [nuget package](https://www.nuget.org/packages/Refitter.Core/) **v2.0.0**. The output file contains a Refit interface generated by [Refitter](https://github.com/christianhelle/refitter) and contracts generated using [NSwag.CodeGeneration.CSharp](https://github.com/RSuter/NSwag/wiki/CSharpClientGenerator) [nuget package](https://www.nuget.org/packages/NSwag.CodeGeneration.CSharp/) ### Dependencies -The custom tool code generators piggy back on top of well known Open API client code generators like **AutoRest**, **NSwag**, **OpenAPI Generator**, **Microsoft Kiota**, **Refitter**, and **Swagger Codegen CLI**. These tools require [.NET SDK](https://dotnet.microsoft.com/download), [NPM](https://www.npmjs.com/get-npm) and the [Java Runtime Environment](https://java.com/en/download/manual.jsp) to be installed on the developers machine. Alternative Java SDK implementations such as the [OpenJDK](https://adoptopenjdk.net) works fine with this extension. By default, the path to **java.exe** is read from the **JAVA_HOME** environment variable, but is also configurable in the Settings screen. Future versions of the extension will include the [OpenJDK](https://adoptopenjdk.net) in the VSIX package +The custom tool code generators piggy back on top of well known Open API client code generators like **NSwag**, **OpenAPI Generator**, **Microsoft Kiota**, **Refitter**, and **Swagger Codegen CLI**. These tools require [.NET SDK](https://dotnet.microsoft.com/download) and the [Java Runtime Environment](https://java.com/en/download/manual.jsp) to be installed on the developers machine. Alternative Java SDK implementations such as the [OpenJDK](https://adoptopenjdk.net) works fine with this extension. By default, the path to **java.exe** is read from the **JAVA_HOME** environment variable, but is also configurable in the Settings screen. Future versions of the extension will include the [OpenJDK](https://adoptopenjdk.net) in the VSIX package -The **Swagger Codegen CLI** and **OpenAPI Generator** are distributed as JAR files and are downloaded on demand but requires the Java SDK to be installed on the machine. **AutoRest** is installed on-demand via [NPM](https://www.npmjs.com/get-npm) as a global tool and uses the latest available version. **Microsoft Kiota** is installed on-demand as a .NET Tool and requires .NET 7.0. This means that using these custom tools have an initial delay upon first time use. +The **Swagger Codegen CLI** and **OpenAPI Generator** are distributed as JAR files and are downloaded on demand but requires the Java SDK to be installed on the machine. **Microsoft Kiota** is installed on-demand as a .NET Tool and requires .NET 7.0. This means that using these custom tools have an initial delay upon first time use. **NSwagStudio** is stand alone UI tool for editing a **.nswag** specification file for generating code. This tool is optional to install and official installation instructions are available on the [NSwag Wiki on Github](https://github.com/RicoSuter/NSwag/wiki/NSwagStudio). If **NSwagStudio** is not installed on the machine then the Visual Studio Extension will install the **NSwag CLI** as a [.NET global tool](https://www.nuget.org/packages/NSwag.ConsoleCore) from nuget.org using the latest available version. @@ -77,8 +71,6 @@ The project **Kiota** code generator produces code that depends on the following The **Swagger Codegen CLI** code generator produces code that depends on the [RestSharp](https://www.nuget.org/packages/RestSharp/105.2.3) and [JsonSubTypes](https://www.nuget.org/packages/JsonSubTypes/1.9.0) NuGet packages -The **AutoRest** code generator produces code that depends on the [Microsoft.Rest.ClientRuntime](https://www.nuget.org/packages/Microsoft.Rest.ClientRuntime/2.3.24) and [Newtonsoft.Json](https://www.nuget.org/packages/Newtonsoft.Json/13.0.3) NuGet packages - This Visual Studio Extension will automatically add the required NuGet packages that the generated code depends on ## Screenshots @@ -97,14 +89,10 @@ This Visual Studio Extension will automatically add the required NuGet packages ### Settings -This extension will by default make some assumptions on the installation paths for **Java** and **NPM** but also provides option pages for configuring this. The **Swagger Codegen CLI** and the **OpenAPI Generator** JAR files are by default downloaded to the user TEMP folder but it is also possible to specify to use existing JAR files +This extension will by default make some assumptions on the installation path for **Java** but also provides option pages for configuring this. The **Swagger Codegen CLI** and the **OpenAPI Generator** JAR files are by default downloaded to the user TEMP folder but it is also possible to specify to use existing JAR files ![Options - General](https://github.com/christianhelle/apiclientcodegen/raw/master/images/options-general.png) -Supports customising how AutoRest generates code based on the C# generator settings that the AutoRest CLI tool provides - -![Options - AutoRest](https://github.com/christianhelle/apiclientcodegen/raw/master/images/options-autorest.png) - Supports customising how NSwag generates code using the properties exposed by the NSwag NuGet package ![Options - NSwag](https://github.com/christianhelle/apiclientcodegen/raw/master/images/options-nswag.png) diff --git a/docs/Marketplace2026.md b/docs/Marketplace2026.md index 577a2801e0..57ea0e0f75 100644 --- a/docs/Marketplace2026.md +++ b/docs/Marketplace2026.md @@ -13,7 +13,6 @@ A collection of Visual Studio C# code generators for Swagger / OpenAPI specifica - [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) - [Microsoft Kiota](https://github.com/microsoft/kiota) - [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) - - [AutoRest](https://github.com/Azure/autorest) - Generate code using configuration files with the following methods: - `.nswag` configuration files from [NSwagStudio](https://github.com/RicoSuter/NSwag/wiki/NSwagStudio) by including it in the project and using the **Generate NSwag Studio output** context menu - `.refitter` settings files from [Refitter](https://github.com/christianhelle/refitter) by including it in the project and using the **Generate Refitter output** context menu @@ -32,8 +31,6 @@ A collection of Visual Studio C# code generators for Swagger / OpenAPI specifica ![Options - General](https://github.com/christianhelle/apiclientcodegen/raw/master/images/vs-settings-general.png) -![Options - AutoRest](https://github.com/christianhelle/apiclientcodegen/raw/master/images/vs-settings-autorest.png) - ![Options - NSwag](https://github.com/christianhelle/apiclientcodegen/raw/master/images/vs-settings-nswag.png) ![Options - NSwag Studio](https://github.com/christianhelle/apiclientcodegen/raw/master/images/vs-settings-nswag-studio.png) diff --git a/docs/VSCode.md b/docs/VSCode.md index 8fa8ccc521..28d27f64e7 100644 --- a/docs/VSCode.md +++ b/docs/VSCode.md @@ -40,9 +40,6 @@ This extension adds a context menu item **REST API Client Code Generator** when - **OpenAPI Generator**: Generates a C# REST API Client using OpenAPI Generator - **Microsoft Kiota**: Generates a C# REST API Client using Microsoft Kiota - **Swagger Codegen CLI**: Generates a C# REST API Client using Swagger Codegen CLI -- **AutoREST**: Generates a C# REST API Client using AutoREST - -**⚠️ Note:** AutoRest is deprecated by Microsoft and will be retired on July 1, 2026. AutoRest support will be removed from this tool in a future major version. For migration guidance, see [AutoRest Migration Guide](https://github.com/christianhelle/apiclientcodegen/blob/master/docs/AutoRestMigration.md). Use NSwag, Refitter, or Kiota instead. ### TypeScript Generators @@ -72,7 +69,6 @@ This extension adds a context menu item **REST API Client Code Generator** when - .NET SDK 6.0 or higher - Java Runtime Environment (for OpenAPI Generator and Swagger Codegen CLI) - .NET SDK (for NSwag, Kiota, and Refitter) -- NPM (for AutoREST) ### For TypeScript code generation @@ -107,7 +103,6 @@ The C# code generated by each generator depends on different NuGet packages: - **OpenAPI Generator**: Depends on RestSharp, JsonSubTypes, Polly, Newtonsoft.Json - **Microsoft Kiota**: Depends on Microsoft.Kiota.* packages and Azure.Identity - **Swagger Codegen CLI**: Depends on RestSharp and JsonSubTypes -- **AutoREST**: Depends on Microsoft.Rest.ClientRuntime and Newtonsoft.Json ### TypeScript Dependencies diff --git a/docs/VisualStudioForMac.md b/docs/VisualStudioForMac.md index 5755d602b8..86c7e6ab83 100644 --- a/docs/VisualStudioForMac.md +++ b/docs/VisualStudioForMac.md @@ -5,7 +5,7 @@ A collection of Visual Studio C# custom tool code generators for Swagger / OpenA ## Features - Supports Visual Studio for Mac -- Add New REST API Client to a project from an OpenAPI specification URL (e.g https://petstore.swagger.io/v2/swagger.json) using [NSwag](https://github.com/RicoSuter/NSwag), [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator), [Swagger Codegen](https://github.com/swagger-api/swagger-codegen), [Refitter](https://github.com/christianhelle/refitter), [Microsoft Kiota](https://github.com/microsoft/kiota), or [AutoRest](https://github.com/Azure/autorest) +- Add New REST API Client to a project from an OpenAPI specification URL (e.g https://petstore.swagger.io/v2/swagger.json) using [NSwag](https://github.com/RicoSuter/NSwag), [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator), [Swagger Codegen](https://github.com/swagger-api/swagger-codegen), [Refitter](https://github.com/christianhelle/refitter), or [Microsoft Kiota](https://github.com/microsoft/kiota) - Auto-updating of generated code file when changes are made to the OpenAPI specification JSON or YAML file - Generate code using an [NSwagStudio](https://github.com/RicoSuter/NSwag/wiki/NSwagStudio) specification file by including it in the project and using the **Generate with NSwag** context menu @@ -25,20 +25,14 @@ The output file is the result of merging all the files generated using the Kiota The output file is the result of merging all the files generated using the Swagger Codegen CLI tool with: `generate -l csharp --input-spec [swagger file] --output [output file] -DapiTests=false -DmodelTests=false -DpackageName=[default namespace] --skip-overwrite` -- ***AutoRestCodeGenerator*** - Generates a single file C# REST API Client using **AutoRest v3.0.0-beta.20210504.2** for OpenAPI v3 and **AutoRest v2.0.4417** for OpenAPI v2. -The resulting file is the equivalent of using the AutoRest CLI tool with:+ -`--csharp --input-file=[swagger file] --output-file=[output file] --namespace=[default namespace] --add-credentials` - -**⚠️ Deprecation Notice:** AutoRest is deprecated by Microsoft and will be retired on July 1, 2026. AutoRest support will be removed from this tool in a future major version. For migration guidance, see [AutoRest Migration Guide](AutoRestMigration.md). Use NSwag, Refitter, or Kiota instead. - - ***RefitterCodeGenerator*** - Generates a single file C# REST API Client interface for [Refit](https://github.com/reactiveui/refit) using [Refitter.Core](https://github.com/christianhelle/refitter) [nuget package](https://www.nuget.org/packages/Refitter.Core/) **v2.0.0**. The output file contains a Refit interface generated by [Refitter](https://github.com/christianhelle/refitter) and contracts generated using [NSwag.CodeGeneration.CSharp](https://github.com/RSuter/NSwag/wiki/CSharpClientGenerator) [nuget package](https://www.nuget.org/packages/NSwag.CodeGeneration.CSharp/) ### Dependencies -The custom tool code generators piggy back on top of well known Open API client code generators like **AutoRest**, **NSwag**, **OpenAPI Generator**, **Microsoft Kiota**, **Refitter**, and **Swagger Codegen CLI**. These tools require [.NET SDK](https://dotnet.microsoft.com/download), [NPM](https://www.npmjs.com/get-npm) and the [Java Runtime Environment](https://java.com/en/download/manual.jsp) to be installed on the developers machine. Alternative Java SDK implementations such as the [OpenJDK](https://adoptopenjdk.net) works fine with this extension. By default, the path to **java.exe** is read from the **JAVA_HOME** environment variable, but is also configurable in the Settings screen +The custom tool code generators piggy back on top of well known Open API client code generators like **NSwag**, **OpenAPI Generator**, **Microsoft Kiota**, **Refitter**, and **Swagger Codegen CLI**. These tools require [.NET SDK](https://dotnet.microsoft.com/download) and the [Java Runtime Environment](https://java.com/en/download/manual.jsp) to be installed on the developers machine. Alternative Java SDK implementations such as the [OpenJDK](https://adoptopenjdk.net) works fine with this extension. By default, the path to **java.exe** is read from the **JAVA_HOME** environment variable, but is also configurable in the Settings screen -The **Swagger Codegen CLI** and **OpenAPI Generator** are distributed as JAR files and are downloaded on demand but requires the Java SDK to be installed on the machine. **AutoRest** is installed on-demand via [NPM](https://www.npmjs.com/get-npm) as a global tool and uses the latest available version. **Microsoft Kiota** is installed on-demand as a .NET Tool and requires .NET 7.0. This means that using these custom tools have an initial delay upon first time use. +The **Swagger Codegen CLI** and **OpenAPI Generator** are distributed as JAR files and are downloaded on demand but requires the Java SDK to be installed on the machine. **Microsoft Kiota** is installed on-demand as a .NET Tool and requires .NET 7.0. This means that using these custom tools have an initial delay upon first time use. **NSwagStudio** is stand alone UI tool for editing a **.nswag** specification file for generating code. This tool is optional to install and official installation instructions are available on the [NSwag Wiki on Github](https://github.com/RicoSuter/NSwag/wiki/NSwagStudio). If **NSwagStudio** is not installed on the machine then the Visual Studio Extension will install the **NSwag CLI** as a [.NET global tool](https://www.nuget.org/packages/NSwag.ConsoleCore) from nuget.org using the latest available version. @@ -66,8 +60,6 @@ The project **Kiota** code generator produces code that depends on the following The **Swagger Codegen CLI** code generator produces code that depends on the [RestSharp](https://www.nuget.org/packages/RestSharp/105.2.3) and [JsonSubTypes](https://www.nuget.org/packages/JsonSubTypes/1.9.0) NuGet packages -The **AutoRest** code generator produces code that depends on the [Microsoft.Rest.ClientRuntime](https://www.nuget.org/packages/Microsoft.Rest.ClientRuntime/2.3.24) and [Newtonsoft.Json](https://www.nuget.org/packages/Newtonsoft.Json/13.0.3) NuGet packages - ***NOTE: Visual Studio for Mac version currently installs missing NuGet packages via the dotnet CLI tool*** ## Screenshots diff --git a/docs/adr/0001-code-generator-factory-styles.md b/docs/adr/0001-code-generator-factory-styles.md index 8dc42fa1bb..24b8189c07 100644 --- a/docs/adr/0001-code-generator-factory-styles.md +++ b/docs/adr/0001-code-generator-factory-styles.md @@ -12,8 +12,7 @@ external tools. We deliberately keep these two styles separate rather than forcing a single shared factory. Collapsing the CLI factories into one enum-dispatch factory would require a union of every -generator's parameters (some need `IOpenApiDocumentFactory`, AutoRest is `[Obsolete]`, options -types differ) and would remove the per-command mock seam, reducing testability and locality in the -CLI. The shared seam that actually concentrates external-tool behaviour across both hosts is +generator's parameters (some need `IOpenApiDocumentFactory`, options types differ) and would remove +the per-command mock seam, reducing testability and locality in the CLI. The shared seam that actually concentrates external-tool behaviour across both hosts is `Rapicgen.Core.External.ToolRunner` together with the `Rapicgen.Core.ExternalTools` version registry, not the factory layer. diff --git a/docs/website/cli.html b/docs/website/cli.html index 47ae7881e0..abfd39c3c1 100644 --- a/docs/website/cli.html +++ b/docs/website/cli.html @@ -103,7 +103,6 @@

Core Requirements

  • .NET 6.0 runtime or later - Foundation for all operations
  • Java Runtime Environment - Required for Swagger Codegen CLI and OpenAPI Generator
  • .NET SDK - Required for NSwag, Kiota, and Refitter CLI installations
  • -
  • NPM (Node.js) - Required for AutoRest CLI installation
  • Internet connectivity - For downloading tools and dependencies on first use
  • @@ -146,7 +145,6 @@

    C# Generator Help

    -?|-h|--help Show help information. Commands: - autorest AutoRest (v3.0.0-beta.20210504.2) kiota Microsoft Kiota (v1.32.4) nswag NSwag (v14.7.1) openapi OpenAPI Generator (v7.23.0) @@ -156,23 +154,6 @@

    C# Generator Help

    Run 'csharp [command] -?|-h|--help' for more information about a command. -
    -

    Specific Generator Help

    -
    rapicgen csharp autorest --help
    - Output: -
    Generate Swagger / Open API client using AutoRest
    -
    -Usage: run autorest [options] <swaggerFile> <namespace> <outputFile>
    -
    -Arguments:
    -  swaggerFile   Path to the Swagger / Open API specification file
    -  namespace     Default namespace to in the generated code
    -  outputFile    Output filename to write the generated code to. Default is the swaggerFile .cs
    -
    -Options:
    -  -?|-h|--help  Show help information
    -
    -

    C# Code Generation

    Generate C# API clients using any of the supported generators with consistent command patterns.

    @@ -223,16 +204,6 @@

    Generate Refit Interfaces

    rapicgen csharp refitter swagger.json MyApi.Contracts ./RefitClient.cs -

    AutoRest (Deprecated) - Azure-Optimized

    - -

    ⚠️ Deprecation Notice: AutoRest is deprecated by Microsoft and will be retired on July 1, 2026. For migration guidance, see the AutoRest Migration Guide. Use NSwag, Refitter, or Kiota instead.

    - -
    -

    AutoRest for Azure APIs

    -
    # Ideal for Azure services and enterprise APIs
    -rapicgen csharp autorest swagger.json Azure.MyService ./AzureClient.cs
    -
    -

    Swagger Codegen CLI - Proven Reliability

    @@ -367,11 +338,6 @@

    Complete GitHub Actions Workflow

    distribution: 'temurin' java-version: '17' - - name: Setup Node.js (for AutoRest) - uses: actions/setup-node@v4 - with: - node-version: '18' - - name: Install rapicgen run: dotnet tool install --global rapicgen @@ -481,10 +447,6 @@

    Dockerfile for API Client Generation

    # Install Java for OpenAPI Generator and Swagger Codegen RUN apt-get update && apt-get install -y openjdk-17-jdk -# Install Node.js and NPM for AutoRest -RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \ - apt-get install -y nodejs - # Install rapicgen RUN dotnet tool install --global rapicgen @@ -602,21 +564,12 @@

    Java-Related Issues

    -
    -

    NPM and Node.js Issues

    -
      -
    • NPM not found: Install Node.js which includes NPM
    • -
    • Permission errors: Use npm prefix or install with --unsafe-perm
    • -
    • Corporate proxies: Configure NPM proxy settings
    • -
    -
    -

    Network and Download Issues

    • Slow downloads: Pre-cache JAR files and use local specs
    • SSL certificate errors: Update certificates or use --ignore-ssl-errors
    • -
    • Firewall blocking: Whitelist GitHub, NPM, and Maven Central
    • +
    • Firewall blocking: Whitelist GitHub and Maven Central
    diff --git a/docs/website/download.html b/docs/website/download.html index 5ba908cdc6..cc50354035 100644 --- a/docs/website/download.html +++ b/docs/website/download.html @@ -76,7 +76,7 @@

    🚀 Visual Studio 2022

    Key Features:

      -
    • Full support for all 6 code generators (NSwag, OpenAPI Generator, Kiota, Refitter, Swagger Codegen CLI, AutoRest)
    • +
    • Full support for all code generators (NSwag, OpenAPI Generator, Kiota, Refitter, and Swagger Codegen CLI)
    • Latest Visual Studio integration APIs
    • Enhanced performance and stability
    • Modern UI and improved user experience
    • @@ -303,7 +303,6 @@

      CLI Tool Requirements

    • .NET 6.0 runtime or later - Core requirement
    • Java Runtime Environment - For Swagger Codegen CLI and OpenAPI Generator
    • .NET SDK - For NSwag, Kiota, and Refitter CLI installations
    • -
    • NPM - For AutoRest CLI installation
    • Internet access - For downloading dependencies on first use
    @@ -316,7 +315,7 @@

    💡 Pro Tips for Smooth Installation

  • First-time use delay - Some code generators download on demand, expect initial delays
  • Java configuration - Configure Java path in settings if multiple installations exist
  • Network access - Ensure internet access for dependency downloads
  • -
  • Proxy settings - Configure NPM and Java tools for corporate proxies
  • +
  • Proxy settings - Configure Java tools for corporate proxies
  • @@ -324,8 +323,7 @@

    Corporate Environment Setup

    1. Java Configuration - Set JAVA_HOME environment variable or configure in extension settings
    2. -
    3. NPM Proxy Setup - Configure NPM for corporate proxies: npm config set proxy http://proxy:port
    4. -
    5. Firewall Rules - Allow downloads from GitHub, NPM registry, and Maven central
    6. +
    7. Firewall Rules - Allow downloads from GitHub and Maven central
    8. JAR File Caching - Pre-download JAR files to shared locations if needed
    @@ -375,15 +373,6 @@

    Java Not Found Errors

    -
    -

    NPM Installation Issues

    -
      -
    • Install Node.js and NPM
    • -
    • Configure proxy settings if behind corporate firewall
    • -
    • Clear NPM cache: npm cache clean --force
    • -
    -
    -

    Support and Updates

    diff --git a/docs/website/features.html b/docs/website/features.html index c1c54c6448..29c8835464 100644 --- a/docs/website/features.html +++ b/docs/website/features.html @@ -155,22 +155,6 @@

    Proven Reliability:

    -
    -

    AutoRestCodeGenerator

    -

    Version: v3.0.0-beta.20210504.2 (v3), v2.0.4417 (v2)

    -

    ⚠️ Deprecated: AutoRest is deprecated by Microsoft and will be retired on July 1, 2026. Use NSwag, Refitter, or Kiota instead. See AutoRest Migration Guide for details.

    -

    Generates a single file C# REST API Client using AutoRest. Equivalent to: --csharp --input-file=[swagger file] --output-file=[output file] --namespace=[namespace] --add-credentials

    -
    -

    Enterprise Features:

    -
      -
    • Azure service optimization
    • -
    • Advanced authentication
    • -
    • Retry policies and timeout configuration
    • -
    • Enterprise-grade reliability
    • -
    -
    -
    -

    RefitterCodeGenerator

    Version: v2.0.0

    @@ -236,7 +220,7 @@

    Settings and Customization

    Visual Studio Integration

    diff --git a/src/All.slnx b/src/All.slnx index 491f35436e..8b77067311 100644 --- a/src/All.slnx +++ b/src/All.slnx @@ -34,26 +34,6 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/src/CLI/ApiClientCodeGen.CLI.Tests/Command/AutoRestCodeGeneratorFactoryTests.cs b/src/CLI/ApiClientCodeGen.CLI.Tests/Command/AutoRestCodeGeneratorFactoryTests.cs deleted file mode 100644 index 86a04853b4..0000000000 --- a/src/CLI/ApiClientCodeGen.CLI.Tests/Command/AutoRestCodeGeneratorFactoryTests.cs +++ /dev/null @@ -1,9 +0,0 @@ -using ApiClientCodeGen.Tests.Common; -using Xunit; - -namespace Rapicgen.CLI.Tests.Command -{ - public class AutoRestCodeGeneratorFactoryTests : AutoRestDeprecatedTestClass - { - } -} \ No newline at end of file diff --git a/src/CLI/ApiClientCodeGen.CLI.Tests/Command/AutoRestCommandTests.cs b/src/CLI/ApiClientCodeGen.CLI.Tests/Command/AutoRestCommandTests.cs deleted file mode 100644 index 2f10be6e66..0000000000 --- a/src/CLI/ApiClientCodeGen.CLI.Tests/Command/AutoRestCommandTests.cs +++ /dev/null @@ -1,9 +0,0 @@ -using ApiClientCodeGen.Tests.Common; -using Xunit; - -namespace Rapicgen.CLI.Tests.Command -{ - public class AutoRestCommandTests : AutoRestDeprecatedTestClass - { - } -} \ No newline at end of file diff --git a/src/CLI/ApiClientCodeGen.CLI.Tests/Command/CliHelpTests.cs b/src/CLI/ApiClientCodeGen.CLI.Tests/Command/CliHelpTests.cs deleted file mode 100644 index f1e08a93f3..0000000000 --- a/src/CLI/ApiClientCodeGen.CLI.Tests/Command/CliHelpTests.cs +++ /dev/null @@ -1,127 +0,0 @@ -using System; -using System.IO; -using FluentAssertions; -using Xunit; - -namespace Rapicgen.CLI.Tests.Command -{ - /// - /// Tests for CLI help output and deprecation messaging. - /// Validates that AutoRest deprecation notices are properly displayed to users. - /// - [Trait("Category", "Integration")] - public class CliHelpTests - { - /// - /// Validates that the AutoRest command description in Program.cs contains the canonical deprecated label. - /// This is the string shown when users run 'rapicgen csharp --help'. - /// - [Fact] - public void AutoRest_Help_Description_Contains_Deprecated_Label() - { - // Arrange - The canonical description from Program.cs line 44 - const string expectedDescription = "AutoRest (Deprecated - v3.0.0-beta.20210504.2)"; - - // Act - Read the Program.cs file to verify the actual registered description - // Navigate from test assembly location to CLI project - var testDirectory = AppContext.BaseDirectory; - var cliProjectPath = Path.GetFullPath(Path.Combine(testDirectory, "..", "..", "..", "..", "ApiClientCodeGen.CLI", "Program.cs")); - - if (!File.Exists(cliProjectPath)) - { - throw new InvalidOperationException($"Program.cs file not found at: {cliProjectPath}"); - } - - var programContent = File.ReadAllText(cliProjectPath); - - // Assert - Verify the canonical deprecated label is present - programContent.Should().Contain(expectedDescription, - "the CLI help must show the deprecated label to warn users"); - } - - /// - /// Validates that the AutoRestCommand emits a runtime deprecation warning. - /// This is the warning shown when users actually execute 'rapicgen csharp autorest'. - /// - [Fact] - public void AutoRest_Command_Contains_Runtime_Warning() - { - // Arrange - The canonical runtime warning message - const string expectedWarning = "WARNING: AutoRest is deprecated by Microsoft and will be retired on July 1, 2026. AutoRest support will be removed from this tool in a future major version. Use NSwag, Refitter, or Kiota instead."; - - // Act - Read the AutoRestCommand.cs file to verify the runtime warning - var testDirectory = AppContext.BaseDirectory; - var commandPath = Path.GetFullPath(Path.Combine(testDirectory, "..", "..", "..", "..", "ApiClientCodeGen.CLI", "Commands", "CSharp", "AutoRestCommand.cs")); - - var commandContent = File.ReadAllText(commandPath); - - // Assert - Verify the runtime warning is emitted - commandContent.Should().Contain(expectedWarning, - "the command must emit a deprecation warning on every execution"); - - // Verify it contains Console.Error.WriteLine for stderr output - commandContent.Should().Contain("Console.Error.WriteLine", - "warnings should be written to stderr, not stdout"); - - // Verify warning prefix - commandContent.Should().Contain("WARNING:", - "deprecation messages must be clearly marked as warnings"); - } - - /// - /// Validates that the AutoRestCommand class has the [Obsolete] attribute. - /// This provides compile-time warnings to NuGet package consumers. - /// - [Fact] - public void AutoRest_Command_Has_Obsolete_Attribute() - { - // Arrange - The expected Obsolete attribute message - const string expectedObsoleteMessage = "AutoRest is deprecated by Microsoft and will be retired on July 1, 2026. AutoRest support will be removed from this tool in a future major version. Use NSwag, Refitter, or Kiota instead."; - - // Act - Read the AutoRestCommand.cs file to verify the [Obsolete] attribute - var testDirectory = AppContext.BaseDirectory; - var commandPath = Path.GetFullPath(Path.Combine(testDirectory, "..", "..", "..", "..", "ApiClientCodeGen.CLI", "Commands", "CSharp", "AutoRestCommand.cs")); - - var commandContent = File.ReadAllText(commandPath); - - // Assert - Verify the [Obsolete] attribute is present - commandContent.Should().Contain("[Obsolete(", - "the command class must be marked with [Obsolete] for compile-time warnings"); - - commandContent.Should().Contain(expectedObsoleteMessage, - "the [Obsolete] attribute must contain the canonical deprecation message"); - - // Verify it's set as non-error (false parameter) - commandContent.Should().Contain("false)]", - "the [Obsolete] attribute should be a warning, not an error, during Phase 1"); - } - - /// - /// Validates that the CLI Program.cs suppresses CS0618 warnings when using AutoRest types. - /// This is necessary because AutoRest types are marked [Obsolete] but still need to be registered. - /// - [Fact] - public void Program_Suppresses_Obsolete_Warnings_For_AutoRest_DI_Registration() - { - // Arrange - var testDirectory = AppContext.BaseDirectory; - var programPath = Path.GetFullPath(Path.Combine(testDirectory, "..", "..", "..", "..", "ApiClientCodeGen.CLI", "Program.cs")); - - var programContent = File.ReadAllText(programPath); - - // Assert - Verify CS0618 is suppressed around AutoRest service registration - programContent.Should().Contain("#pragma warning disable CS0618", - "Program.cs must suppress obsolete warnings when registering deprecated AutoRest services"); - - programContent.Should().Contain("#pragma warning restore CS0618", - "suppression should be scoped to minimize warning suppression"); - - // Verify AutoRest DI registrations are present - programContent.Should().Contain("IAutoRestOptions", - "AutoRest options must still be registered during deprecation period"); - - programContent.Should().Contain("IAutoRestCodeGeneratorFactory", - "AutoRest factory must still be registered during deprecation period"); - } - } -} diff --git a/src/CLI/ApiClientCodeGen.CLI.Tests/Extensions/SupportedCodeGeneratorNameTests.cs b/src/CLI/ApiClientCodeGen.CLI.Tests/Extensions/SupportedCodeGeneratorNameTests.cs index ed47047cb0..40ac723769 100644 --- a/src/CLI/ApiClientCodeGen.CLI.Tests/Extensions/SupportedCodeGeneratorNameTests.cs +++ b/src/CLI/ApiClientCodeGen.CLI.Tests/Extensions/SupportedCodeGeneratorNameTests.cs @@ -7,15 +7,6 @@ namespace Rapicgen.CLI.Tests.Extensions { public class SupportedCodeGeneratorNameTests { - #pragma warning disable CS0618 // Type or member is obsolete - These tests intentionally validate deprecated AutoRest during deprecation period - [Fact] - public void GetName_AutoRest() - => SupportedCodeGenerator.AutoRest - .GetName() - .Should() - .Be(SupportedCodeGenerator.AutoRest.ToString()); - #pragma warning restore CS0618 - [Fact] public void GetName_NSwag() => SupportedCodeGenerator.NSwag @@ -42,7 +33,6 @@ public void GetName_OpenApi() => SupportedCodeGenerator.OpenApi .GetName() .Should() - .Be("OpenAPI Generator"); - } - #pragma warning restore CS0618 -} \ No newline at end of file + .Be("OpenAPI Generator"); + } + } \ No newline at end of file diff --git a/src/CLI/ApiClientCodeGen.CLI/Commands/CSharp/AutoRestCodeGeneratorFactory.cs b/src/CLI/ApiClientCodeGen.CLI/Commands/CSharp/AutoRestCodeGeneratorFactory.cs deleted file mode 100644 index 136e3e869f..0000000000 --- a/src/CLI/ApiClientCodeGen.CLI/Commands/CSharp/AutoRestCodeGeneratorFactory.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using Rapicgen.Core.Generators; -using Rapicgen.Core.Generators.AutoRest; -using Rapicgen.Core.Generators.NSwag; -using Rapicgen.Core.Installer; -using Rapicgen.Core.Options.AutoRest; - -namespace Rapicgen.CLI.Commands.CSharp -{ - [Obsolete("AutoRest is deprecated by Microsoft and will be retired on July 1, 2026. AutoRest support will be removed from this tool in a future major version. Use NSwag, Refitter, or Kiota instead.", false)] - public interface IAutoRestCodeGeneratorFactory - { - ICodeGenerator Create( - string swaggerFile, - string defaultNamespace, - IAutoRestOptions options, - IProcessLauncher processLauncher, - IOpenApiDocumentFactory documentFactory, - IDependencyInstaller dependencyInstaller); - } - - [Obsolete("AutoRest is deprecated by Microsoft and will be retired on July 1, 2026. AutoRest support will be removed from this tool in a future major version. Use NSwag, Refitter, or Kiota instead.", false)] - public class AutoRestCodeGeneratorFactory : IAutoRestCodeGeneratorFactory - { -#pragma warning disable CS0618 // Type or member is obsolete - public ICodeGenerator Create( - string swaggerFile, - string defaultNamespace, - IAutoRestOptions options, - IProcessLauncher processLauncher, - IOpenApiDocumentFactory documentFactory, - IDependencyInstaller dependencyInstaller) - => new AutoRestCSharpCodeGenerator( - swaggerFile, - defaultNamespace, - options, - processLauncher, - documentFactory, - dependencyInstaller); -#pragma warning restore CS0618 // Type or member is obsolete - } -} \ No newline at end of file diff --git a/src/CLI/ApiClientCodeGen.CLI/Commands/CSharp/AutoRestCommand.cs b/src/CLI/ApiClientCodeGen.CLI/Commands/CSharp/AutoRestCommand.cs deleted file mode 100644 index b47cb8d9cd..0000000000 --- a/src/CLI/ApiClientCodeGen.CLI/Commands/CSharp/AutoRestCommand.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; -using System.Threading; -using Spectre.Console.Cli; -using Rapicgen.Core; -using Rapicgen.Core.Generators; -using Rapicgen.Core.Generators.NSwag; -using Rapicgen.Core.Installer; -using Rapicgen.Core.Logging; -using Rapicgen.Core.Options.AutoRest; - -namespace Rapicgen.CLI.Commands.CSharp -{ - [Obsolete("AutoRest is deprecated by Microsoft and will be retired on July 1, 2026. AutoRest support will be removed from this tool in a future major version. Use NSwag, Refitter, or Kiota instead.", false)] - public class AutoRestCommand : CodeGeneratorCommand - { - private readonly IAutoRestOptions options; - private readonly IProcessLauncher processLauncher; - private readonly IAutoRestCodeGeneratorFactory factory; - private readonly IOpenApiDocumentFactory documentFactory; - private readonly IDependencyInstaller dependencyInstaller; - - [Obsolete("AutoRest is deprecated by Microsoft and will be retired on July 1, 2026. AutoRest support will be removed from this tool in a future major version. Use NSwag, Refitter, or Kiota instead.", false)] - public class AutoRestSettings : CodeGeneratorCommand.Settings - { - } - - public AutoRestCommand( - IConsoleOutput console, - IAutoRestOptions options, - IProcessLauncher processLauncher, - IProgressReporter? progressReporter, - IAutoRestCodeGeneratorFactory factory, - IOpenApiDocumentFactory documentFactory, - IDependencyInstaller dependencyInstaller) : base(console, progressReporter) - { - this.options = options ?? throw new ArgumentNullException(nameof(options)); - this.processLauncher = processLauncher ?? throw new ArgumentNullException(nameof(processLauncher)); - this.factory = factory ?? throw new ArgumentNullException(nameof(factory)); - this.documentFactory = documentFactory ?? throw new ArgumentNullException(nameof(documentFactory)); - this.dependencyInstaller = - dependencyInstaller ?? throw new ArgumentNullException(nameof(dependencyInstaller)); - } - - protected override int Execute(CommandContext context, AutoRestSettings settings, CancellationToken cancellationToken) - { - // Emit deprecation warning to stderr - Console.Error.WriteLine("WARNING: AutoRest is deprecated by Microsoft and will be retired on July 1, 2026. AutoRest support will be removed from this tool in a future major version. Use NSwag, Refitter, or Kiota instead."); - - return base.Execute(context, settings, cancellationToken); - } - - public override ICodeGenerator CreateGenerator(AutoRestSettings settings) - => factory.Create( - settings.SwaggerFile, - settings.DefaultNamespace, - options, - processLauncher, - documentFactory, - dependencyInstaller); - } -} \ No newline at end of file diff --git a/src/CLI/ApiClientCodeGen.CLI/Program.cs b/src/CLI/ApiClientCodeGen.CLI/Program.cs index e66e151ec0..06d7cb6eef 100644 --- a/src/CLI/ApiClientCodeGen.CLI/Program.cs +++ b/src/CLI/ApiClientCodeGen.CLI/Program.cs @@ -1,6 +1,5 @@ using System; using System.Diagnostics.CodeAnalysis; -using System.Threading.Tasks; using Rapicgen.CLI.Commands; using Rapicgen.Core; using Rapicgen.Core.Exceptions; @@ -8,7 +7,6 @@ using Rapicgen.Core.Generators.NSwag; using Rapicgen.Core.Installer; using Rapicgen.Core.Logging; -using Rapicgen.Core.Options.AutoRest; using Rapicgen.Core.Options.General; using Rapicgen.Core.Options.OpenApiGenerator; using Microsoft.Extensions.DependencyInjection; @@ -40,10 +38,6 @@ public static int Main(string[] args) { cs.SetDescription("Generate C# API clients using various generators"); - cs.AddCommand("autorest") - .WithDescription("AutoRest (Deprecated - v3.0.0-beta.20210504.2)") - .WithExample(new[] { "autorest", "petstore.json", "GeneratedCode", "Output.cs" }); - cs.AddCommand("kiota") .WithDescription($"Microsoft Kiota ({ExternalTools.Kiota.VersionLabel})") .WithExample(new[] { "kiota", "petstore.json", "GeneratedCode", "Output.cs" }); @@ -93,9 +87,6 @@ private static void ConfigureServices(IServiceCollection services) services.AddLogging(b => b.AddDebug()); services.AddSingleton(); services.AddSingleton(); -#pragma warning disable CS0618 // Type or member is obsolete - services.AddSingleton(); -#pragma warning restore CS0618 // Type or member is obsolete services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); @@ -105,15 +96,11 @@ private static void ConfigureServices(IServiceCollection services) services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); -#pragma warning disable CS0618 // Type or member is obsolete - services.AddSingleton(); -#pragma warning restore CS0618 // Type or member is obsolete services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); - services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); } diff --git a/src/Core/ApiClientCodeGen.Core.IntegrationTests/DependencyInstallerTests.cs b/src/Core/ApiClientCodeGen.Core.IntegrationTests/DependencyInstallerTests.cs index aaa0866f64..0f8546221e 100644 --- a/src/Core/ApiClientCodeGen.Core.IntegrationTests/DependencyInstallerTests.cs +++ b/src/Core/ApiClientCodeGen.Core.IntegrationTests/DependencyInstallerTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using ApiClientCodeGen.Tests.Common; using Rapicgen.Core.Generators; using Rapicgen.Core.Installer; @@ -19,7 +19,6 @@ public class DependencyInstallerTests : TestWithResources [InlineData(OpenApiSupportedVersion.V7070)] public void InstallOpenApiGenerator_Returns_Path(OpenApiSupportedVersion version) => (new DependencyInstaller( - new NpmInstaller(new ProcessLauncher()), new FileDownloader(new WebDownloader()), new ProcessLauncher()) .InstallOpenApiGenerator(version)) @@ -29,30 +28,16 @@ public void InstallOpenApiGenerator_Returns_Path(OpenApiSupportedVersion version [Fact] public void InstallSwaggerCodegen_Returns_Path() => (new DependencyInstaller( - new NpmInstaller(new ProcessLauncher()), new FileDownloader(new WebDownloader()), new ProcessLauncher()) .InstallSwaggerCodegen()) .Should() .NotBeNullOrWhiteSpace(); - [Fact] - public void InstallAutoRest_Does_NotThrow() - { - new Action( - () => new DependencyInstaller( - new NpmInstaller(new ProcessLauncher()), - new FileDownloader(new WebDownloader()), - new ProcessLauncher()).InstallAutoRest()) - .Should() - .NotThrow(); - } - [SkippableFact(typeof(ProcessLaunchException))] public void InstallNSwag_Does_NotThrow() { new DependencyInstaller( - new NpmInstaller(new ProcessLauncher()), new FileDownloader(new WebDownloader()), new ProcessLauncher()).InstallNSwag(); } @@ -62,7 +47,6 @@ public void InstallKiota_Does_NotThrow() { new Action( () => new DependencyInstaller( - new NpmInstaller(new ProcessLauncher()), new FileDownloader(new WebDownloader()), new ProcessLauncher()).InstallKiota()) .Should() diff --git a/src/Core/ApiClientCodeGen.Core.IntegrationTests/Generators/CSharp/AutoRestCodeGeneratorTests.cs b/src/Core/ApiClientCodeGen.Core.IntegrationTests/Generators/CSharp/AutoRestCodeGeneratorTests.cs deleted file mode 100644 index 742ab59232..0000000000 --- a/src/Core/ApiClientCodeGen.Core.IntegrationTests/Generators/CSharp/AutoRestCodeGeneratorTests.cs +++ /dev/null @@ -1,10 +0,0 @@ -using ApiClientCodeGen.Tests.Common; -using Xunit; - -namespace ApiClientCodeGen.Core.IntegrationTests.Generators.CSharp -{ - [Trait("Category", "SkipWhenLiveUnitTesting")] - public class AutoRestCodeGeneratorTests : AutoRestDeprecatedTestClass - { - } -} \ No newline at end of file diff --git a/src/Core/ApiClientCodeGen.Core.IntegrationTests/Generators/CSharp/OpenApi3/AutoRestCodeGeneratorTests.cs b/src/Core/ApiClientCodeGen.Core.IntegrationTests/Generators/CSharp/OpenApi3/AutoRestCodeGeneratorTests.cs deleted file mode 100644 index 1f9216038f..0000000000 --- a/src/Core/ApiClientCodeGen.Core.IntegrationTests/Generators/CSharp/OpenApi3/AutoRestCodeGeneratorTests.cs +++ /dev/null @@ -1,10 +0,0 @@ -using ApiClientCodeGen.Tests.Common; -using Xunit; - -namespace ApiClientCodeGen.Core.IntegrationTests.Generators.CSharp.OpenApi3 -{ - [Trait("Category", "SkipWhenLiveUnitTesting")] - public class AutoRestCodeGeneratorTests : AutoRestDeprecatedTestClass - { - } -} \ No newline at end of file diff --git a/src/Core/ApiClientCodeGen.Core.IntegrationTests/Generators/CSharp/OpenApi3/Yaml/AutoRestCodeGeneratorYamlTests.cs b/src/Core/ApiClientCodeGen.Core.IntegrationTests/Generators/CSharp/OpenApi3/Yaml/AutoRestCodeGeneratorYamlTests.cs deleted file mode 100644 index db84599e8b..0000000000 --- a/src/Core/ApiClientCodeGen.Core.IntegrationTests/Generators/CSharp/OpenApi3/Yaml/AutoRestCodeGeneratorYamlTests.cs +++ /dev/null @@ -1,10 +0,0 @@ -using ApiClientCodeGen.Tests.Common; -using Xunit; - -namespace ApiClientCodeGen.Core.IntegrationTests.Generators.CSharp.OpenApi3.Yaml -{ - [Trait("Category", "SkipWhenLiveUnitTesting")] - public class AutoRestCodeGeneratorYamlTests : AutoRestDeprecatedTestClass - { - } -} \ No newline at end of file diff --git a/src/Core/ApiClientCodeGen.Core.IntegrationTests/Generators/CSharp/Yaml/AutoRestCodeGeneratorYamlTests.cs b/src/Core/ApiClientCodeGen.Core.IntegrationTests/Generators/CSharp/Yaml/AutoRestCodeGeneratorYamlTests.cs deleted file mode 100644 index 2dc9de5f62..0000000000 --- a/src/Core/ApiClientCodeGen.Core.IntegrationTests/Generators/CSharp/Yaml/AutoRestCodeGeneratorYamlTests.cs +++ /dev/null @@ -1,10 +0,0 @@ -using ApiClientCodeGen.Tests.Common; -using Xunit; - -namespace ApiClientCodeGen.Core.IntegrationTests.Generators.CSharp.Yaml -{ - [Trait("Category", "SkipWhenLiveUnitTesting")] - public class AutoRestCodeGeneratorYamlTests : AutoRestDeprecatedTestClass - { - } -} \ No newline at end of file diff --git a/src/Core/ApiClientCodeGen.Core.Tests/Extensions/CodeGeneratorNameExtensionsTests.cs b/src/Core/ApiClientCodeGen.Core.Tests/Extensions/CodeGeneratorNameExtensionsTests.cs index 6be1f0cb2b..2b983e7ead 100644 --- a/src/Core/ApiClientCodeGen.Core.Tests/Extensions/CodeGeneratorNameExtensionsTests.cs +++ b/src/Core/ApiClientCodeGen.Core.Tests/Extensions/CodeGeneratorNameExtensionsTests.cs @@ -5,7 +5,6 @@ namespace ApiClientCodeGen.Core.Tests.Extensions; -#pragma warning disable CS0618 // Type or member is obsolete - These tests intentionally validate deprecated AutoRest during deprecation period public class CodeGeneratorNameExtensionsTests { [Fact] @@ -43,22 +42,6 @@ public void GetName_NSwag_ReturnsNSwag() .Should() .Be("NSwag"); - #pragma warning disable CS0618 - [Fact] - public void GetName_AutoRest_ReturnsAutoRest() - => SupportedCodeGenerator.AutoRest - .GetName() - .Should() - .Be("AutoRest"); - - [Fact] - public void GetName_AutoRestV3_ReturnsAutoRestV3() - => SupportedCodeGenerator.AutoRestV3 - .GetName() - .Should() - .Be("AutoRestV3"); - #pragma warning restore CS0618 - [Fact] public void GetName_Refitter_ReturnsRefitter() => SupportedCodeGenerator.Refitter @@ -66,4 +49,3 @@ public void GetName_Refitter_ReturnsRefitter() .Should() .Be("Refitter"); } -#pragma warning restore CS0618 diff --git a/src/Core/ApiClientCodeGen.Core.Tests/Extensions/GetDependenciesTests.cs b/src/Core/ApiClientCodeGen.Core.Tests/Extensions/GetDependenciesTests.cs index d9dcaafe16..d86eb5194f 100644 --- a/src/Core/ApiClientCodeGen.Core.Tests/Extensions/GetDependenciesTests.cs +++ b/src/Core/ApiClientCodeGen.Core.Tests/Extensions/GetDependenciesTests.cs @@ -5,17 +5,8 @@ namespace ApiClientCodeGen.Core.Tests.Extensions { - #pragma warning disable CS0618 // Type or member is obsolete - These tests intentionally validate deprecated AutoRest during deprecation period public class GetDependenciesTests { - [Xunit.Fact] - public void GetDependencies_AutoRest() - => SupportedCodeGenerator.AutoRest - .GetDependencies() - .Any(c => c.Name == "Microsoft.Rest.ClientRuntime") - .Should() - .BeTrue(); - [Xunit.Fact] public void GetDependencies_NSwag() => SupportedCodeGenerator.NSwag @@ -40,5 +31,4 @@ public void GetDependencies_OpenApi() .Should() .BeTrue(); } - #pragma warning restore CS0618 } diff --git a/src/Core/ApiClientCodeGen.Core.Tests/Generators/AutoRest/AutoRestArgumentProviderGetArgumentsTests.cs b/src/Core/ApiClientCodeGen.Core.Tests/Generators/AutoRest/AutoRestArgumentProviderGetArgumentsTests.cs deleted file mode 100644 index 2954f30c17..0000000000 --- a/src/Core/ApiClientCodeGen.Core.Tests/Generators/AutoRest/AutoRestArgumentProviderGetArgumentsTests.cs +++ /dev/null @@ -1,9 +0,0 @@ -using ApiClientCodeGen.Tests.Common; -using Xunit; - -namespace ApiClientCodeGen.Core.Tests.Generators.AutoRest -{ - public class AutoRestArgumentProviderGetArgumentsTests : AutoRestDeprecatedTestClass - { - } -} \ No newline at end of file diff --git a/src/Core/ApiClientCodeGen.Core.Tests/Generators/AutoRest/AutoRestArgumentProviderGetLegacyArgumentsTests.cs b/src/Core/ApiClientCodeGen.Core.Tests/Generators/AutoRest/AutoRestArgumentProviderGetLegacyArgumentsTests.cs deleted file mode 100644 index 9fce90caf3..0000000000 --- a/src/Core/ApiClientCodeGen.Core.Tests/Generators/AutoRest/AutoRestArgumentProviderGetLegacyArgumentsTests.cs +++ /dev/null @@ -1,9 +0,0 @@ -using ApiClientCodeGen.Tests.Common; -using Xunit; - -namespace ApiClientCodeGen.Core.Tests.Generators.AutoRest -{ - public class AutoRestArgumentProviderGetLegacyArgumentsTests : AutoRestDeprecatedTestClass - { - } -} \ No newline at end of file diff --git a/src/Core/ApiClientCodeGen.Core.Tests/Generators/AutoRest/AutoRestCSharpCodeGeneratorTests.cs b/src/Core/ApiClientCodeGen.Core.Tests/Generators/AutoRest/AutoRestCSharpCodeGeneratorTests.cs deleted file mode 100644 index 383f394bd0..0000000000 --- a/src/Core/ApiClientCodeGen.Core.Tests/Generators/AutoRest/AutoRestCSharpCodeGeneratorTests.cs +++ /dev/null @@ -1,9 +0,0 @@ -using ApiClientCodeGen.Tests.Common; -using Xunit; - -namespace ApiClientCodeGen.Core.Tests.Generators.AutoRest -{ - public class AutoRestCSharpCodeGeneratorTests : AutoRestDeprecatedTestClass - { - } -} \ No newline at end of file diff --git a/src/Core/ApiClientCodeGen.Core.Tests/Generators/AutoRestEnumRoutingSafetyTests.cs b/src/Core/ApiClientCodeGen.Core.Tests/Generators/AutoRestEnumRoutingSafetyTests.cs deleted file mode 100644 index f04719a593..0000000000 --- a/src/Core/ApiClientCodeGen.Core.Tests/Generators/AutoRestEnumRoutingSafetyTests.cs +++ /dev/null @@ -1,113 +0,0 @@ -using System; -using FluentAssertions; -using Rapicgen.Core; -using Xunit; - -namespace ApiClientCodeGen.Core.Tests.Generators -{ - /// - /// Safety tests to ensure AutoRest generators remain routable during deprecation period. - /// These tests prevent accidental removal of AutoRest code paths before Phase 3. - /// - #pragma warning disable CS0618 // Type or member is obsolete - These tests intentionally validate deprecated AutoRest during deprecation period - [Trait("Category", "Unit")] - public class AutoRestEnumRoutingSafetyTests - { - [Fact] - public void SupportedCodeGenerator_AutoRest_Enum_Value_Exists() - { - // CRITICAL: This test prevents accidental removal during deprecation - // AutoRest must remain functional until Phase 3 (~Jan 2027) - var result = Enum.IsDefined(typeof(SupportedCodeGenerator), SupportedCodeGenerator.AutoRest); - - result.Should().BeTrue( - "AutoRest enum value must exist during deprecation period. " + - "Removal is only allowed in Phase 3."); - } - - [Fact] - public void SupportedCodeGenerator_AutoRestV3_Enum_Value_Exists() - { - // CRITICAL: This test prevents accidental removal during deprecation - // AutoRestV3 must remain functional until Phase 3 (~Jan 2027) - var result = Enum.IsDefined(typeof(SupportedCodeGenerator), SupportedCodeGenerator.AutoRestV3); - - result.Should().BeTrue( - "AutoRestV3 enum value must exist during deprecation period. " + - "Removal is only allowed in Phase 3."); - } - - [Fact] - public void AutoRest_Enum_Can_Be_Parsed_From_String() - { - // Validates that enum parsing for AutoRest works correctly - var parseResult = Enum.TryParse("AutoRest", out var parsedValue); - - parseResult.Should().BeTrue("AutoRest must be parseable from string"); - parsedValue.Should().Be(SupportedCodeGenerator.AutoRest); - } - - [Fact] - public void AutoRestV3_Enum_Can_Be_Parsed_From_String() - { - // Validates that enum parsing for AutoRestV3 works correctly - var parseResult = Enum.TryParse("AutoRestV3", out var parsedValue); - - parseResult.Should().BeTrue("AutoRestV3 must be parseable from string"); - parsedValue.Should().Be(SupportedCodeGenerator.AutoRestV3); - } - - [Theory] - [InlineData(SupportedCodeGenerator.AutoRest)] - [InlineData(SupportedCodeGenerator.AutoRestV3)] - public void AutoRest_Enum_Values_Convert_To_String_Correctly(SupportedCodeGenerator generator) - { - // Validates ToString() behavior for AutoRest enums - var result = generator.ToString(); - - result.Should().NotBeNullOrEmpty(); - result.Should().BeOneOf("AutoRest", "AutoRestV3"); - } - - [Fact] - public void AutoRest_Enum_Values_Are_Marked_As_Obsolete() - { - // The enum VALUES are marked [Obsolete] to provide compile-time warnings - // This is intentional for this project's deprecation strategy - var autoRestField = typeof(SupportedCodeGenerator).GetField(nameof(SupportedCodeGenerator.AutoRest)); - var autoRestV3Field = typeof(SupportedCodeGenerator).GetField(nameof(SupportedCodeGenerator.AutoRestV3)); - - var autoRestObsolete = Attribute.GetCustomAttribute(autoRestField!, typeof(ObsoleteAttribute)) as ObsoleteAttribute; - var autoRestV3Obsolete = Attribute.GetCustomAttribute(autoRestV3Field!, typeof(ObsoleteAttribute)) as ObsoleteAttribute; - - autoRestObsolete.Should().NotBeNull( - "AutoRest enum value should be marked [Obsolete] to provide compile-time warnings"); - autoRestV3Obsolete.Should().NotBeNull( - "AutoRestV3 enum value should be marked [Obsolete] to provide compile-time warnings"); - - autoRestObsolete!.IsError.Should().BeFalse( - "Obsolete attribute should be a warning, not an error, during deprecation period"); - autoRestV3Obsolete!.IsError.Should().BeFalse( - "Obsolete attribute should be a warning, not an error, during deprecation period"); - } - - [Fact] - public void Both_AutoRest_Enums_Present_In_GetValues() - { - // Validates that both AutoRest enum values appear in Enum.GetValues() - var allValues = Enum.GetValues(typeof(SupportedCodeGenerator)); - - var list = new System.Collections.Generic.List(); - foreach (var value in allValues) - { - list.Add((SupportedCodeGenerator)value); - } - - list.Should().Contain(SupportedCodeGenerator.AutoRest, - "AutoRest must be in GetValues() during deprecation"); - list.Should().Contain(SupportedCodeGenerator.AutoRestV3, - "AutoRestV3 must be in GetValues() during deprecation"); - } - } - #pragma warning restore CS0618 -} diff --git a/src/Core/ApiClientCodeGen.Core.Tests/Installer/DependencyInstallerTests.cs b/src/Core/ApiClientCodeGen.Core.Tests/Installer/DependencyInstallerTests.cs index 64c912754c..866c890936 100644 --- a/src/Core/ApiClientCodeGen.Core.Tests/Installer/DependencyInstallerTests.cs +++ b/src/Core/ApiClientCodeGen.Core.Tests/Installer/DependencyInstallerTests.cs @@ -20,29 +20,17 @@ public void Implements_Interface() .Implement(); [Theory, AutoMoqData] - public void Requires_INpmInstaller(IFileDownloader downloader) - => new Action(() => new DependencyInstaller(null, downloader, new ProcessLauncher())) + public void Requires_IFileDownloader(IProcessLauncher processLauncher) + => new Action(() => new DependencyInstaller(null, processLauncher)) .Should() .Throw(); [Theory, AutoMoqData] - public void Requires_IFileDownloader(INpmInstaller npm) - => new Action(() => new DependencyInstaller(npm, null, new ProcessLauncher())) + public void Requires_IProcessLauncher(IFileDownloader downloader) + => new Action(() => new DependencyInstaller(downloader, null)) .Should() .Throw(); - #pragma warning disable CS0618 // Type or member is obsolete - These tests intentionally validate deprecated AutoRest during deprecation period - [Theory, AutoMoqData] - public void InstallAutoRest_Invokes_Npm( - [Frozen] INpmInstaller npm, - DependencyInstaller sut) - { - sut.InstallAutoRest(); - Mock.Get(npm) - .Verify(c => c.InstallNpmPackage("autorest")); - } - #pragma warning restore CS0618 - [Theory, AutoMoqData] public void InstallNSwag_When_NSwag_Not_Installed_Invokes_ProcessLauncher( [Frozen] IProcessLauncher processLauncher, diff --git a/src/Core/ApiClientCodeGen.Core.Tests/Installer/NpmInstallerTests.cs b/src/Core/ApiClientCodeGen.Core.Tests/Installer/NpmInstallerTests.cs deleted file mode 100644 index 07a95abc4a..0000000000 --- a/src/Core/ApiClientCodeGen.Core.Tests/Installer/NpmInstallerTests.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using System.Threading.Tasks; -using ApiClientCodeGen.Tests.Common.Infrastructure; -using AutoFixture.Xunit2; -using Rapicgen.Core.Generators; -using Rapicgen.Core.Installer; -using FluentAssertions; -using Moq; -using Xunit; - -namespace ApiClientCodeGen.Core.Tests.Installer -{ - public class NpmInstallerTests - { - [Fact] - public void Implements_Interface() - => typeof(NpmInstaller) - .Should() - .Implement(); - - [Fact] - public void Requires_ProcessLauncher() - => new Action(() => new NpmInstaller(null)) - .Should() - .ThrowExactly(); - - - [Theory, AutoMoqData] - public void InstallNpmPackage_Invokes_Process_Start( - [Frozen] IProcessLauncher processLauncher, - NpmInstaller sut, - string packageName) - { - sut.InstallNpmPackage(packageName); - - Mock.Get(processLauncher) - .Verify( - c => c.Start( - It.IsAny(), - $"install -g {packageName}", - null)); - } - } -} \ No newline at end of file diff --git a/src/Core/ApiClientCodeGen.Core.Tests/NpmHelperTests.cs b/src/Core/ApiClientCodeGen.Core.Tests/NpmHelperTests.cs deleted file mode 100644 index 2e922a706c..0000000000 --- a/src/Core/ApiClientCodeGen.Core.Tests/NpmHelperTests.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using ApiClientCodeGen.Tests.Common.Infrastructure; -using Rapicgen.Core; -using Rapicgen.Core.Generators; -using FluentAssertions; -using Moq; -using Xunit; - -namespace ApiClientCodeGen.Core.Tests -{ - public class NpmHelperTests - { - [Fact] - public void TryGetNpmPrefixPathFromNpmConfig_Returns_NotNull() - { - NpmHelper.TryGetNpmPrefixPathFromNpmConfig() - .Should() - .NotBeNull(); - } - - [Theory, AutoMoqData] - public void TryGetNpmPrefixPathFromNpmConfig_Returns_Null_Upon_Exception(IProcessLauncher process) - { - Mock.Get(process) - .Setup( - c => c.Start( - It.IsAny(), - It.IsAny(), - It.IsAny>(), - It.IsAny>(), - It.IsAny())) - .Throws(); - NpmHelper.TryGetNpmPrefixPathFromNpmConfig(process) - .Should() - .BeNull(); - } - } -} \ No newline at end of file diff --git a/src/Core/ApiClientCodeGen.Core.Tests/NuGet/PackageDependenciesTests.cs b/src/Core/ApiClientCodeGen.Core.Tests/NuGet/PackageDependenciesTests.cs index 8b1497693c..b3ba9a545b 100644 --- a/src/Core/ApiClientCodeGen.Core.Tests/NuGet/PackageDependenciesTests.cs +++ b/src/Core/ApiClientCodeGen.Core.Tests/NuGet/PackageDependenciesTests.cs @@ -46,11 +46,6 @@ public void MicrosoftCSharp_IsSystemLibrary() => PackageDependencies.MicrosoftCSharp.IsSystemLibrary .Should().BeTrue(); - [Fact] - public void MicrosoftRestClientRuntime_HasCorrectName() - => PackageDependencies.MicrosoftRestClientRuntime.Name - .Should().Be("Microsoft.Rest.ClientRuntime"); - [Fact] public void Polly_HasCorrectName() => PackageDependencies.Polly.Name.Should().Be("Polly"); @@ -79,7 +74,6 @@ public void AllDependencies_HaveNonEmptyVersion() var dependencies = new[] { PackageDependencies.NewtonsoftJson, - PackageDependencies.MicrosoftRestClientRuntime, PackageDependencies.RestSharp, PackageDependencies.JsonSubTypes, PackageDependencies.RestSharpLatest, @@ -88,8 +82,6 @@ public void AllDependencies_HaveNonEmptyVersion() PackageDependencies.SystemComponentModelAnnotations, PackageDependencies.MicrosoftCSharp, PackageDependencies.Polly, - PackageDependencies.AutoRestCSharp, - PackageDependencies.AzureCore, PackageDependencies.AzureIdentity, PackageDependencies.MicrosoftKiotaAbstractions, PackageDependencies.MicrosoftKiotaAuthenticationAzure, diff --git a/src/Core/ApiClientCodeGen.Core.Tests/NuGet/PackageDependencyListProviderAdditionalTests.cs b/src/Core/ApiClientCodeGen.Core.Tests/NuGet/PackageDependencyListProviderAdditionalTests.cs index cfa1fcb47a..774bb323c2 100644 --- a/src/Core/ApiClientCodeGen.Core.Tests/NuGet/PackageDependencyListProviderAdditionalTests.cs +++ b/src/Core/ApiClientCodeGen.Core.Tests/NuGet/PackageDependencyListProviderAdditionalTests.cs @@ -7,7 +7,6 @@ namespace ApiClientCodeGen.Core.Tests.NuGet; -#pragma warning disable CS0618 // Type or member is obsolete - These tests intentionally validate deprecated AutoRest during deprecation period public class PackageDependencyListProviderAdditionalTests { private readonly PackageDependencyListProvider sut = new(); @@ -36,12 +35,6 @@ public void GetDependencies_Swagger_Contains_NewtonsoftJson() .Should() .Contain(PackageDependencies.NewtonsoftJson); - [Fact] - public void GetDependencies_AutoRestV3_Returns_NotEmpty() - => sut.GetDependencies(SupportedCodeGenerator.AutoRestV3) - .Should() - .NotBeNullOrEmpty(); - [Fact] public void GetDependencies_NSwag_DoesNotContain_RestSharp() => sut.GetDependencies(SupportedCodeGenerator.NSwag) @@ -88,8 +81,6 @@ public void GetDependencies_OpenApiVersion_Latest_ReturnsDependencies() [InlineData(SupportedCodeGenerator.NSwag)] [InlineData(SupportedCodeGenerator.Swagger)] [InlineData(SupportedCodeGenerator.OpenApi)] - [InlineData(SupportedCodeGenerator.AutoRest)] - [InlineData(SupportedCodeGenerator.AutoRestV3)] [InlineData(SupportedCodeGenerator.Kiota)] [InlineData(SupportedCodeGenerator.Refitter)] [InlineData(SupportedCodeGenerator.NSwagStudio)] @@ -102,8 +93,6 @@ public void GetDependencies_AllGenerators_ReturnNonEmpty(SupportedCodeGenerator [InlineData(SupportedCodeGenerator.NSwag)] [InlineData(SupportedCodeGenerator.Swagger)] [InlineData(SupportedCodeGenerator.OpenApi)] - [InlineData(SupportedCodeGenerator.AutoRest)] - [InlineData(SupportedCodeGenerator.AutoRestV3)] [InlineData(SupportedCodeGenerator.Kiota)] [InlineData(SupportedCodeGenerator.Refitter)] [InlineData(SupportedCodeGenerator.NSwagStudio)] @@ -117,4 +106,3 @@ public void GetDependencies_AllGenerators_AllHaveNonEmptyNameAndVersion(Supporte }); } } -#pragma warning restore CS0618 diff --git a/src/Core/ApiClientCodeGen.Core.Tests/NuGet/PackageDependencyListProviderTests.cs b/src/Core/ApiClientCodeGen.Core.Tests/NuGet/PackageDependencyListProviderTests.cs index 5543beb4c1..b0281eb974 100644 --- a/src/Core/ApiClientCodeGen.Core.Tests/NuGet/PackageDependencyListProviderTests.cs +++ b/src/Core/ApiClientCodeGen.Core.Tests/NuGet/PackageDependencyListProviderTests.cs @@ -21,14 +21,6 @@ public void GetDependencies_NSwagStudio_Returns_NotEmpty() .Should() .NotBeNullOrEmpty(); - #pragma warning disable CS0618 // Type or member is obsolete - [Xunit.Fact] - public void GetDependencies_AutoRest_Returns_NotEmpty() - => sut.GetDependencies(SupportedCodeGenerator.AutoRest) - .Should() - .NotBeNullOrEmpty(); - #pragma warning restore CS0618 - [Xunit.Fact] public void GetDependencies_Swagger_Returns_NotEmpty() => sut.GetDependencies(SupportedCodeGenerator.Swagger) @@ -83,18 +75,6 @@ public void GetDependencies_NSwagStudio_Contains_SystemComponentModelAnnotations .Should() .Contain(PackageDependencies.SystemComponentModelAnnotations); - [Xunit.Fact] - public void GetDependencies_AutoRest_Contains_RestClientRuntime() - => sut.GetDependencies(SupportedCodeGenerator.AutoRest) - .Should() - .Contain(PackageDependencies.MicrosoftRestClientRuntime); - - [Xunit.Fact] - public void GetDependencies_AutoRest_Contains_NewtonsoftJson() - => sut.GetDependencies(SupportedCodeGenerator.AutoRest) - .Should() - .Contain(PackageDependencies.NewtonsoftJson); - [Xunit.Fact] public void GetDependencies_Swagger_Contains_RestSharp() => sut.GetDependencies(SupportedCodeGenerator.Swagger) @@ -155,30 +135,6 @@ public void GetDependencies_OpenApi_Contains_SystemThreadingChannels() .Should() .Contain(PackageDependencies.SystemThreadingChannels); - [Xunit.Fact] - public void GetDependencies_AutoRestV3_Contains_RestClientRuntime() - => sut.GetDependencies(SupportedCodeGenerator.AutoRestV3) - .Should() - .Contain(PackageDependencies.MicrosoftRestClientRuntime); - - [Xunit.Fact] - public void GetDependencies_AutoRestV3_Contains_NewtonsoftJson() - => sut.GetDependencies(SupportedCodeGenerator.AutoRestV3) - .Should() - .Contain(PackageDependencies.NewtonsoftJson); - - [Xunit.Fact] - public void GetDependencies_AutoRestV3_Contains_AutoRestCSharp() - => sut.GetDependencies(SupportedCodeGenerator.AutoRestV3) - .Should() - .Contain(PackageDependencies.AutoRestCSharp); - - [Xunit.Fact] - public void GetDependencies_AutoRestV3_Contains_AzureCore() - => sut.GetDependencies(SupportedCodeGenerator.AutoRestV3) - .Should() - .Contain(PackageDependencies.AzureCore); - [Xunit.Fact] public void GetDependencies_Kiota_Contains_AzureIdentity() => sut.GetDependencies(SupportedCodeGenerator.Kiota) diff --git a/src/Core/ApiClientCodeGen.Core.Tests/NuGet/SupportedCodeGeneratorExtensionsTests.cs b/src/Core/ApiClientCodeGen.Core.Tests/NuGet/SupportedCodeGeneratorExtensionsTests.cs index db217a1b89..c1cef85fbb 100644 --- a/src/Core/ApiClientCodeGen.Core.Tests/NuGet/SupportedCodeGeneratorExtensionsTests.cs +++ b/src/Core/ApiClientCodeGen.Core.Tests/NuGet/SupportedCodeGeneratorExtensionsTests.cs @@ -4,7 +4,6 @@ namespace ApiClientCodeGen.Core.Tests.NuGet { - #pragma warning disable CS0618 // Type or member is obsolete - These tests intentionally validate deprecated AutoRest during deprecation period [Xunit.Trait("Category", "Unit")] public class SupportedCodeGeneratorExtensionsTests { @@ -22,13 +21,6 @@ public void GetDependencies_NSwagStudio_Returns_NotEmpty() .Should() .NotBeNullOrEmpty(); - [Xunit.Fact] - public void GetDependencies_AutoRest_Returns_NotEmpty() - => SupportedCodeGenerator.AutoRest - .GetDependencies() - .Should() - .NotBeNullOrEmpty(); - [Xunit.Fact] public void GetDependencies_Swagger_Returns_NotEmpty() => SupportedCodeGenerator.Swagger @@ -57,13 +49,6 @@ public void GetDependencies_NSwagStudio_Contains_NewtonsoftJson() .Should() .Contain(c => c.Name == "Newtonsoft.Json"); - [Xunit.Fact] - public void GetDependencies_AutoRest_Contains_RestClientRuntime() - => SupportedCodeGenerator.AutoRest - .GetDependencies() - .Should() - .Contain(c => c.Name == "Microsoft.Rest.ClientRuntime"); - [Xunit.Fact] public void GetDependencies_Swagger_Contains_RestSharp() => SupportedCodeGenerator.Swagger @@ -127,5 +112,4 @@ public void GetDependencies_Refitter_Contains_Refit() .Should() .Contain(c => c.Name == "Refit"); } - #pragma warning restore CS0618 } diff --git a/src/Core/ApiClientCodeGen.Core.Tests/Options/DefaultAutoRestOptionsTests.cs b/src/Core/ApiClientCodeGen.Core.Tests/Options/DefaultAutoRestOptionsTests.cs deleted file mode 100644 index 79106436f3..0000000000 --- a/src/Core/ApiClientCodeGen.Core.Tests/Options/DefaultAutoRestOptionsTests.cs +++ /dev/null @@ -1,8 +0,0 @@ -using ApiClientCodeGen.Tests.Common; - -namespace ApiClientCodeGen.Core.Tests.Options -{ - public class DefaultAutoRestOptionsTests : AutoRestDeprecatedTestClass - { - } -} \ No newline at end of file diff --git a/src/Core/ApiClientCodeGen.Core.Tests/Options/DefaultGeneralOptionsTests.cs b/src/Core/ApiClientCodeGen.Core.Tests/Options/DefaultGeneralOptionsTests.cs index c0f69b92cf..44b875748e 100644 --- a/src/Core/ApiClientCodeGen.Core.Tests/Options/DefaultGeneralOptionsTests.cs +++ b/src/Core/ApiClientCodeGen.Core.Tests/Options/DefaultGeneralOptionsTests.cs @@ -12,10 +12,6 @@ public class DefaultGeneralOptionsTests public void JavaPath_NotNull() => sut.JavaPath.Should().NotBeNullOrWhiteSpace(); - [Xunit.Fact] - public void NpmPath_NotNull() - => sut.NpmPath.Should().NotBeNullOrWhiteSpace(); - [Xunit.Fact] public void NSwagPath_NotNull() => sut.NSwagPath.Should().NotBeNullOrWhiteSpace(); diff --git a/src/Core/ApiClientCodeGen.Core.Tests/Options/PathProviderTests.cs b/src/Core/ApiClientCodeGen.Core.Tests/Options/PathProviderTests.cs index f1ec239a9d..61d398812e 100644 --- a/src/Core/ApiClientCodeGen.Core.Tests/Options/PathProviderTests.cs +++ b/src/Core/ApiClientCodeGen.Core.Tests/Options/PathProviderTests.cs @@ -23,27 +23,6 @@ public void GetJavaPath_Returns_No_Path_For_Bad_EnvironmentVariableName() path.Should().Be("java"); } - [Xunit.Fact] - public void GetNpmPath_Exists() - { - var path = PathProvider.GetNpmPath(); - path.Should().NotBeNullOrWhiteSpace(); - } - - [Xunit.Fact] - public void GetNpmPath_Exists_For_Specified_Paths() - { - var path = PathProvider.GetNpmPath( - Test.CreateAnnonymous(), - Test.CreateAnnonymous()); - - path.Should() - .Be( - Environment.OSVersion.Platform is PlatformID.MacOSX or PlatformID.Unix - ? "npm" - : string.Empty); - } - [Xunit.Fact] public void GetNSwagPath_Exists() { @@ -51,20 +30,6 @@ public void GetNSwagPath_Exists() path.Should().NotBeNullOrWhiteSpace(); } - [Xunit.Fact] - public void GetAutoRestPath_Returns_NpmPrefix_AutoRestCmd() - { - var path = PathProvider.GetAutoRestPath(); - path.Should().ContainAny("autorest"); - } - - [Xunit.Fact] - public void GetAutoRestPath_Without_Path_Returns_autorest() - { - var path = PathProvider.GetAutoRestPath(true); - path.Should().Be("autorest"); - } - [Xunit.Fact] public void GetNSwagPath_Without_Path_Returns_nswag() { @@ -77,14 +42,5 @@ public void GetNSwagStudioPath_Returns_NotNull() => PathProvider.GetNSwagStudioPath() .Should() .NotBeNullOrWhiteSpace(); - - [Xunit.Fact] - public void GetNpmPath_Without_Path() - => PathProvider.GetNpmPath( - Test.CreateAnnonymous(), - Test.CreateAnnonymous(), - true) - .Should() - .Be("npm"); } } \ No newline at end of file diff --git a/src/Core/ApiClientCodeGen.Core.Tests/ProjectFileUpdaterTests.cs b/src/Core/ApiClientCodeGen.Core.Tests/ProjectFileUpdaterTests.cs deleted file mode 100644 index 976375418a..0000000000 --- a/src/Core/ApiClientCodeGen.Core.Tests/ProjectFileUpdaterTests.cs +++ /dev/null @@ -1,93 +0,0 @@ -using System; -using System.IO; -using System.Xml.Linq; -using Rapicgen.Core; -using Rapicgen.Core.Generators.AutoRest; -using FluentAssertions; -using Xunit; - -namespace ApiClientCodeGen.Core.Tests -{ - #pragma warning disable CS0618 // Type or member is obsolete - These tests intentionally validate deprecated AutoRestConstants during deprecation period - public class ProjectFileUpdaterTests - { - private const string CSharpProjectFileContentsWithout = @" - - - netcoreapp2.1 - -"; - - private const string CSharpProjectFileContentsWith = @" - - - netcoreapp2.1 - false - empty - -"; - - private static string ArrangeAndAct(string contents = null) - { - var sut = new ProjectFileUpdater(XDocument.Parse(contents ?? CSharpProjectFileContentsWithout)); - var document = sut.UpdatePropertyGroup(AutoRestConstants.PropertyGroups); - return document.ToString(); - } - - [Fact] - public void Constructor_Requires_XDocument() - => new Action(() => new ProjectFileUpdater(null as XDocument)) - .Should() - .ThrowExactly(); - - [Fact] - public void UpdatePropertyGroup_Returns_NotNull() - { - var projectFile = Path.GetTempFileName(); - File.WriteAllText(projectFile, CSharpProjectFileContentsWithout); - var sut = new ProjectFileUpdater(projectFile); - sut.UpdatePropertyGroup(AutoRestConstants.PropertyGroups) - .Should() - .NotBeNull(); - } - - [Fact] - public void Updates_PropertyGroups() - => ArrangeAndAct().Should().NotBeEquivalentTo(CSharpProjectFileContentsWithout); - - [Fact] - public void Sets_IncludeGeneratorSharedCode() - => ArrangeAndAct().Should().Contain("True"); - - [Fact] - public void Sets_RestoreAdditionalProjectSources() - { - var xml = ArrangeAndAct(); - xml.Should().Contain(""); - xml.Should().Contain(""); - xml.Should().Contain("https://azuresdkartifacts.blob.core.windows.net/azure-sdk-tools/index.json"); - } - - [Fact] - public void Updates_Existing_PropertyGroups() - => ArrangeAndAct(CSharpProjectFileContentsWith) - .Should() - .NotBeEquivalentTo(CSharpProjectFileContentsWith); - - [Fact] - public void Sets_Existing_IncludeGeneratorSharedCode() - => ArrangeAndAct(CSharpProjectFileContentsWith) - .Should() - .Contain("True"); - - [Fact] - public void Sets_Existing_RestoreAdditionalProjectSources() - { - var xml = ArrangeAndAct(CSharpProjectFileContentsWith); - xml.Should().Contain(""); - xml.Should().Contain(""); - xml.Should().Contain("https://azuresdkartifacts.blob.core.windows.net/azure-sdk-tools/index.json"); - } - } - #pragma warning restore CS0618 -} \ No newline at end of file diff --git a/src/Core/ApiClientCodeGen.Core.Tests/SupportedCodeGeneratorTests.cs b/src/Core/ApiClientCodeGen.Core.Tests/SupportedCodeGeneratorTests.cs index c89848806a..5f804eb24c 100644 --- a/src/Core/ApiClientCodeGen.Core.Tests/SupportedCodeGeneratorTests.cs +++ b/src/Core/ApiClientCodeGen.Core.Tests/SupportedCodeGeneratorTests.cs @@ -6,7 +6,6 @@ namespace ApiClientCodeGen.Core.Tests; -#pragma warning disable CS0618 // Type or member is obsolete - These tests intentionally validate deprecated AutoRest enum values during deprecation period [Trait("Category", "Unit")] public class SupportedCodeGeneratorTests { @@ -15,16 +14,6 @@ public void Enum_Contains_NSwag() => Enum.IsDefined(typeof(SupportedCodeGenerator), SupportedCodeGenerator.NSwag) .Should().BeTrue(); - [Fact] - public void Enum_Contains_AutoRest() - => Enum.IsDefined(typeof(SupportedCodeGenerator), SupportedCodeGenerator.AutoRest) - .Should().BeTrue(); - - [Fact] - public void Enum_Contains_AutoRestV3() - => Enum.IsDefined(typeof(SupportedCodeGenerator), SupportedCodeGenerator.AutoRestV3) - .Should().BeTrue(); - [Fact] public void Enum_Contains_Swagger() => Enum.IsDefined(typeof(SupportedCodeGenerator), SupportedCodeGenerator.Swagger) @@ -53,32 +42,7 @@ public void Enum_Contains_Refitter() [Fact] public void Enum_HasExpectedCount() => Enum.GetValues(typeof(SupportedCodeGenerator)) - .Length.Should().Be(8); - - [Fact] - public void AutoRest_And_AutoRestV3_Both_Present_During_Deprecation() - { - // Both AutoRest enum values must remain functional during deprecation period - // They will be removed together in Phase 3 (~Jan 2027) - var values = Enum.GetValues(typeof(SupportedCodeGenerator)) - .Cast() - .ToList(); - - values.Should().Contain(SupportedCodeGenerator.AutoRest, - "AutoRest (v2) must remain available during deprecation period"); - values.Should().Contain(SupportedCodeGenerator.AutoRestV3, - "AutoRestV3 (v3 beta) must remain available during deprecation period"); - } - - [Fact] - public void AutoRest_Enum_Values_Have_Correct_Integer_Values() - { - // Validate enum integer values to prevent accidental changes during refactoring - ((int)SupportedCodeGenerator.AutoRest).Should().Be(1, - "AutoRest enum value should remain stable"); - ((int)SupportedCodeGenerator.AutoRestV3).Should().Be(2, - "AutoRestV3 enum value should remain stable"); - } + .Length.Should().Be(6); [Fact] public void All_Enum_Values_Are_Distinct() @@ -91,7 +55,6 @@ public void All_Enum_Values_Are_Distinct() values.Should().OnlyHaveUniqueItems("each generator must have a unique enum value"); } } -#pragma warning restore CS0618 public class SupportedLanguageTests { diff --git a/src/Core/ApiClientCodeGen.Core/External/PathProvider.cs b/src/Core/ApiClientCodeGen.Core/External/PathProvider.cs index 8aa065ea0c..df9cda2470 100644 --- a/src/Core/ApiClientCodeGen.Core/External/PathProvider.cs +++ b/src/Core/ApiClientCodeGen.Core/External/PathProvider.cs @@ -43,27 +43,6 @@ public static string GetIncludedJavaPath() } } - public static string GetNpmPath( - string? programFiles = null, - string? programFiles64 = null, - bool withoutPath = false) - { - if (Environment.OSVersion.Platform is PlatformID.MacOSX or PlatformID.Unix || withoutPath) - return "npm"; - - if (string.IsNullOrWhiteSpace(programFiles)) - programFiles = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles); - - if (string.IsNullOrWhiteSpace(programFiles64)) - programFiles64 = programFiles!.Replace(" (x86)", string.Empty); - - var npmCommand = Path.Combine(programFiles, "nodejs\\npm.cmd"); - if (!File.Exists(npmCommand)) - npmCommand = Path.Combine(programFiles64, "nodejs\\npm.cmd"); - - return File.Exists(npmCommand) ? npmCommand : string.Empty; - } - public static string GetNSwagStudioPath() => Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), @@ -77,23 +56,13 @@ public static string GetNSwagPath(bool withoutPath = false) return GetDotNetGlobalToolPath("nswag"); } - public static string GetAutoRestPath(bool withoutPath = false) - { - if (Environment.OSVersion.Platform is PlatformID.MacOSX or PlatformID.Unix || withoutPath) - return "autorest"; - - return Path.Combine( - NpmHelper.GetPrefixPath(), - "autorest.cmd"); - } - public static string GetSwaggerCodegenPath() => Path.Combine( Path.GetTempPath(), "swagger-codegen-cli.jar"); public static string GetOpenApiGeneratorPath( - OpenApiSupportedVersion version = default) + OpenApiSupportedVersion version = default) => Path.Combine( Path.GetTempPath(), $"openapi-generator-cli-{version.GetDescription()}.jar"); diff --git a/src/Core/ApiClientCodeGen.Core/ExternalTool.cs b/src/Core/ApiClientCodeGen.Core/ExternalTool.cs index 5773eeaf1f..e839a8eddf 100644 --- a/src/Core/ApiClientCodeGen.Core/ExternalTool.cs +++ b/src/Core/ApiClientCodeGen.Core/ExternalTool.cs @@ -31,8 +31,6 @@ public static class ExternalTools public static readonly ExternalTool SwaggerCodegen = new("Swagger Codegen CLI", "3.0.34"); - public static readonly ExternalTool AutoRest = new("AutoRest", "3.0.0-beta.20210504.2", "autorest"); - /// /// OpenAPI Generator's default version is the latest entry in . /// An individual generation may select an older version; this represents the default shown to users. diff --git a/src/Core/ApiClientCodeGen.Core/Generators/AutoRest/AutoRestArgumentProvider.cs b/src/Core/ApiClientCodeGen.Core/Generators/AutoRest/AutoRestArgumentProvider.cs deleted file mode 100644 index 8849e955f5..0000000000 --- a/src/Core/ApiClientCodeGen.Core/Generators/AutoRest/AutoRestArgumentProvider.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System; -using System.IO; -using Rapicgen.Core.Options.AutoRest; - -namespace Rapicgen.Core.Generators.AutoRest -{ - [Obsolete("AutoRest is deprecated by Microsoft and will be retired on July 1, 2026. AutoRest support will be removed from this tool in a future major version. Use NSwag, Refitter, or Kiota instead.", false)] - public interface IAutoRestArgumentProvider - { - string GetArguments(string outputFolder, string swaggerFile, string defaultNamespace); - string GetLegacyArguments(string outputFile, string swaggerFile, string defaultNamespace); - } - - [Obsolete("AutoRest is deprecated by Microsoft and will be retired on July 1, 2026. AutoRest support will be removed from this tool in a future major version. Use NSwag, Refitter, or Kiota instead.", false)] - public class AutoRestArgumentProvider : IAutoRestArgumentProvider - { - private readonly IAutoRestOptions options; - - public AutoRestArgumentProvider(IAutoRestOptions options) - { - this.options = options; - } - - public string GetArguments( - string outputFolder, - string swaggerFile, - string defaultNamespace) - { - return AppendCommonArguments( - swaggerFile, - "--use:@autorest/csharp@3.0.0-beta.20210504.2 " + - $"--input-file=\"{swaggerFile}\" " + - $"--output-folder=\"{outputFolder}\" " + - $"--namespace=\"{defaultNamespace}\" "); - } - - public string GetLegacyArguments( - string outputFile, - string swaggerFile, - string defaultNamespace) - { - return AppendCommonArguments( - swaggerFile, - "--csharp " + - $"--input-file=\"{swaggerFile}\" " + - $"--output-file=\"{outputFile}\" " + - $"--namespace=\"{defaultNamespace}\" "); - } - - private string AppendCommonArguments( - string swaggerFile, - string arguments) - { - arguments += "--verbose --debug "; - - if (options.AddCredentials) - arguments += "--add-credentials "; - - arguments += $"--client-side-validation=\"{options.ClientSideValidation}\" "; - arguments += $"--sync-methods=\"{options.SyncMethods}\" "; - - if (options.UseDateTimeOffset) - arguments += "--use-datetimeoffset "; - - if (options.UseInternalConstructors) - arguments += " --use-internal-constructors "; - - if (!options.OverrideClientName) - return arguments; - - var file = new FileInfo(swaggerFile); - var name = file.Name - .Replace(" ", string.Empty) - .Replace(file.Extension, string.Empty); - - arguments += $" --override-client-name=\"{name}\""; - return arguments; - } - } -} diff --git a/src/Core/ApiClientCodeGen.Core/Generators/AutoRest/AutoRestCSharpCodeGenerator.cs b/src/Core/ApiClientCodeGen.Core/Generators/AutoRest/AutoRestCSharpCodeGenerator.cs deleted file mode 100644 index b155c5858e..0000000000 --- a/src/Core/ApiClientCodeGen.Core/Generators/AutoRest/AutoRestCSharpCodeGenerator.cs +++ /dev/null @@ -1,133 +0,0 @@ -using System; -using System.Diagnostics.CodeAnalysis; -using System.IO; -using Rapicgen.Core.External; -using Rapicgen.Core.Generators.NSwag; -using Rapicgen.Core.Installer; -using Rapicgen.Core.Options.AutoRest; -using Rapicgen.Core.Options.General; - -namespace Rapicgen.Core.Generators.AutoRest -{ - [Obsolete("AutoRest is deprecated by Microsoft and will be retired on July 1, 2026. AutoRest support will be removed from this tool in a future major version. Use NSwag, Refitter, or Kiota instead.", false)] - public class AutoRestCSharpCodeGenerator : ICodeGenerator - { - private readonly IProcessLauncher processLauncher; - private readonly IOpenApiDocumentFactory documentFactory; - private readonly IDependencyInstaller dependencyInstaller; - private readonly IAutoRestArgumentProvider argumentProvider; - private static readonly object SyncLock = new(); - - public string SwaggerFile { get; } - public string DefaultNamespace { get; } - -#pragma warning disable CS0618 // Type or member is obsolete - public AutoRestCSharpCodeGenerator( - string swaggerFile, - string defaultNamespace, - IAutoRestOptions options, - IProcessLauncher processLauncher, - IOpenApiDocumentFactory documentFactory, - IDependencyInstaller dependencyInstaller, - IAutoRestArgumentProvider? argumentProvider = null) - { - SwaggerFile = swaggerFile; - DefaultNamespace = defaultNamespace; - this.processLauncher = processLauncher; - this.documentFactory = documentFactory ?? throw new ArgumentNullException(nameof(documentFactory)); - this.dependencyInstaller = dependencyInstaller ?? throw new ArgumentNullException(nameof(dependencyInstaller)); - this.argumentProvider = argumentProvider ?? new AutoRestArgumentProvider(options); - } -#pragma warning restore CS0618 // Type or member is obsolete - - public string GenerateCode(IProgressReporter? pGenerateProgress) - { - lock (SyncLock) - return OnGenerateCode(pGenerateProgress); - } - -#pragma warning disable CS0618 // Type or member is obsolete - [SuppressMessage( - "Usage", - "VSTHRD002:Avoid problematic synchronous waits", - Justification = "This is code is called from an old pre-TPL interface")] - private string OnGenerateCode(IProgressReporter? pGenerateProgress) - { - try - { - pGenerateProgress?.Progress(10); - - var command = PathProvider.GetAutoRestPath(); - pGenerateProgress?.Progress(30); - - dependencyInstaller.InstallAutoRest(); - pGenerateProgress?.Progress(50); - - var document = documentFactory.GetDocumentAsync(SwaggerFile).GetAwaiter().GetResult(); - if (!string.IsNullOrEmpty(document.OpenApi) && - Version.TryParse(document.OpenApi, out var openApiVersion) && - openApiVersion > Version.Parse("3.0.0")) - { - var outputFolder = Path.Combine( - Path.GetDirectoryName(SwaggerFile) ?? throw new InvalidOperationException(), - Guid.NewGuid().ToString("N"), - "TempApiClient"); - - if (!Directory.Exists(outputFolder)) - Directory.CreateDirectory(outputFolder); - - var arguments = argumentProvider.GetArguments( - outputFolder, - SwaggerFile, - DefaultNamespace); - - new ToolRunner(processLauncher).Run( - ExternalTools.AutoRest, command, arguments, Path.GetDirectoryName(SwaggerFile)); - - pGenerateProgress?.Progress(80); - - return GeneratedCode - .PrefixAutogeneratedCodeHeader( - CSharpFileMerger.MergeFilesAndDeleteSource(outputFolder), - ExternalTools.AutoRest.DisplayName, - ExternalTools.AutoRest.VersionLabel); - } - else - { - var outputFile = FileHelper.CreateRandomFile(); - var arguments = argumentProvider.GetLegacyArguments( - outputFile, - SwaggerFile, - DefaultNamespace); - - try - { - new ToolRunner(processLauncher).Run( - ExternalTools.AutoRest, command, arguments, Path.GetDirectoryName(SwaggerFile)); - } - catch (ProcessLaunchException) - { - arguments = arguments.Replace("--version=", "--version "); - new ToolRunner(processLauncher).Run( - ExternalTools.AutoRest, command, arguments, Path.GetDirectoryName(SwaggerFile)); - } - finally - { - pGenerateProgress?.Progress(80); - } - - return GeneratedCode - .PrefixAutogeneratedCodeHeader( - FileHelper.ReadThenDelete(outputFile), - "AutoRest", - "v2.0.4417"); - } - } - finally - { - pGenerateProgress?.Progress(90); - } - } -#pragma warning restore CS0618 // Type or member is obsolete - } -} \ No newline at end of file diff --git a/src/Core/ApiClientCodeGen.Core/Generators/AutoRest/AutoRestConstants.cs b/src/Core/ApiClientCodeGen.Core/Generators/AutoRest/AutoRestConstants.cs deleted file mode 100644 index f83789c6db..0000000000 --- a/src/Core/ApiClientCodeGen.Core/Generators/AutoRest/AutoRestConstants.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Rapicgen.Core.Generators.AutoRest -{ - [Obsolete("AutoRest is deprecated by Microsoft and will be retired on July 1, 2026. AutoRest support will be removed from this tool in a future major version. Use NSwag, Refitter, or Kiota instead.", false)] - public static class AutoRestConstants - { - public static IReadOnlyDictionary PropertyGroups { get; } - = new Dictionary - { - {"IncludeGeneratorSharedCode", bool.TrueString}, - { - "RestoreAdditionalProjectSources", - "https://azuresdkartifacts.blob.core.windows.net/azure-sdk-tools/index.json" - } - }; - } -} \ No newline at end of file diff --git a/src/Core/ApiClientCodeGen.Core/Installer/DependencyInstaller.cs b/src/Core/ApiClientCodeGen.Core/Installer/DependencyInstaller.cs index 26ee81b070..299f9b8d0b 100644 --- a/src/Core/ApiClientCodeGen.Core/Installer/DependencyInstaller.cs +++ b/src/Core/ApiClientCodeGen.Core/Installer/DependencyInstaller.cs @@ -10,32 +10,15 @@ namespace Rapicgen.Core.Installer { public class DependencyInstaller : IDependencyInstaller { - private readonly INpmInstaller npm; private readonly IFileDownloader downloader; private readonly IProcessLauncher processLauncher; public DependencyInstaller( - INpmInstaller npm, IFileDownloader downloader, IProcessLauncher processLauncher) { - this.npm = npm ?? throw new ArgumentNullException(nameof(npm)); this.downloader = downloader ?? throw new ArgumentNullException(nameof(downloader)); - this.processLauncher = processLauncher; - } - - /// - /// Installs AutoRest code generator via NPM. - /// - /// - /// AutoRest is deprecated by Microsoft and will be retired on July 1, 2026. - /// AutoRest support will be removed from this tool in a future major version. - /// Use NSwag, Refitter, or Kiota instead. - /// - [Obsolete("AutoRest is deprecated by Microsoft and will be retired on July 1, 2026. AutoRest support will be removed from this tool in a future major version. Use NSwag, Refitter, or Kiota instead.", false)] - public void InstallAutoRest() - { - npm.InstallNpmPackage(ExternalTools.AutoRest.PackageId!); + this.processLauncher = processLauncher ?? throw new ArgumentNullException(nameof(processLauncher)); } public void InstallNSwag() diff --git a/src/Core/ApiClientCodeGen.Core/Installer/IDependencyInstaller.cs b/src/Core/ApiClientCodeGen.Core/Installer/IDependencyInstaller.cs index fb8def552a..f19131d470 100644 --- a/src/Core/ApiClientCodeGen.Core/Installer/IDependencyInstaller.cs +++ b/src/Core/ApiClientCodeGen.Core/Installer/IDependencyInstaller.cs @@ -1,12 +1,9 @@ -using System; using Rapicgen.Core.Options.OpenApiGenerator; namespace Rapicgen.Core.Installer { public interface IDependencyInstaller { - [Obsolete("AutoRest is deprecated by Microsoft and will be retired on July 1, 2026. AutoRest support will be removed from this tool in a future major version. Use NSwag, Refitter, or Kiota instead.", false)] - void InstallAutoRest(); void InstallNSwag(); string InstallOpenApiGenerator(OpenApiSupportedVersion version = default); string InstallSwaggerCodegen(); diff --git a/src/Core/ApiClientCodeGen.Core/Installer/INpmInstaller.cs b/src/Core/ApiClientCodeGen.Core/Installer/INpmInstaller.cs deleted file mode 100644 index c1223f4439..0000000000 --- a/src/Core/ApiClientCodeGen.Core/Installer/INpmInstaller.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System.Threading.Tasks; - -namespace Rapicgen.Core.Installer -{ - public interface INpmInstaller - { - void InstallNpmPackage(string packageName); - } -} \ No newline at end of file diff --git a/src/Core/ApiClientCodeGen.Core/Installer/NpmInstaller.cs b/src/Core/ApiClientCodeGen.Core/Installer/NpmInstaller.cs deleted file mode 100644 index 0251303563..0000000000 --- a/src/Core/ApiClientCodeGen.Core/Installer/NpmInstaller.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.Diagnostics; -using Rapicgen.Core.External; -using Rapicgen.Core.Generators; -using Rapicgen.Core.Logging; -using Rapicgen.Core.Options.General; - -namespace Rapicgen.Core.Installer -{ - public class NpmInstaller : INpmInstaller - { - private readonly IProcessLauncher processLauncher; - - public NpmInstaller(IProcessLauncher processLauncher) - { - this.processLauncher = processLauncher ?? throw new ArgumentNullException(nameof(processLauncher)); - } - - public void InstallNpmPackage(string packageName) - { - Logger.Instance.WriteLine($"Attempting to install {packageName} through NPM"); - - using var context = new DependencyContext($"npm install -g {packageName}"); - processLauncher.Start(PathProvider.GetNpmPath(), $"install -g {packageName}"); - context.Succeeded(); - - Logger.Instance.WriteLine($"{packageName} installed successfully through NPM"); - } - } -} \ No newline at end of file diff --git a/src/Core/ApiClientCodeGen.Core/NpmHelper.cs b/src/Core/ApiClientCodeGen.Core/NpmHelper.cs deleted file mode 100644 index 83a7f20531..0000000000 --- a/src/Core/ApiClientCodeGen.Core/NpmHelper.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using System.Diagnostics; -using System.IO; -using Rapicgen.Core.External; -using Rapicgen.Core.Generators; -using Rapicgen.Core.Logging; -using Rapicgen.Core.Options.General; - -namespace Rapicgen.Core -{ - public static class NpmHelper - { - public static string GetNpmPath(bool withoutPath = false) - => PathProvider.GetNpmPath(withoutPath: withoutPath); - - public static string GetPrefixPath() - => TryGetNpmPrefixPathFromNpmConfig() ?? - Path.Combine( - Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), - "npm"); - - public static string? TryGetNpmPrefixPathFromNpmConfig(IProcessLauncher? processLauncher = null) - { - try - { - var npm = GetNpmPath(); - string prefix = null!; - - using var context = new DependencyContext("npm config get prefix"); - (processLauncher ?? new ProcessLauncher()).Start( - npm, - "config get prefix", - o => prefix += o, - e => Logger.Instance.WriteLine(e)); - context.Succeeded(); - return prefix; - } - catch (Exception e) - { - Logger.Instance.TrackError(e); - Trace.TraceError(e.ToString()); - return null; - } - } - } -} \ No newline at end of file diff --git a/src/Core/ApiClientCodeGen.Core/NuGet/PackageDependencies.cs b/src/Core/ApiClientCodeGen.Core/NuGet/PackageDependencies.cs index 53d7077fd9..80a9f75013 100644 --- a/src/Core/ApiClientCodeGen.Core/NuGet/PackageDependencies.cs +++ b/src/Core/ApiClientCodeGen.Core/NuGet/PackageDependencies.cs @@ -10,11 +10,6 @@ public static class PackageDependencies "13.0.3", false); - public static readonly PackageDependency MicrosoftRestClientRuntime = - new PackageDependency( - "Microsoft.Rest.ClientRuntime", - "2.3.24"); - public static readonly PackageDependency RestSharp = new PackageDependency( "RestSharp", @@ -58,16 +53,6 @@ public static class PackageDependencies "Polly", "8.6.6"); - public static readonly PackageDependency AutoRestCSharp = - new PackageDependency( - "Microsoft.Azure.AutoRest.CSharp", - "3.0.0-beta.20210218.1"); - - public static readonly PackageDependency AzureCore = - new PackageDependency( - "Azure.Core", - "1.57.0"); - public static readonly PackageDependency AzureIdentity = new PackageDependency( "Azure.Identity", diff --git a/src/Core/ApiClientCodeGen.Core/NuGet/PackageDependencyListProvider.cs b/src/Core/ApiClientCodeGen.Core/NuGet/PackageDependencyListProvider.cs index e13ab1580d..5eda21e947 100644 --- a/src/Core/ApiClientCodeGen.Core/NuGet/PackageDependencyListProvider.cs +++ b/src/Core/ApiClientCodeGen.Core/NuGet/PackageDependencyListProvider.cs @@ -42,26 +42,6 @@ public IEnumerable GetDependencies( }); break; - case SupportedCodeGenerator.AutoRest: - list.AddRange( - new[] - { - PackageDependencies.MicrosoftRestClientRuntime, - PackageDependencies.NewtonsoftJson, - }); - break; - - case SupportedCodeGenerator.AutoRestV3: - list.AddRange( - new[] - { - PackageDependencies.MicrosoftRestClientRuntime, - PackageDependencies.NewtonsoftJson, - PackageDependencies.AutoRestCSharp, - PackageDependencies.AzureCore, - }); - break; - case SupportedCodeGenerator.Swagger: list.AddRange( new[] diff --git a/src/Core/ApiClientCodeGen.Core/Options/AutoRest/DefaultAutoRestOptions.cs b/src/Core/ApiClientCodeGen.Core/Options/AutoRest/DefaultAutoRestOptions.cs deleted file mode 100644 index 67ac2ea4fc..0000000000 --- a/src/Core/ApiClientCodeGen.Core/Options/AutoRest/DefaultAutoRestOptions.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; - -namespace Rapicgen.Core.Options.AutoRest -{ - [Obsolete("AutoRest is deprecated by Microsoft and will be retired on July 1, 2026. AutoRest support will be removed from this tool in a future major version. Use NSwag, Refitter, or Kiota instead.", false)] - public class DefaultAutoRestOptions : IAutoRestOptions - { - public bool AddCredentials { get; } - public bool OverrideClientName { get; } - public bool UseInternalConstructors { get; } - public SyncMethodOptions SyncMethods { get; } - public bool UseDateTimeOffset { get; } - public bool ClientSideValidation { get; } = true; - } -} \ No newline at end of file diff --git a/src/Core/ApiClientCodeGen.Core/Options/AutoRest/IAutoRestOptions.cs b/src/Core/ApiClientCodeGen.Core/Options/AutoRest/IAutoRestOptions.cs deleted file mode 100644 index af4b698aa6..0000000000 --- a/src/Core/ApiClientCodeGen.Core/Options/AutoRest/IAutoRestOptions.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; - -namespace Rapicgen.Core.Options.AutoRest -{ - [Obsolete("AutoRest is deprecated by Microsoft and will be retired on July 1, 2026. AutoRest support will be removed from this tool in a future major version. Use NSwag, Refitter, or Kiota instead.", false)] - public interface IAutoRestOptions - { - bool AddCredentials { get; } - bool OverrideClientName { get; } - bool UseInternalConstructors { get; } - SyncMethodOptions SyncMethods { get; } - bool UseDateTimeOffset { get; } - bool ClientSideValidation { get; } - } -} \ No newline at end of file diff --git a/src/Core/ApiClientCodeGen.Core/Options/AutoRest/SyncMethodOptions.cs b/src/Core/ApiClientCodeGen.Core/Options/AutoRest/SyncMethodOptions.cs deleted file mode 100644 index 5d6ee5261a..0000000000 --- a/src/Core/ApiClientCodeGen.Core/Options/AutoRest/SyncMethodOptions.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -namespace Rapicgen.Core.Options.AutoRest -{ - [Obsolete("AutoRest is deprecated by Microsoft and will be retired on July 1, 2026. AutoRest support will be removed from this tool in a future major version. Use NSwag, Refitter, or Kiota instead.", false)] - public enum SyncMethodOptions - { - Essential, - All, - None - } -} \ No newline at end of file diff --git a/src/Core/ApiClientCodeGen.Core/Options/General/DefaultGeneralOptions.cs b/src/Core/ApiClientCodeGen.Core/Options/General/DefaultGeneralOptions.cs index b6961ff168..1b8e4fc302 100644 --- a/src/Core/ApiClientCodeGen.Core/Options/General/DefaultGeneralOptions.cs +++ b/src/Core/ApiClientCodeGen.Core/Options/General/DefaultGeneralOptions.cs @@ -5,7 +5,6 @@ namespace Rapicgen.Core.Options.General public class DefaultGeneralOptions : IGeneralOptions { public string JavaPath => PathProvider.GetInstalledJavaPath(); - public string NpmPath => PathProvider.GetNpmPath(); public string NSwagPath => PathProvider.GetNSwagPath(); public string SwaggerCodegenPath => PathProvider.GetSwaggerCodegenPath(); public string OpenApiGeneratorPath => PathProvider.GetOpenApiGeneratorPath(); diff --git a/src/Core/ApiClientCodeGen.Core/Options/General/IGeneralOptions.cs b/src/Core/ApiClientCodeGen.Core/Options/General/IGeneralOptions.cs index c7e243fb39..ca12af97ff 100644 --- a/src/Core/ApiClientCodeGen.Core/Options/General/IGeneralOptions.cs +++ b/src/Core/ApiClientCodeGen.Core/Options/General/IGeneralOptions.cs @@ -3,7 +3,6 @@ public interface IGeneralOptions { string JavaPath { get; } - string NpmPath { get; } string NSwagPath { get; } string SwaggerCodegenPath { get; } string OpenApiGeneratorPath { get; } diff --git a/src/Core/ApiClientCodeGen.Core/SupportedCodeGenerator.cs b/src/Core/ApiClientCodeGen.Core/SupportedCodeGenerator.cs index fdd634f9ff..f6b6ea8575 100644 --- a/src/Core/ApiClientCodeGen.Core/SupportedCodeGenerator.cs +++ b/src/Core/ApiClientCodeGen.Core/SupportedCodeGenerator.cs @@ -1,14 +1,8 @@ -using System; - namespace Rapicgen.Core { public enum SupportedCodeGenerator { NSwag = 0, - [Obsolete("AutoRest is deprecated by Microsoft and will be retired on July 1, 2026. AutoRest support will be removed from this tool in a future major version. Use NSwag, Refitter, or Kiota instead.", false)] - AutoRest = 1, - [Obsolete("AutoRest is deprecated by Microsoft and will be retired on July 1, 2026. AutoRest support will be removed from this tool in a future major version. Use NSwag, Refitter, or Kiota instead.", false)] - AutoRestV3 = 2, Swagger = 3, OpenApi = 4, NSwagStudio = 5, diff --git a/src/Core/ApiClientCodeGen.Tests.Common/AutoRestDeprecatedException.cs b/src/Core/ApiClientCodeGen.Tests.Common/AutoRestDeprecatedException.cs deleted file mode 100644 index 2333814350..0000000000 --- a/src/Core/ApiClientCodeGen.Tests.Common/AutoRestDeprecatedException.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; - -namespace ApiClientCodeGen.Tests.Common -{ - public class AutoRestDeprecatedException : Exception - { - public AutoRestDeprecatedException() - : base("AutoRest is deprecated and will be officially retired in July 2026. See: https://github.com/Azure/autorest/blob/main/docs/autorest-deprecated.md") - { - } - - public AutoRestDeprecatedException(string message) - : base(message) - { - } - - public AutoRestDeprecatedException(string message, Exception innerException) - : base(message, innerException) - { - } - } -} diff --git a/src/Core/ApiClientCodeGen.Tests.Common/AutoRestDeprecatedTestClass.cs b/src/Core/ApiClientCodeGen.Tests.Common/AutoRestDeprecatedTestClass.cs deleted file mode 100644 index 428b00fd5c..0000000000 --- a/src/Core/ApiClientCodeGen.Tests.Common/AutoRestDeprecatedTestClass.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using Xunit; - -namespace ApiClientCodeGen.Tests.Common -{ - public abstract class AutoRestDeprecatedTestClass - { - protected AutoRestDeprecatedTestClass() - { - throw new AutoRestDeprecatedException(); - } - } - - [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)] - public class AutoRestDeprecatedFactAttribute : FactAttribute - { - public AutoRestDeprecatedFactAttribute() - { - Skip = "AutoRest is deprecated and will be officially retired in July 2026"; - } - } - - [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] - public class AutoRestDeprecatedTheoryAttribute : TheoryAttribute - { - public AutoRestDeprecatedTheoryAttribute() - { - Skip = "AutoRest is deprecated and will be officially retired in July 2026"; - } - } -} diff --git a/src/Core/ApiClientCodeGen.Tests.Common/Build/BuildHelper.cs b/src/Core/ApiClientCodeGen.Tests.Common/Build/BuildHelper.cs index 7c9357cb35..a5c54a55cf 100644 --- a/src/Core/ApiClientCodeGen.Tests.Common/Build/BuildHelper.cs +++ b/src/Core/ApiClientCodeGen.Tests.Common/Build/BuildHelper.cs @@ -62,19 +62,6 @@ private static string GetProjectContents( throw new ArgumentOutOfRangeException(nameof(projecType), projecType, null); } - case SupportedCodeGenerator.AutoRest: - switch (projecType) - { - case ProjectTypes.DotNetCoreApp: - return AutoRestProjectFileContents.NetCoreApp; - - case ProjectTypes.DotNetStandardLibrary: - return AutoRestProjectFileContents.NetStandardLibrary; - - default: - throw new ArgumentOutOfRangeException(nameof(projecType), projecType, null); - } - case SupportedCodeGenerator.Swagger: switch (projecType) { diff --git a/src/Core/ApiClientCodeGen.Tests.Common/Build/Projects/AutoRestProjectFileContents.cs b/src/Core/ApiClientCodeGen.Tests.Common/Build/Projects/AutoRestProjectFileContents.cs deleted file mode 100644 index d2e0634680..0000000000 --- a/src/Core/ApiClientCodeGen.Tests.Common/Build/Projects/AutoRestProjectFileContents.cs +++ /dev/null @@ -1,43 +0,0 @@ -namespace ApiClientCodeGen.Tests.Common.Build.Projects -{ - public static class AutoRestProjectFileContents - { - public const string NetCoreApp = - @" - - net8.0 - latest - true - https://azuresdkartifacts.blob.core.windows.net/azure-sdk-tools/index.json - NU1605 - - - - - - - - - -"; - - public const string NetStandardLibrary = - @" - - netstandard2.0 - latest - true - https://azuresdkartifacts.blob.core.windows.net/azure-sdk-tools/index.json - NU1605 - - - - - - - - - -"; - } -} \ No newline at end of file diff --git a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/AutoRestCodeGeneratorFixture.cs b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/AutoRestCodeGeneratorFixture.cs deleted file mode 100644 index 1c8c420b89..0000000000 --- a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/AutoRestCodeGeneratorFixture.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System.IO; -using Rapicgen.Core; -using Rapicgen.Core.Generators; -using Rapicgen.Core.Generators.AutoRest; -using Rapicgen.Core.Installer; -using Rapicgen.Core.Options.AutoRest; -using FluentAssertions; -using Moq; - -namespace ApiClientCodeGen.Tests.Common.Fixtures -{ - public class AutoRestCodeGeneratorFixture : TestWithResources - { - public readonly Mock ProgressReporterMock = new Mock(); - public readonly Mock OptionsMock = new Mock(); - public string Code; - - protected override void OnInitialize() - { - OptionsMock.Setup(c => c.AddCredentials).Returns(true); - OptionsMock.Setup(c => c.UseDateTimeOffset).Returns(true); - OptionsMock.Setup(c => c.UseInternalConstructors).Returns(true); - - var codeGenerator = new AutoRestCSharpCodeGenerator( - Path.GetFullPath(SwaggerJsonFilename), - "GeneratedCode", - OptionsMock.Object, - new ProcessLauncher(), - new OpenApiDocumentFactory(), - new DependencyInstaller( - new NpmInstaller(new ProcessLauncher()), - new FileDownloader(new WebDownloader()), - new ProcessLauncher())); - - OptionsMock.Setup(c => c.OverrideClientName).Returns(true); - Code = codeGenerator.GenerateCode(ProgressReporterMock.Object); - Code.Should().NotBeNullOrWhiteSpace(); - } - } -} \ No newline at end of file diff --git a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/KiotaCodeGeneratorFixture.cs b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/KiotaCodeGeneratorFixture.cs index 69bc74c1e3..d47620c6cc 100644 --- a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/KiotaCodeGeneratorFixture.cs +++ b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/KiotaCodeGeneratorFixture.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using System.Threading.Tasks; using Moq; using Rapicgen.Core; @@ -25,7 +25,6 @@ protected override async Task OnInitializeAsync() defaultNamespace, new ProcessLauncher(), new DependencyInstaller( - new NpmInstaller(new ProcessLauncher()), new FileDownloader(new WebDownloader()), new ProcessLauncher()), new DefaultKiotaOptions()); diff --git a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/NSwagCodeGeneratorFixture.cs b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/NSwagCodeGeneratorFixture.cs index bd9d4bc095..0c3a9a1d45 100644 --- a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/NSwagCodeGeneratorFixture.cs +++ b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/NSwagCodeGeneratorFixture.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using Rapicgen.Core; using Rapicgen.Core.Generators; using Rapicgen.Core.Generators.NSwag; @@ -31,7 +31,6 @@ protected override void OnInitialize() defaultNamespace, new ProcessLauncher(), new DependencyInstaller( - new NpmInstaller(new ProcessLauncher()), new FileDownloader(new WebDownloader()), new ProcessLauncher()), OptionsMock.Object); diff --git a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/NSwagStudioCodeGeneratorFixture.cs b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/NSwagStudioCodeGeneratorFixture.cs index d7c1f0b4b1..96fcd754c7 100644 --- a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/NSwagStudioCodeGeneratorFixture.cs +++ b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/NSwagStudioCodeGeneratorFixture.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Threading.Tasks; using Rapicgen.Core; @@ -46,7 +46,6 @@ protected override async Task OnInitializeAsync() generalOptions.Object, new ProcessLauncher(), new DependencyInstaller( - new NpmInstaller(new ProcessLauncher()), new FileDownloader(new WebDownloader()), new ProcessLauncher())) .GenerateCode(new Mock().Object) diff --git a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/AutoRestCodeGeneratorFixture.cs b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/AutoRestCodeGeneratorFixture.cs deleted file mode 100644 index 3376cf3483..0000000000 --- a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/AutoRestCodeGeneratorFixture.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System.IO; -using Rapicgen.Core; -using Rapicgen.Core.Generators; -using Rapicgen.Core.Generators.AutoRest; -using Rapicgen.Core.Installer; -using Rapicgen.Core.Options.AutoRest; -using FluentAssertions; -using Moq; - -namespace ApiClientCodeGen.Tests.Common.Fixtures.OpenApi3 -{ - public class AutoRestCodeGeneratorFixture : TestWithResources - { - public readonly Mock ProgressReporterMock = new Mock(); - public readonly Mock OptionsMock = new Mock(); - public string Code; - - protected override void OnInitialize() - { - OptionsMock.Setup(c => c.AddCredentials).Returns(true); - OptionsMock.Setup(c => c.UseDateTimeOffset).Returns(true); - OptionsMock.Setup(c => c.UseInternalConstructors).Returns(true); - - var codeGenerator = new AutoRestCSharpCodeGenerator( - Path.GetFullPath(SwaggerV3JsonFilename), - "GeneratedCode", - OptionsMock.Object, - new ProcessLauncher(), - new OpenApiDocumentFactory(), - new DependencyInstaller( - new NpmInstaller(new ProcessLauncher()), - new FileDownloader(new WebDownloader()), - new ProcessLauncher())); - - OptionsMock.Setup(c => c.OverrideClientName).Returns(true); - Code = codeGenerator.GenerateCode(ProgressReporterMock.Object); - Code.Should().NotBeNullOrWhiteSpace(); - } - } -} \ No newline at end of file diff --git a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/KiotaCodeGeneratorFixture.cs b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/KiotaCodeGeneratorFixture.cs index 0ab132a9e0..4c013598b0 100644 --- a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/KiotaCodeGeneratorFixture.cs +++ b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/KiotaCodeGeneratorFixture.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using System.Threading.Tasks; using Moq; using Rapicgen.Core; @@ -25,7 +25,6 @@ protected override Task OnInitializeAsync() defaultNamespace, new ProcessLauncher(), new DependencyInstaller( - new NpmInstaller(new ProcessLauncher()), new FileDownloader(new WebDownloader()), new ProcessLauncher()), new DefaultKiotaOptions()); diff --git a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/NSwagCodeGeneratorFixture.cs b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/NSwagCodeGeneratorFixture.cs index ce5b3b8d36..6bc2fadaf6 100644 --- a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/NSwagCodeGeneratorFixture.cs +++ b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/NSwagCodeGeneratorFixture.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using Rapicgen.Core; using Rapicgen.Core.Generators; using Rapicgen.Core.Generators.NSwag; @@ -31,7 +31,6 @@ protected override void OnInitialize() defaultNamespace, new ProcessLauncher(), new DependencyInstaller( - new NpmInstaller(new ProcessLauncher()), new FileDownloader(new WebDownloader()), new ProcessLauncher()), OptionsMock.Object); diff --git a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/NSwagStudioCodeGeneratorFixture.cs b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/NSwagStudioCodeGeneratorFixture.cs index 65d97ceb23..1a62f525dc 100644 --- a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/NSwagStudioCodeGeneratorFixture.cs +++ b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/NSwagStudioCodeGeneratorFixture.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Threading.Tasks; using Rapicgen.Core; @@ -44,7 +44,6 @@ protected override async Task OnInitializeAsync() generalOptions.Object, new ProcessLauncher(), new DependencyInstaller( - new NpmInstaller(new ProcessLauncher()), new FileDownloader(new WebDownloader()), new ProcessLauncher())) .GenerateCode(new Mock().Object) diff --git a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/OpenApiCodeGeneratorFixture.cs b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/OpenApiCodeGeneratorFixture.cs index 72d3f2482b..d2ad076d7b 100644 --- a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/OpenApiCodeGeneratorFixture.cs +++ b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/OpenApiCodeGeneratorFixture.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using Rapicgen.Core; using Rapicgen.Core.Generators; using Rapicgen.Core.Generators.OpenApi; @@ -29,7 +29,6 @@ protected override void OnInitialize() new DefaultOpenApiGeneratorOptions(), new ProcessLauncher(), new DependencyInstaller( - new NpmInstaller(new ProcessLauncher()), new FileDownloader(new WebDownloader()), new ProcessLauncher())); diff --git a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/OpenApiJMeterCodeGeneratorFixture.cs b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/OpenApiJMeterCodeGeneratorFixture.cs index 0390d336fc..5408b7fc3b 100644 --- a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/OpenApiJMeterCodeGeneratorFixture.cs +++ b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/OpenApiJMeterCodeGeneratorFixture.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using Rapicgen.Core; using Rapicgen.Core.Generators; using Rapicgen.Core.Generators.OpenApi; @@ -27,7 +27,6 @@ protected override void OnInitialize() OptionsMock.Object, new ProcessLauncher(), new DependencyInstaller( - new NpmInstaller(new ProcessLauncher()), new FileDownloader(new WebDownloader()), new ProcessLauncher())); diff --git a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/SwaggerCodeGeneratorFixture.cs b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/SwaggerCodeGeneratorFixture.cs index ed8c9ecc49..56ab05c71d 100644 --- a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/SwaggerCodeGeneratorFixture.cs +++ b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/SwaggerCodeGeneratorFixture.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using Rapicgen.Core; using Rapicgen.Core.Generators; using Rapicgen.Core.Generators.Swagger; @@ -27,7 +27,6 @@ protected override void OnInitialize() OptionsMock.Object, new ProcessLauncher(), new DependencyInstaller( - new NpmInstaller(new ProcessLauncher()), new FileDownloader(new WebDownloader()), new ProcessLauncher())); diff --git a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/Yaml/AutoRestCodeGeneratorFixture.cs b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/Yaml/AutoRestCodeGeneratorFixture.cs deleted file mode 100644 index 6bb7087ad7..0000000000 --- a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/Yaml/AutoRestCodeGeneratorFixture.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System.IO; -using Rapicgen.Core; -using Rapicgen.Core.Generators; -using Rapicgen.Core.Generators.AutoRest; -using Rapicgen.Core.Installer; -using Rapicgen.Core.Options.AutoRest; -using FluentAssertions; -using Moq; - -namespace ApiClientCodeGen.Tests.Common.Fixtures.OpenApi3.Yaml -{ - public class AutoRestCodeGeneratorFixture : TestWithResources - { - public readonly Mock ProgressReporterMock = new Mock(); - public readonly Mock OptionsMock = new Mock(); - public string Code; - - public AutoRestCodeGeneratorFixture() - { - OptionsMock.Setup(c => c.AddCredentials).Returns(true); - OptionsMock.Setup(c => c.UseDateTimeOffset).Returns(true); - OptionsMock.Setup(c => c.UseInternalConstructors).Returns(true); - } - - protected override void OnInitialize() - { - var codeGenerator = new AutoRestCSharpCodeGenerator( - Path.GetFullPath(SwaggerV3YamlFilename), - "GeneratedCode", - OptionsMock.Object, - new ProcessLauncher(), - new OpenApiDocumentFactory(), - new DependencyInstaller( - new NpmInstaller(new ProcessLauncher()), - new FileDownloader(new WebDownloader()), - new ProcessLauncher())); - - OptionsMock.Setup(c => c.OverrideClientName).Returns(true); - Code = codeGenerator.GenerateCode(ProgressReporterMock.Object); - Code.Should().NotBeNullOrWhiteSpace(); - } - } -} \ No newline at end of file diff --git a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/Yaml/KiotaCodeGeneratorFixture.cs b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/Yaml/KiotaCodeGeneratorFixture.cs index 4efa89edcd..630801077c 100644 --- a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/Yaml/KiotaCodeGeneratorFixture.cs +++ b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/Yaml/KiotaCodeGeneratorFixture.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using System.Threading.Tasks; using Moq; using Rapicgen.Core; @@ -25,7 +25,6 @@ protected override async Task OnInitializeAsync() defaultNamespace, new ProcessLauncher(), new DependencyInstaller( - new NpmInstaller(new ProcessLauncher()), new FileDownloader(new WebDownloader()), new ProcessLauncher()), new DefaultKiotaOptions()); diff --git a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/Yaml/NSwagCodeGeneratorFixture.cs b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/Yaml/NSwagCodeGeneratorFixture.cs index b7efb0c19a..67afe67f1d 100644 --- a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/Yaml/NSwagCodeGeneratorFixture.cs +++ b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/Yaml/NSwagCodeGeneratorFixture.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using Rapicgen.Core; using Rapicgen.Core.Generators; using Rapicgen.Core.Generators.NSwag; @@ -33,7 +33,6 @@ protected override void OnInitialize() "GeneratedCode", new ProcessLauncher(), new DependencyInstaller( - new NpmInstaller(new ProcessLauncher()), new FileDownloader(new WebDownloader()), new ProcessLauncher()), OptionsMock.Object); diff --git a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/Yaml/NSwagStudioCodeGeneratorFixture.cs b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/Yaml/NSwagStudioCodeGeneratorFixture.cs index 1e6e263b09..aa4da07d89 100644 --- a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/Yaml/NSwagStudioCodeGeneratorFixture.cs +++ b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/Yaml/NSwagStudioCodeGeneratorFixture.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Threading.Tasks; using Rapicgen.Core; @@ -44,7 +44,6 @@ protected override async Task OnInitializeAsync() generalOptions.Object, new ProcessLauncher(), new DependencyInstaller( - new NpmInstaller(new ProcessLauncher()), new FileDownloader(new WebDownloader()), new ProcessLauncher())) .GenerateCode(new Mock().Object) diff --git a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/Yaml/OpenApiCodeGeneratorFixture.cs b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/Yaml/OpenApiCodeGeneratorFixture.cs index 928655de46..ffde56df39 100644 --- a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/Yaml/OpenApiCodeGeneratorFixture.cs +++ b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/Yaml/OpenApiCodeGeneratorFixture.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using Rapicgen.Core; using Rapicgen.Core.Generators; using Rapicgen.Core.Generators.OpenApi; @@ -29,7 +29,6 @@ protected override void OnInitialize() new DefaultOpenApiGeneratorOptions(), new ProcessLauncher(), new DependencyInstaller( - new NpmInstaller(new ProcessLauncher()), new FileDownloader(new WebDownloader()), new ProcessLauncher())); diff --git a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/Yaml/OpenApiJMeterCodeGeneratorFixture.cs b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/Yaml/OpenApiJMeterCodeGeneratorFixture.cs index 713035906c..98e55330cb 100644 --- a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/Yaml/OpenApiJMeterCodeGeneratorFixture.cs +++ b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/Yaml/OpenApiJMeterCodeGeneratorFixture.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using Rapicgen.Core; using Rapicgen.Core.Generators; using Rapicgen.Core.Generators.OpenApi; @@ -27,7 +27,6 @@ protected override void OnInitialize() OptionsMock.Object, new ProcessLauncher(), new DependencyInstaller( - new NpmInstaller(new ProcessLauncher()), new FileDownloader(new WebDownloader()), new ProcessLauncher())); diff --git a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/Yaml/SwaggerCodeGeneratorFixture.cs b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/Yaml/SwaggerCodeGeneratorFixture.cs index d067e1c41f..f99448ed38 100644 --- a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/Yaml/SwaggerCodeGeneratorFixture.cs +++ b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApi3/Yaml/SwaggerCodeGeneratorFixture.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using Rapicgen.Core; using Rapicgen.Core.Generators; using Rapicgen.Core.Generators.Swagger; @@ -27,7 +27,6 @@ protected override void OnInitialize() OptionsMock.Object, new ProcessLauncher(), new DependencyInstaller( - new NpmInstaller(new ProcessLauncher()), new FileDownloader(new WebDownloader()), new ProcessLauncher())); diff --git a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApiCodeGeneratorFixture.cs b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApiCodeGeneratorFixture.cs index 76b600f0f6..1a9718eaff 100644 --- a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApiCodeGeneratorFixture.cs +++ b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApiCodeGeneratorFixture.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using Rapicgen.Core; using Rapicgen.Core.Generators; using Rapicgen.Core.Generators.OpenApi; @@ -29,7 +29,6 @@ protected override void OnInitialize() new DefaultOpenApiGeneratorOptions(), new ProcessLauncher(), new DependencyInstaller( - new NpmInstaller(new ProcessLauncher()), new FileDownloader(new WebDownloader()), new ProcessLauncher())); diff --git a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApiJMeterCodeGeneratorFixture.cs b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApiJMeterCodeGeneratorFixture.cs index e4f31a715d..9c25f2201a 100644 --- a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApiJMeterCodeGeneratorFixture.cs +++ b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/OpenApiJMeterCodeGeneratorFixture.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using Rapicgen.Core; using Rapicgen.Core.Generators; using Rapicgen.Core.Generators.OpenApi; @@ -27,7 +27,6 @@ protected override void OnInitialize() OptionsMock.Object, new ProcessLauncher(), new DependencyInstaller( - new NpmInstaller(new ProcessLauncher()), new FileDownloader(new WebDownloader()), new ProcessLauncher())); diff --git a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/SwaggerCodeGeneratorFixture.cs b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/SwaggerCodeGeneratorFixture.cs index 7efe0e0f6d..1b168b4d09 100644 --- a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/SwaggerCodeGeneratorFixture.cs +++ b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/SwaggerCodeGeneratorFixture.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using Rapicgen.Core; using Rapicgen.Core.Generators; using Rapicgen.Core.Generators.Swagger; @@ -27,7 +27,6 @@ protected override void OnInitialize() OptionsMock.Object, new ProcessLauncher(), new DependencyInstaller( - new NpmInstaller(new ProcessLauncher()), new FileDownloader(new WebDownloader()), new ProcessLauncher())); diff --git a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/Yaml/AutoRestCodeGeneratorFixture.cs b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/Yaml/AutoRestCodeGeneratorFixture.cs deleted file mode 100644 index 5bb15f8d05..0000000000 --- a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/Yaml/AutoRestCodeGeneratorFixture.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System.IO; -using Rapicgen.Core; -using Rapicgen.Core.Generators; -using Rapicgen.Core.Generators.AutoRest; -using Rapicgen.Core.Installer; -using Rapicgen.Core.Options.AutoRest; -using FluentAssertions; -using Moq; - -namespace ApiClientCodeGen.Tests.Common.Fixtures.Yaml -{ - public class AutoRestCodeGeneratorFixture : TestWithResources - { - public readonly Mock ProgressReporterMock = new Mock(); - public readonly Mock OptionsMock = new Mock(); - public string Code; - - public AutoRestCodeGeneratorFixture() - { - OptionsMock.Setup(c => c.AddCredentials).Returns(true); - OptionsMock.Setup(c => c.UseDateTimeOffset).Returns(true); - OptionsMock.Setup(c => c.UseInternalConstructors).Returns(true); - } - - protected override void OnInitialize() - { - var codeGenerator = new AutoRestCSharpCodeGenerator( - Path.GetFullPath(SwaggerYamlFilename), - "GeneratedCode", - OptionsMock.Object, - new ProcessLauncher(), - new OpenApiDocumentFactory(), - new DependencyInstaller( - new NpmInstaller(new ProcessLauncher()), - new FileDownloader(new WebDownloader()), - new ProcessLauncher())); - - OptionsMock.Setup(c => c.OverrideClientName).Returns(true); - Code = codeGenerator.GenerateCode(ProgressReporterMock.Object); - Code.Should().NotBeNullOrWhiteSpace(); - } - } -} \ No newline at end of file diff --git a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/Yaml/KiotaCodeGeneratorFixture.cs b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/Yaml/KiotaCodeGeneratorFixture.cs index e92c8c540e..48e4d605f1 100644 --- a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/Yaml/KiotaCodeGeneratorFixture.cs +++ b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/Yaml/KiotaCodeGeneratorFixture.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using System.Threading.Tasks; using Moq; using Rapicgen.Core; @@ -25,7 +25,6 @@ protected override Task OnInitializeAsync() defaultNamespace, new ProcessLauncher(), new DependencyInstaller( - new NpmInstaller(new ProcessLauncher()), new FileDownloader(new WebDownloader()), new ProcessLauncher()), new DefaultKiotaOptions()); diff --git a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/Yaml/NSwagCodeGeneratorFixture.cs b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/Yaml/NSwagCodeGeneratorFixture.cs index fb08fec137..a4715e030d 100644 --- a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/Yaml/NSwagCodeGeneratorFixture.cs +++ b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/Yaml/NSwagCodeGeneratorFixture.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using Rapicgen.Core; using Rapicgen.Core.Generators; using Rapicgen.Core.Generators.NSwag; @@ -31,7 +31,6 @@ protected override void OnInitialize() defaultNamespace, new ProcessLauncher(), new DependencyInstaller( - new NpmInstaller(new ProcessLauncher()), new FileDownloader(new WebDownloader()), new ProcessLauncher()), OptionsMock.Object); diff --git a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/Yaml/NSwagStudioCodeGeneratorFixture.cs b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/Yaml/NSwagStudioCodeGeneratorFixture.cs index 5113ea96c2..fad7526ec2 100644 --- a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/Yaml/NSwagStudioCodeGeneratorFixture.cs +++ b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/Yaml/NSwagStudioCodeGeneratorFixture.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Threading.Tasks; using Rapicgen.Core; @@ -44,7 +44,6 @@ protected override async Task OnInitializeAsync() generalOptions.Object, new ProcessLauncher(), new DependencyInstaller( - new NpmInstaller(new ProcessLauncher()), new FileDownloader(new WebDownloader()), new ProcessLauncher())) .GenerateCode(new Mock().Object) diff --git a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/Yaml/OpenApiCodeGeneratorFixture.cs b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/Yaml/OpenApiCodeGeneratorFixture.cs index 392a72b683..4b4ca0972a 100644 --- a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/Yaml/OpenApiCodeGeneratorFixture.cs +++ b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/Yaml/OpenApiCodeGeneratorFixture.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using Rapicgen.Core; using Rapicgen.Core.Generators; using Rapicgen.Core.Generators.OpenApi; @@ -29,7 +29,6 @@ protected override void OnInitialize() new DefaultOpenApiGeneratorOptions(), new ProcessLauncher(), new DependencyInstaller( - new NpmInstaller(new ProcessLauncher()), new FileDownloader(new WebDownloader()), new ProcessLauncher())); diff --git a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/Yaml/OpenApiJMeterCodeGeneratorFixture.cs b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/Yaml/OpenApiJMeterCodeGeneratorFixture.cs index 42a475a0de..5b882be07c 100644 --- a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/Yaml/OpenApiJMeterCodeGeneratorFixture.cs +++ b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/Yaml/OpenApiJMeterCodeGeneratorFixture.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using Rapicgen.Core; using Rapicgen.Core.Generators; using Rapicgen.Core.Generators.OpenApi; @@ -27,7 +27,6 @@ protected override void OnInitialize() OptionsMock.Object, new ProcessLauncher(), new DependencyInstaller( - new NpmInstaller(new ProcessLauncher()), new FileDownloader(new WebDownloader()), new ProcessLauncher())); diff --git a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/Yaml/SwaggerCodeGeneratorFixture.cs b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/Yaml/SwaggerCodeGeneratorFixture.cs index 09ac41a4eb..41b89b2421 100644 --- a/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/Yaml/SwaggerCodeGeneratorFixture.cs +++ b/src/Core/ApiClientCodeGen.Tests.Common/Fixtures/Yaml/SwaggerCodeGeneratorFixture.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using Rapicgen.Core; using Rapicgen.Core.Generators; using Rapicgen.Core.Generators.Swagger; @@ -27,7 +27,6 @@ protected override void OnInitialize() OptionsMock.Object, new ProcessLauncher(), new DependencyInstaller( - new NpmInstaller(new ProcessLauncher()), new FileDownloader(new WebDownloader()), new ProcessLauncher())); diff --git a/src/Core/ApiClientCodeGen.Tests.Common/Utility/DependencyUninstaller.cs b/src/Core/ApiClientCodeGen.Tests.Common/Utility/DependencyUninstaller.cs index 709ae3f8ad..badfebd4e2 100644 --- a/src/Core/ApiClientCodeGen.Tests.Common/Utility/DependencyUninstaller.cs +++ b/src/Core/ApiClientCodeGen.Tests.Common/Utility/DependencyUninstaller.cs @@ -10,23 +10,6 @@ namespace ApiClientCodeGen.Tests.Common.Utility [ExcludeFromCodeCoverage] public static class DependencyUninstaller { - public static void UninstallAutoRest() - { - var programFiles = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles); - var programFiles64 = programFiles.Replace(" (x86)", newValue: string.Empty); - - var npmCommand = Path.Combine(programFiles, "nodejs\\npm.cmd"); - if (!File.Exists(npmCommand)) - { - npmCommand = Path.Combine(programFiles64, "nodejs\\npm.cmd"); - if (!File.Exists(npmCommand)) - throw new InvalidOperationException("Unable to find NPM. Please install Node.js"); - } - - new ProcessLauncher().Start(npmCommand, "uninstall -g autorest"); - Logger.Instance.WriteLine("AutoRest uninstalled successfully through NPM"); - } - public static void UninstallOpenApiGenerator() => File.Delete(Path.Combine(Path.GetTempPath(), "openapi-generator-cli.jar")); diff --git a/src/IntelliJ/src/main/kotlin/com/christianhelle/apiclientcodegen/actions/BaseGeneratorActions.kt b/src/IntelliJ/src/main/kotlin/com/christianhelle/apiclientcodegen/actions/BaseGeneratorActions.kt index 0da0f322eb..6736c790c7 100644 --- a/src/IntelliJ/src/main/kotlin/com/christianhelle/apiclientcodegen/actions/BaseGeneratorActions.kt +++ b/src/IntelliJ/src/main/kotlin/com/christianhelle/apiclientcodegen/actions/BaseGeneratorActions.kt @@ -52,7 +52,6 @@ class CSharpGeneratorRefitterAction: CSharpGeneratorAction("refitter") class CSharpGeneratorOpenApiAction: CSharpGeneratorAction("openapi") class CSharpGeneratorKiotaAction: CSharpGeneratorAction("kiota") class CSharpGeneratorSwaggerAction: CSharpGeneratorAction("swagger") -class CSharpGeneratorAutoRestAction: CSharpGeneratorAction("autorest") class TypeScriptGeneratorAngularAction: TypeScriptGeneratorAction("Angular") class TypeScriptGeneratorAureliaAction: TypeScriptGeneratorAction("Aurelia") diff --git a/src/IntelliJ/src/main/resources/META-INF/plugin.xml b/src/IntelliJ/src/main/resources/META-INF/plugin.xml index ae8bc19cb9..9f55d81116 100644 --- a/src/IntelliJ/src/main/resources/META-INF/plugin.xml +++ b/src/IntelliJ/src/main/resources/META-INF/plugin.xml @@ -11,7 +11,7 @@

    ✨ Key Features

    • Multiple Language Support: Generate C# and TypeScript clients with various framework options
    • -
    • Industry-Standard Generators: Choose from NSwag, Refitter, OpenAPI Generator, Microsoft Kiota, Swagger Codegen CLI, and AutoRest (Deprecated)
    • +
    • Industry-Standard Generators: Choose from NSwag, Refitter, OpenAPI Generator, Microsoft Kiota, and Swagger Codegen CLI
    • Seamless Integration: Right-click context menu on OpenAPI files (.json, .yaml, .yml) and Refitter settings files
    • Framework Flexibility: Support for Angular, React (Axios), Node.js, Refit, and more
    • Configuration Files: Generate from .refitter settings for advanced customization
    • @@ -25,7 +25,6 @@
    • OpenAPI Generator - Industry-standard with broad language support
    • Microsoft Kiota - Microsoft's modern API client generator
    • Swagger Codegen CLI - Traditional and reliable option
    • -
    • AutoRest (Deprecated) - Will be retired by Microsoft on July 1, 2026

    TypeScript Clients:

    @@ -67,7 +66,6 @@ - diff --git a/src/VSCode/CHANGELOG.md b/src/VSCode/CHANGELOG.md index 009f885a44..169bfff771 100644 --- a/src/VSCode/CHANGELOG.md +++ b/src/VSCode/CHANGELOG.md @@ -6,7 +6,7 @@ All notable changes to the "REST API Client Code Generator" extension will be do ### Added - Initial release -- Support for generating API clients using NSwag, Refitter, OpenAPI Generator, Microsoft Kiota, Swagger Codegen CLI, and AutoRest +- Support for generating API clients using NSwag, Refitter, OpenAPI Generator, Microsoft Kiota, and Swagger Codegen CLI - Context menu integration for JSON and YAML files - Automatic installation of rapicgen .NET tool if not already installed - Configuration options for default namespace and output directory diff --git a/src/VSCode/README.md b/src/VSCode/README.md index d64e02ad19..921e67e629 100644 --- a/src/VSCode/README.md +++ b/src/VSCode/README.md @@ -30,9 +30,6 @@ This extension adds a context menu item **REST API Client Code Generator** when - **OpenAPI Generator**: Generates a C# REST API Client using OpenAPI Generator - **Microsoft Kiota**: Generates a C# REST API Client using Microsoft Kiota - **Swagger Codegen CLI**: Generates a C# REST API Client using Swagger Codegen CLI -- **AutoREST**: Generates a C# REST API Client using AutoREST - -**⚠️ Note:** AutoRest is deprecated by Microsoft and will be retired on July 1, 2026. AutoRest support will be removed from this tool in a future major version. For migration guidance, see [AutoRest Migration Guide](https://github.com/christianhelle/apiclientcodegen/blob/master/docs/AutoRestMigration.md). Use NSwag, Refitter, or Kiota instead. ### TypeScript Generators @@ -65,7 +62,6 @@ This extension adds a context menu item **REST API Client Code Generator** when - .NET SDK 6.0 or higher - Java Runtime Environment (for OpenAPI Generator and Swagger Codegen CLI) -- NPM (for AutoREST and NSwag) ### For TypeScript code generation @@ -137,7 +133,6 @@ The C# code generated by each generator depends on different NuGet packages: - **OpenAPI Generator**: Depends on RestSharp, JsonSubTypes, Polly, Newtonsoft.Json - **Microsoft Kiota**: Depends on Microsoft.Kiota.* packages and Azure.Identity - **Swagger Codegen CLI**: Depends on RestSharp and JsonSubTypes -- **AutoREST**: Depends on Microsoft.Rest.ClientRuntime and Newtonsoft.Json ### TypeScript Dependencies diff --git a/src/VSCode/package.json b/src/VSCode/package.json index 8e0442426b..cbb4532559 100644 --- a/src/VSCode/package.json +++ b/src/VSCode/package.json @@ -46,10 +46,6 @@ "command": "restApiClientCodeGenerator.swagger", "title": "Generate C# Client with Swagger (v3.0.34 - Outdated)" }, - { - "command": "restApiClientCodeGenerator.autorest", - "title": "Generate C# Client with AutoRest (Deprecated)" - }, { "command": "restApiClientCodeGenerator.typescript.angular", "title": "Generate TypeScript Client for Angular" @@ -138,10 +134,6 @@ { "command": "restApiClientCodeGenerator.swagger", "group": "1_generators@5" - }, - { - "command": "restApiClientCodeGenerator.autorest", - "group": "1_generators@6" } ], "restApiClientCodeGenerator.typescriptSubmenu": [ diff --git a/src/VSCode/src/services/generators.ts b/src/VSCode/src/services/generators.ts index f0e013467e..6a04624843 100644 --- a/src/VSCode/src/services/generators.ts +++ b/src/VSCode/src/services/generators.ts @@ -14,8 +14,7 @@ export const generators: IGenerator[] = [ { command: 'refitter', displayName: 'Refitter', requiresJava: false }, { command: 'openapi', displayName: 'OpenAPI Generator', requiresJava: true }, { command: 'kiota', displayName: 'Microsoft Kiota', requiresJava: false }, - { command: 'swagger', displayName: 'Swagger Codegen CLI', requiresJava: true }, - { command: 'autorest', displayName: 'AutoRest (Deprecated)', requiresJava: false } + { command: 'swagger', displayName: 'Swagger Codegen CLI', requiresJava: true } ]; /** @@ -61,14 +60,7 @@ export async function executeRapicgen(generator: string, specificationFilePath: if (!validateSpecificationFile(specificationFilePath)) { return; } - - // Show non-blocking deprecation warning for AutoRest - if (generator === 'autorest') { - vscode.window.showWarningMessage( - 'AutoRest is deprecated by Microsoft and will be retired on July 1, 2026. AutoRest support will be removed from this tool in a future major version. Use NSwag, Refitter, or Kiota instead.' - ); - } - + // Validate dependencies if (!validateDependencies(generator, generatorRequiresJava)) { return; diff --git a/src/VSCode/src/test/suite/extension.test.ts b/src/VSCode/src/test/suite/extension.test.ts index 9012751cbe..c1ba20dbce 100644 --- a/src/VSCode/src/test/suite/extension.test.ts +++ b/src/VSCode/src/test/suite/extension.test.ts @@ -20,18 +20,5 @@ suite('Extension Test Suite', () => { assert.strictEqual(commands.includes('restApiClientCodeGenerator.openapi'), true); assert.strictEqual(commands.includes('restApiClientCodeGenerator.kiota'), true); assert.strictEqual(commands.includes('restApiClientCodeGenerator.swagger'), true); - assert.strictEqual(commands.includes('restApiClientCodeGenerator.autoRest'), true); - }); - - test('AutoRest command must remain registered during deprecation', async () => { - // CRITICAL: Prevents accidental removal during Phase 1-2 deprecation period - // AutoRest command must remain accessible until Phase 3 (~Jan 2027) - const commands = await vscode.commands.getCommands(true); - - assert.strictEqual( - commands.includes('restApiClientCodeGenerator.autorest'), - true, - 'AutoRest command must remain registered during deprecation period' - ); }); }); diff --git a/src/VSCode/src/test/suite/generators.test.ts b/src/VSCode/src/test/suite/generators.test.ts index 9e37c800ba..6bb6b642ef 100644 --- a/src/VSCode/src/test/suite/generators.test.ts +++ b/src/VSCode/src/test/suite/generators.test.ts @@ -1,62 +1,7 @@ import * as assert from 'assert'; -import { generators, generatorRequiresJava } from '../../services/generators'; +import { generators } from '../../services/generators'; suite('Generators Configuration Test Suite', () => { - test('AutoRest generator is present in generators list', () => { - // CRITICAL: Prevents accidental removal during deprecation period - // AutoRest must remain in the list until Phase 3 (~Jan 2027) - const autorestGenerator = generators.find(g => g.command === 'autorest'); - - assert.notStrictEqual( - autorestGenerator, - undefined, - 'AutoRest must be present in generators list during deprecation period' - ); - }); - - test('AutoRest displayName contains Deprecated label', () => { - // Validates the canonical "AutoRest (Deprecated)" label format - const autorestGenerator = generators.find(g => g.command === 'autorest'); - - assert.strictEqual( - autorestGenerator?.displayName, - 'AutoRest (Deprecated)', - 'AutoRest displayName must use canonical "AutoRest (Deprecated)" format' - ); - }); - - test('AutoRest command is lowercase', () => { - const autorestGenerator = generators.find(g => g.command === 'autorest'); - - assert.strictEqual( - autorestGenerator?.command, - 'autorest', - 'AutoRest command must be lowercase' - ); - }); - - test('AutoRest does not require Java', () => { - // AutoRest is an NPM-based tool and does not require Java runtime - const autorestGenerator = generators.find(g => g.command === 'autorest'); - - assert.strictEqual( - autorestGenerator?.requiresJava, - false, - 'AutoRest should not require Java runtime' - ); - }); - - test('generatorRequiresJava returns false for AutoRest', () => { - // Validates the helper function correctly identifies AutoRest as non-Java - const requiresJava = generatorRequiresJava('autorest', false); - - assert.strictEqual( - requiresJava, - false, - 'generatorRequiresJava should return false for AutoRest' - ); - }); - test('All generators have required fields', () => { // Validates generator structure integrity generators.forEach(generator => { @@ -81,15 +26,4 @@ suite('Generators Configuration Test Suite', () => { 'All generator commands must be unique' ); }); - - test('AutoRest is positioned last in generators array', () => { - // Per UX convention, deprecated items should appear last - const lastGenerator = generators[generators.length - 1]; - - assert.strictEqual( - lastGenerator.command, - 'autorest', - 'AutoRest should be positioned last in generators array (deprecated items go last)' - ); - }); }); diff --git a/src/VSIX/ApiClientCodeGen.Tests/ApiClientCodeGen.Tests.csproj b/src/VSIX/ApiClientCodeGen.Tests/ApiClientCodeGen.Tests.csproj index 2ef07e3bea..0cf35aa3cf 100644 --- a/src/VSIX/ApiClientCodeGen.Tests/ApiClientCodeGen.Tests.csproj +++ b/src/VSIX/ApiClientCodeGen.Tests/ApiClientCodeGen.Tests.csproj @@ -77,10 +77,8 @@ - - @@ -97,12 +95,10 @@ - - diff --git a/src/VSIX/ApiClientCodeGen.Tests/CustomTool/SingleFileCodeGeneratorTests.cs b/src/VSIX/ApiClientCodeGen.Tests/CustomTool/SingleFileCodeGeneratorTests.cs index df144f34fd..569f3363b1 100644 --- a/src/VSIX/ApiClientCodeGen.Tests/CustomTool/SingleFileCodeGeneratorTests.cs +++ b/src/VSIX/ApiClientCodeGen.Tests/CustomTool/SingleFileCodeGeneratorTests.cs @@ -14,7 +14,6 @@ public class SingleFileCodeGeneratorTests : TestWithResources private const SupportedLanguage lang = SupportedLanguage.CSharp; [Theory] - [InlineData(SupportedCodeGenerator.AutoRest)] [InlineData(SupportedCodeGenerator.NSwag)] [InlineData(SupportedCodeGenerator.Swagger)] [InlineData(SupportedCodeGenerator.OpenApi)] diff --git a/src/VSIX/ApiClientCodeGen.Tests/Extensions/GetCustomToolNameTests.cs b/src/VSIX/ApiClientCodeGen.Tests/Extensions/GetCustomToolNameTests.cs index 32cc489027..97b8ad71e3 100644 --- a/src/VSIX/ApiClientCodeGen.Tests/Extensions/GetCustomToolNameTests.cs +++ b/src/VSIX/ApiClientCodeGen.Tests/Extensions/GetCustomToolNameTests.cs @@ -7,13 +7,6 @@ namespace Rapicgen.Tests.Extensions public class GetCustomToolNameTests { - [Xunit.Fact] - public void GetCustomToolName_AutoRest() - => SupportedCodeGenerator.AutoRest - .GetCustomToolName() - .Should() - .Contain("AutoRest"); - [Xunit.Fact] public void GetCustomToolName_NSwag() => SupportedCodeGenerator.NSwag diff --git a/src/VSIX/ApiClientCodeGen.Tests/Extensions/GetDependenciesTests.cs b/src/VSIX/ApiClientCodeGen.Tests/Extensions/GetDependenciesTests.cs index 8f39e3c2ff..da906b0b9a 100644 --- a/src/VSIX/ApiClientCodeGen.Tests/Extensions/GetDependenciesTests.cs +++ b/src/VSIX/ApiClientCodeGen.Tests/Extensions/GetDependenciesTests.cs @@ -7,14 +7,6 @@ namespace Rapicgen.Tests.Extensions { public class GetDependenciesTests { - [Xunit.Fact] - public void GetDependencies_AutoRest() - => SupportedCodeGenerator.AutoRest - .GetDependencies() - .Any(c => c.Name == "Microsoft.Rest.ClientRuntime") - .Should() - .BeTrue(); - [Xunit.Fact] public void GetDependencies_NSwag() => SupportedCodeGenerator.NSwag diff --git a/src/VSIX/ApiClientCodeGen.Tests/Extensions/GetSupportedCodeGeneratorTests.cs b/src/VSIX/ApiClientCodeGen.Tests/Extensions/GetSupportedCodeGeneratorTests.cs index 059dd48592..947b6935a7 100644 --- a/src/VSIX/ApiClientCodeGen.Tests/Extensions/GetSupportedCodeGeneratorTests.cs +++ b/src/VSIX/ApiClientCodeGen.Tests/Extensions/GetSupportedCodeGeneratorTests.cs @@ -1,6 +1,5 @@ -using System; +using System; using Rapicgen.Core; -using Rapicgen.CustomTool.AutoRest; using Rapicgen.CustomTool.NSwag; using Rapicgen.CustomTool.OpenApi; using Rapicgen.CustomTool.Swagger; @@ -12,13 +11,6 @@ namespace Rapicgen.Tests.Extensions public class GetSupportedCodeGeneratorTests { - [Xunit.Fact] - public void GetSupportedCodeGenerator_AutoRest() - => typeof(AutoRestCodeGenerator) - .GetSupportedCodeGenerator() - .Should() - .Be(SupportedCodeGenerator.AutoRest); - [Xunit.Fact] public void GetSupportedCodeGenerator_NSwag() => typeof(NSwagCodeGenerator) diff --git a/src/VSIX/ApiClientCodeGen.Tests/Generators/CodeGeneratorFactoryTests.cs b/src/VSIX/ApiClientCodeGen.Tests/Generators/CodeGeneratorFactoryTests.cs deleted file mode 100644 index 0209843ac6..0000000000 --- a/src/VSIX/ApiClientCodeGen.Tests/Generators/CodeGeneratorFactoryTests.cs +++ /dev/null @@ -1,118 +0,0 @@ -using System; -using ApiClientCodeGen.Tests.Common; -using Rapicgen.Core; -using Rapicgen.Core.Generators.AutoRest; -using Rapicgen.Core.Generators.NSwag; -using Rapicgen.Core.Generators.OpenApi; -using Rapicgen.Core.Generators.Swagger; -using Rapicgen.Core.Options; -using Rapicgen.Core.Options.AutoRest; -using Rapicgen.Core.Options.General; -using Rapicgen.Core.Options.NSwag; -using Rapicgen.Core.Options.OpenApiGenerator; -using Rapicgen.Generators; -using Rapicgen.Options.AutoRest; -using Rapicgen.Options.General; -using Rapicgen.Options.NSwag; -using Rapicgen.Options.OpenApiGenerator; -using FluentAssertions; -using Moq; -using Rapicgen.Core.Generators.Refitter; - -namespace Rapicgen.Tests.Generators -{ - - public class CodeGeneratorFactoryTests - { - private readonly CodeGeneratorFactory sut; - - public CodeGeneratorFactoryTests() - { - var mockFactory = new Mock(); - mockFactory - .Setup(c => c.Create()) - .Returns(Test.CreateDummy()); - mockFactory - .Setup(c => c.Create()) - .Returns(Test.CreateDummy()); - mockFactory - .Setup(c => c.Create()) - .Returns(Test.CreateDummy()); - mockFactory - .Setup(c => c.Create()) - .Returns(Test.CreateDummy()); - mockFactory - .Setup(c => c.Create()) - .Returns(Test.CreateDummy()); - - sut = new CodeGeneratorFactory(mockFactory.Object, null); - } - - [Xunit.Fact] - public void Can_Create_NSwagCodeGenerator() - => sut.Create( - string.Empty, - string.Empty, - string.Empty, - SupportedLanguage.CSharp, - SupportedCodeGenerator.NSwag) - .Should() - .BeOfType(); - - [Xunit.Fact] - public void Can_Create_AutoRestCodeGenerator() - => sut.Create( - string.Empty, - string.Empty, - string.Empty, - SupportedLanguage.CSharp, - SupportedCodeGenerator.AutoRest) - .Should() - .BeOfType(); - - [Xunit.Fact] - public void Can_Create_SwaggerCodeGenerator() - => sut.Create( - string.Empty, - string.Empty, - string.Empty, - SupportedLanguage.CSharp, - SupportedCodeGenerator.Swagger) - .Should() - .BeOfType(); - - [Xunit.Fact] - public void Can_Create_OpenApiCodeGenerator() - => sut.Create( - string.Empty, - string.Empty, - string.Empty, - SupportedLanguage.CSharp, - SupportedCodeGenerator.OpenApi) - .Should() - .BeOfType(); - - [Xunit.Fact] - public void Can_Create_RefitterCodeGenerator() - => sut.Create( - string.Empty, - string.Empty, - string.Empty, - SupportedLanguage.CSharp, - SupportedCodeGenerator.Refitter) - .Should() - .BeOfType(); - - [Xunit.Fact] - public void Create_NSwagStudio_Throws_NotSupported() - => new Action( - () => sut.Create( - string.Empty, - string.Empty, - string.Empty, - SupportedLanguage.CSharp, - SupportedCodeGenerator.NSwagStudio)) - .Should() - .ThrowExactly(); - } -} \ No newline at end of file diff --git a/src/VSIX/ApiClientCodeGen.Tests/NpmHelperTests.cs b/src/VSIX/ApiClientCodeGen.Tests/NpmHelperTests.cs deleted file mode 100644 index 26c38d2712..0000000000 --- a/src/VSIX/ApiClientCodeGen.Tests/NpmHelperTests.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System; -using System.IO; -using Rapicgen.Core; -using Rapicgen.Core.Generators; -using FluentAssertions; -using Moq; - -namespace Rapicgen.Tests -{ - - public class NpmHelperTests - { - [Xunit.Fact] - public void Can_GetNpmPath() - => NpmHelper.GetNpmPath() - .Should() - .NotBeNullOrWhiteSpace(); - - [Xunit.Fact] - public void GetNpmPath_IgnorePath_Returns_Npm() - => NpmHelper.GetNpmPath(true) - .Should() - .Be("npm"); - - [Xunit.Fact] - public void FileExists_GetNpmPath() - => File.Exists(NpmHelper.GetNpmPath()) - .Should() - .BeTrue(); - - [Xunit.Fact] - public void Can_GetNpmPrefixPath() - => NpmHelper.GetPrefixPath() - .Should() - .NotBeNullOrWhiteSpace(); - - [Xunit.Fact] - public void DirectoryExists_GetNpmPrefixPath() - => Directory.Exists(NpmHelper.GetPrefixPath()) - .Should() - .BeTrue(); - - [Xunit.Fact] - public void TryGetNpmPrefixPathFromNpmConfig() - { - var mock = new Mock(); - mock.Setup( - c => c.Start( - It.IsAny(), - It.IsAny(), - It.IsAny>(), - It.IsAny>(), - It.IsAny())) - .Throws(new Exception()); - NpmHelper.TryGetNpmPrefixPathFromNpmConfig(mock.Object) - .Should() - .BeNullOrEmpty(); - } - } -} \ No newline at end of file diff --git a/src/VSIX/ApiClientCodeGen.Tests/NuGet/PackageDependencyListProviderTests.cs b/src/VSIX/ApiClientCodeGen.Tests/NuGet/PackageDependencyListProviderTests.cs index 95c4654a92..aa1947635a 100644 --- a/src/VSIX/ApiClientCodeGen.Tests/NuGet/PackageDependencyListProviderTests.cs +++ b/src/VSIX/ApiClientCodeGen.Tests/NuGet/PackageDependencyListProviderTests.cs @@ -24,13 +24,7 @@ public void GetDependencies_NSwagStudio_Returns_NotEmpty() .NotBeNullOrEmpty(); [Xunit.Fact] - public void GetDependencies_AutoRest_Returns_NotEmpty() - => sut.GetDependencies(SupportedCodeGenerator.AutoRest) - .Should() - .NotBeNullOrEmpty(); - - [Xunit.Fact] - public void GetDependencies_Swagger_Returns_NotEmpty() + public void GetDependencies_Swagger_Returns_NotEmpty() => sut.GetDependencies(SupportedCodeGenerator.Swagger) .Should() .NotBeNullOrEmpty(); @@ -77,18 +71,6 @@ public void GetDependencies_NSwagStudio_Contains_SystemComponentModelAnnotations .Should() .Contain(PackageDependencies.SystemComponentModelAnnotations); - [Xunit.Fact] - public void GetDependencies_AutoRest_Contains_RestClientRuntime() - => sut.GetDependencies(SupportedCodeGenerator.AutoRest) - .Should() - .Contain(PackageDependencies.MicrosoftRestClientRuntime); - - [Xunit.Fact] - public void GetDependencies_AutoRest_Contains_NewtonsoftJson() - => sut.GetDependencies(SupportedCodeGenerator.AutoRest) - .Should() - .Contain(PackageDependencies.NewtonsoftJson); - [Xunit.Fact] public void GetDependencies_Swagger_Contains_RestSharp() => sut.GetDependencies(SupportedCodeGenerator.Swagger) diff --git a/src/VSIX/ApiClientCodeGen.Tests/NuGet/SupportedCodeGeneratorExtensionsTests.cs b/src/VSIX/ApiClientCodeGen.Tests/NuGet/SupportedCodeGeneratorExtensionsTests.cs index b690e781fa..ae826ffc35 100644 --- a/src/VSIX/ApiClientCodeGen.Tests/NuGet/SupportedCodeGeneratorExtensionsTests.cs +++ b/src/VSIX/ApiClientCodeGen.Tests/NuGet/SupportedCodeGeneratorExtensionsTests.cs @@ -21,13 +21,6 @@ public void GetDependencies_NSwagStudio_Returns_NotEmpty() .Should() .NotBeNullOrEmpty(); - [Xunit.Fact] - public void GetDependencies_AutoRest_Returns_NotEmpty() - => SupportedCodeGenerator.AutoRest - .GetDependencies() - .Should() - .NotBeNullOrEmpty(); - [Xunit.Fact] public void GetDependencies_Swagger_Returns_NotEmpty() => SupportedCodeGenerator.Swagger @@ -56,13 +49,6 @@ public void GetDependencies_NSwagStudio_Contains_NewtonsoftJson() .Should() .Contain(c => c.Name == "Newtonsoft.Json"); - [Xunit.Fact] - public void GetDependencies_AutoRest_Contains_RestClientRuntime() - => SupportedCodeGenerator.AutoRest - .GetDependencies() - .Should() - .Contain(c => c.Name == "Microsoft.Rest.ClientRuntime"); - [Xunit.Fact] public void GetDependencies_Swagger_Contains_RestSharp() => SupportedCodeGenerator.Swagger diff --git a/src/VSIX/ApiClientCodeGen.Tests/Options/AutoRestOptionsTests.cs b/src/VSIX/ApiClientCodeGen.Tests/Options/AutoRestOptionsTests.cs deleted file mode 100644 index ca4b033d10..0000000000 --- a/src/VSIX/ApiClientCodeGen.Tests/Options/AutoRestOptionsTests.cs +++ /dev/null @@ -1,8 +0,0 @@ -using ApiClientCodeGen.Tests.Common; - -namespace Rapicgen.Tests.Options -{ - public class AutoRestOptionsTests : AutoRestDeprecatedTestClass - { - } -} \ No newline at end of file diff --git a/src/VSIX/ApiClientCodeGen.Tests/Options/CustomPathOptionsNullOptionsTests.cs b/src/VSIX/ApiClientCodeGen.Tests/Options/CustomPathOptionsNullOptionsTests.cs index 01af39c49f..0107308e6f 100644 --- a/src/VSIX/ApiClientCodeGen.Tests/Options/CustomPathOptionsNullOptionsTests.cs +++ b/src/VSIX/ApiClientCodeGen.Tests/Options/CustomPathOptionsNullOptionsTests.cs @@ -18,14 +18,6 @@ public void JavaPath_NotNullOrWhiteSpace() public void JavaPath_Reads_From_Options() => sut.JavaPath.Should().Be(PathProvider.GetInstalledJavaPath()); - [Xunit.Fact] - public void NpmPath_NotNullOrWhiteSpace() - => sut.NpmPath.Should().NotBeNullOrWhiteSpace(); - - [Xunit.Fact] - public void NpmPath_Reads_From_Options() - => sut.NpmPath.Should().Be(PathProvider.GetNpmPath()); - [Xunit.Fact] public void NSwagPath_NotNullOrWhiteSpace() => sut.NSwagPath.Should().NotBeNullOrWhiteSpace(); diff --git a/src/VSIX/ApiClientCodeGen.Tests/Options/CustomPathOptionsTests.cs b/src/VSIX/ApiClientCodeGen.Tests/Options/CustomPathOptionsTests.cs index 1360ca19e7..7c10f919b1 100644 --- a/src/VSIX/ApiClientCodeGen.Tests/Options/CustomPathOptionsTests.cs +++ b/src/VSIX/ApiClientCodeGen.Tests/Options/CustomPathOptionsTests.cs @@ -17,7 +17,6 @@ public CustomPathOptionsTests() var fixture = new Fixture(); mock = new Mock(); mock.Setup(c => c.JavaPath).Returns(fixture.Create()); - mock.Setup(c => c.NpmPath).Returns(fixture.Create()); mock.Setup(c => c.NSwagPath).Returns(fixture.Create()); mock.Setup(c => c.SwaggerCodegenPath).Returns(fixture.Create()); mock.Setup(c => c.OpenApiGeneratorPath).Returns(fixture.Create()); @@ -33,14 +32,6 @@ public void JavaPath_NotNullOrWhiteSpace() public void JavaPath_Reads_From_Options() => sut.JavaPath.Should().Be(mock.Object.JavaPath); - [Xunit.Fact] - public void NpmPath_NotNullOrWhiteSpace() - => sut.NpmPath.Should().NotBeNullOrWhiteSpace(); - - [Xunit.Fact] - public void NpmPath_Reads_From_Options() - => sut.NpmPath.Should().Be(mock.Object.NpmPath); - [Xunit.Fact] public void NSwagPath_NotNullOrWhiteSpace() => sut.NSwagPath.Should().NotBeNullOrWhiteSpace(); diff --git a/src/VSIX/ApiClientCodeGen.Tests/Options/DefaultAutoRestOptionsTests.cs b/src/VSIX/ApiClientCodeGen.Tests/Options/DefaultAutoRestOptionsTests.cs deleted file mode 100644 index cbc26ae4bb..0000000000 --- a/src/VSIX/ApiClientCodeGen.Tests/Options/DefaultAutoRestOptionsTests.cs +++ /dev/null @@ -1,8 +0,0 @@ -using ApiClientCodeGen.Tests.Common; - -namespace Rapicgen.Tests.Options -{ - public class DefaultAutoRestOptionsTests : AutoRestDeprecatedTestClass - { - } -} \ No newline at end of file diff --git a/src/VSIX/ApiClientCodeGen.Tests/Options/DefaultGeneralOptionsTests.cs b/src/VSIX/ApiClientCodeGen.Tests/Options/DefaultGeneralOptionsTests.cs index ee0b89762d..99f31d7b8b 100644 --- a/src/VSIX/ApiClientCodeGen.Tests/Options/DefaultGeneralOptionsTests.cs +++ b/src/VSIX/ApiClientCodeGen.Tests/Options/DefaultGeneralOptionsTests.cs @@ -12,10 +12,6 @@ public class DefaultGeneralOptionsTests public void JavaPath_NotNull() => sut.JavaPath.Should().NotBeNullOrWhiteSpace(); - [Xunit.Fact] - public void NpmPath_NotNull() - => sut.NpmPath.Should().NotBeNullOrWhiteSpace(); - [Xunit.Fact] public void NSwagPath_NotNull() => sut.NSwagPath.Should().NotBeNullOrWhiteSpace(); diff --git a/src/VSIX/ApiClientCodeGen.Tests/Options/PathProviderTests.cs b/src/VSIX/ApiClientCodeGen.Tests/Options/PathProviderTests.cs index cb11379377..595a448dc9 100644 --- a/src/VSIX/ApiClientCodeGen.Tests/Options/PathProviderTests.cs +++ b/src/VSIX/ApiClientCodeGen.Tests/Options/PathProviderTests.cs @@ -23,27 +23,6 @@ public void GetJavaPath_Returns_No_Path_For_Bad_EnvironmentVariableName() path.Should().Be("java"); } - [Xunit.Fact] - public void GetNpmPath_Exists() - { - var path = PathProvider.GetNpmPath(); - path.Should().NotBeNullOrWhiteSpace(); - } - - [Xunit.Fact] - public void GetNpmPath_Exists_For_Specified_Paths() - { - var path = PathProvider.GetNpmPath( - Test.CreateAnnonymous(), - Test.CreateAnnonymous()); - - path.Should() - .Be( - Environment.OSVersion.Platform is PlatformID.MacOSX or PlatformID.Unix - ? "npm" - : string.Empty); - } - [Xunit.Fact] public void GetNSwagPath_Exists() { @@ -51,20 +30,6 @@ public void GetNSwagPath_Exists() path.Should().NotBeNullOrWhiteSpace(); } - [Xunit.Fact] - public void GetAutoRestPath_Returns_NpmPrefix_AutoRestCmd() - { - var path = PathProvider.GetAutoRestPath(); - path.Should().ContainAny("autorest"); - } - - [Xunit.Fact] - public void GetAutoRestPath_Without_Path_Returns_autorest() - { - var path = PathProvider.GetAutoRestPath(true); - path.Should().Be("autorest"); - } - [Xunit.Fact] public void GetNSwagPath_Without_Path_Returns_nswag() { diff --git a/src/VSIX/ApiClientCodeGen.VSIX.Dev17/VSCommandTable.vsct b/src/VSIX/ApiClientCodeGen.VSIX.Dev17/VSCommandTable.vsct index fd9acc95c2..b8b731cf3f 100644 --- a/src/VSIX/ApiClientCodeGen.VSIX.Dev17/VSCommandTable.vsct +++ b/src/VSIX/ApiClientCodeGen.VSIX.Dev17/VSCommandTable.vsct @@ -52,12 +52,7 @@ Generate with Swagger (v3.0.34 - Outdated) - - - - - - - -