MagnusOpera.OpenApiGen.linux-arm64 0.38.0

Prefix Reserved
The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package MagnusOpera.OpenApiGen.linux-arm64 --version 0.38.0
                    
NuGet\Install-Package MagnusOpera.OpenApiGen.linux-arm64 -Version 0.38.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MagnusOpera.OpenApiGen.linux-arm64" Version="0.38.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MagnusOpera.OpenApiGen.linux-arm64" Version="0.38.0" />
                    
Directory.Packages.props
<PackageReference Include="MagnusOpera.OpenApiGen.linux-arm64" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MagnusOpera.OpenApiGen.linux-arm64 --version 0.38.0
                    
#r "nuget: MagnusOpera.OpenApiGen.linux-arm64, 0.38.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MagnusOpera.OpenApiGen.linux-arm64@0.38.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MagnusOpera.OpenApiGen.linux-arm64&version=0.38.0
                    
Install as a Cake Addin
#tool nuget:?package=MagnusOpera.OpenApiGen.linux-arm64&version=0.38.0
                    
Install as a Cake Tool

OpenApiGen

OpenApiGen is a .NET tool that generates simple, type-safe TypeScript clients from OpenAPI definitions. The generated clients are designed for easy integration with Axios and React Query.

Usage

Run the tool with:

openapigen <configuration-file> <openapi-file> <output-dir>
  • <configuration-file>: Path to the configuration JSON file
  • <openapi-file>: Path to the OpenAPI definition JSON file
  • <output-dir>: Output directory for the generated TypeScript client (will be purged)

For help:

openapigen --help

Note on Any Types

This tool implements a workaround for a bug in Microsoft.Extensions.ApiDescription.Server 9.0.8, where nullable types are incorrectly emitted as type "any" in the OpenAPI definition. The generator heuristically locates an equivalent non-nullable schema and applies the intended nullability. This assumes the base, non-nullable schema is emitted correctly.

Example Output

Sample TypeScript code generated for a PATCH operation on /User/{id}:

// === patch /User/{id} ===
export type UserIdPatchRequest = {
    firstName: null | string
    lastName: null | string
}
export type UserIdPatch200Response = {
    firstName: string
    lastName: string
}
export type UserIdPatch400Response = ProblemDetails
export type UserIdPatch404Response = ProblemDetails
export async function patchUserIdAsync(axios: AxiosInstance, bearer: string, id: string, request: UserIdPatchRequest): Promise<[200, UserIdPatch200Response] | [400, UserIdPatch400Response] | [404, UserIdPatch404Response]> {
    const resp = await axios.patch(`/User/${id}`, request, { validateStatus: () => true, headers: { Authorization: `Bearer ${bearer}` } })
    switch (resp.status) {
        case 200: return [200, resp.data as UserIdPatch200Response]
        case 400: return [400, resp.data as UserIdPatch400Response]
        case 404: return [404, resp.data as UserIdPatch404Response]
        default: throw `Unexpected status ${resp.status}`
    }
}

Features

  • Generates TypeScript clients from OpenAPI definitions
  • Designed for easy integration with Axios and React Query
  • Inlines types for clarity and simplicity
  • Support for Bearer token (authorization header) and ApiKey (cookie)
  • Minimal dependencies, no runtime bloat

Note on Nullable Types

This tool implements a workaround for a bug in Microsoft.Extensions.ApiDescription.Server 9.0.8, where nullable types are incorrectly emitted as type "any" in the OpenAPI definition. The generator heuristically locates an equivalent non-nullable schema (with the same required members) and applies the intended nullability. This assumes the base, non-nullable schema is emitted correctly.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated