npm NuGet v1.1.0 MIT
@metaengine/openapi-angular
OpenAPI 3.x → Angular services and models with httpResource, Signals, and inject() DI. Generates idiomatic Angular 19+ code with reactive data fetching.
Install
Pick your registry
The same generator, published to every ecosystem we support. Install however your project expects.
npmPrimary@metaengine/openapi-angular
$npm install @metaengine/openapi-angular
v1.1.0
NuGetMetaEngine.TypeScript.OpenApi.Angular
$dotnet add package MetaEngine.TypeScript.OpenApi.Angular
v1.1.0
Usage
Drive it from the CLI or programmatically
npm ships a zero-config CLI. NuGet ships the same generator as a C# fluent API — same options, same output.
npm · npx · CI-friendly
After install, point the CLI at your OpenAPI spec. It writes the generated tree to your chosen output directory.
Basic syntax
npx @metaengine/openapi-angular <input> <output> [options]Supports OpenAPI 3.0+ specifications in both JSON and YAML formats.
Quick examples
Generate from a local file
npx @metaengine/openapi-angular api.yaml ./src/app/apiGenerate from a URL
npx @metaengine/openapi-angular https://api.example.com/openapi.json ./src/app/apiWith Angular best practices
npx @metaengine/openapi-angular api.yaml ./src/app/api \
--provided-in root \
--documentation \
--error-handling \
--inject-functionCLI 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+)
--lazy-resource
Add optional trigger signal for lazy loading of httpResource methods (implies --http-resource)
--error-handling
Enable smart error handling
--include-tags <tags>
Filter by OpenAPI tags (comma-separated, case-insensitive)
--strict-validation
Enable strict OpenAPI validation
--date-transformation
Convert date strings in responses to JavaScript Date objects
--clean
Remove files no longer part of generation while preserving unchanged files (smart VCS-friendly cleanup)
--verbose
Enable verbose logging
--help, -h
Show help message
Options reference
Every knob, documented
Every option is available on the CLI as a flag and on the programmatic C# API as a fluent method. Defaults shown in the right column.
Angular Options
11WithBaseUrlToken(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+)WithHttpResources(r => r.WithTrigger())Add optional trigger signal for lazy loading of httpResource methodsWithProvidedIn(string)Injection scope ("root", "platform", "any")WithMethodNames(Func)Custom method naming ruleWithDocumentation()Enable JSDoc commentsWithOptionsObjectThreshold(int)Parameter count for options object (default: 4)WithResponseDateTransformation()Convert date/date-time strings in responses to Date objects
OpenAPI Filtering
3WithStrictValidation()Enable strict OpenAPI validationWithOperationFilter(Func)Filter operations by predicateWithHeaderFilter(Func)Filter header parameters
Naming Transformations
3Types(Func)Transform type namesPaths(Func)Transform output pathsFileNames(Func)Transform file names
File Management
5CleanDestination()Clean output directory before generationAlwaysOverwrite()Always overwrite existing filesOnlyWhenModelChanged()Update only when model changesOnlyWhenNew()Write only new files, preserve existingCleanDirectories(...)Clean specific subdirectories
Diagnostics
1EnableVerboseLogging()Enable detailed logging
Features
Why this package is different
Deterministic output
Same spec + same options produce byte-identical files. Safe to commit, safe to diff in review, safe to cache in CI.
Tree-shakeable
One file per tag (or per operation) means bundlers drop unused code at build time. No runtime dispatch table.
Zero runtime
Validation and clients opt in. The default emit is pure types with no dependency surface beyond your HTTP lib.
Flexible naming
Case conventions configurable per role — types, properties, operations, enums. Idiomatic in the target by default.
Type resolution
Discriminated unions for oneOf, proper nullability, bigint when the spec mandates it, refs flattened only when safe.
Semver-honest
Spec diff drives the version bump. Additive changes = minor, removed ops = major. Never a surprise in your lockfile.