NPM Package
Use as a CLI tool via npm/npx
# Install globally
npm install -g @metaengine/openapi-angular
# Or use with npx
npx @metaengine/openapi-angular api.yaml ./output
Requirements: Node.js 18+, .NET 8.0+ runtime
NuGet Package
Use programmatically in .NET projects
# Install via dotnet CLI
dotnet add package MetaEngine.TypeScript.OpenApi.Angular
Requirements: .NET Standard 2.0+
Command Line Usage
Basic Syntax
npx @metaengine/openapi-angular <input> <output> [options]
Supports OpenAPI 3.0+ specifications in both JSON and YAML formats.
Quick Examples
# Generate from local file
npx @metaengine/openapi-angular api.yaml ./src/app/api
# Generate from URL
npx @metaengine/openapi-angular https://api.example.com/openapi.json ./src/app/api
# With Angular best practices
npx @metaengine/openapi-angular api.yaml ./src/app/api \
--provided-in root \
--documentation \
--error-handling \
--inject-function
CLI Options
| Option | Description |
|---|---|
--provided-in <value> | Angular injection scope (root, any, platform) |
--base-url-token <name> | Injection token name for base URL [default: BASE_URL] |
--options-threshold <n> | Parameter count to use options object [default: 4] |
--documentation | Generate JSDoc comments |
--inject-function | Use inject() instead of constructor injection (Angular 14+) |
--http-resource | Generate httpResource methods with Signals for GET operations (Angular 19.2+) |
--error-handling | Enable smart error handling |
--include-tags <tags> | Filter by OpenAPI tags (comma-separated, case-insensitive) |
--strict-validation | Enable strict OpenAPI validation |
--verbose | Enable verbose logging |
--help, -h | Show help message |
Programmatic Usage (C#)
Configuration Example
Configuration Example
Type Resolution
Automatically resolves and includes all referenced types from your OpenAPI specification.
Flexible Naming
Customize method and file naming conventions to match your project's standards.
Modern Angular
Support for Angular 14+ features including inject() function and standalone components.
Options Reference
Angular Options
WithBaseUrlToken(string)Injection token name for base URL (default: "BASE_URL")WithErrorHandling()Enable smart error handlingWithErrorHandling(Func)Custom error handling per status codeWithInjectFunction()Use inject() instead of constructor DI (Angular 14+)WithHttpResources()Generate httpResource methods with Signals for GET operations (Angular 19.2+)WithProvidedIn(string)Injection scope ("root", "platform", "any")WithMethodNames(Func)Custom method naming ruleWithDocumentation()Enable JSDoc commentsWithOptionsObjectThreshold(int)Parameter count for options object (default: 4)
OpenAPI Filtering
WithStrictValidation()Enable strict OpenAPI validationWithOperationFilter(Func)Filter operations by predicateWithHeaderFilter(Func)Filter header parameters
Naming Transformations
Types(Func)Transform type namesPaths(Func)Transform output pathsFileNames(Func)Transform file names
File Management
CleanDestination()Clean output directory before generationAlwaysOverwrite()Always overwrite existing filesOnlyWhenModelChanged()Update only when model changesOnlyWhenNew()Write only new files, preserve existingCleanDirectories(...)Clean specific subdirectories
Diagnostics
EnableVerboseLogging()Enable detailed logging