OpenAPI to Angular Client Generator
@metaengine/openapi-angularConvert OpenAPI 3.x to Angular services and models with httpResource, Signals, inject() DI, and the new Angular 22 @Service() decorator. Generates idiomatic Angular 19+ code with reactive data fetching.
Pick your registry
The same generator, published to every ecosystem we support. Install however your project expects.
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.
After install, point the CLI at your schema. It writes the generated tree to your chosen output directory.
npx @metaengine/openapi-angular <input> <output> [options]Supports OpenAPI 3.0+ specifications in both JSON and YAML formats.
npx @metaengine/openapi-angular api.yaml ./src/app/apinpx @metaengine/openapi-angular https://api.example.com/openapi.json ./src/app/apinpx @metaengine/openapi-angular api.yaml ./src/app/api \
--provided-in root \
--documentation \
--error-handling \
--inject-functionnpx @metaengine/openapi-angular api.yaml ./src/app/api \
--service-decorator \
--http-resource \
--documentationEvery knob, documented
Every option is available on the C# fluent API as a method, and most are also exposed as CLI flags. Cross-cutting auth, headers, retries and timeouts apply across frameworks.
Angular Options
12WithBaseUrlToken(string)Injection token name for base URL (default: "BASE_URL")WithInjectFunction()Use inject() instead of constructor DI (Angular 14+)WithProvidedIn(string)Injection scope ("root", "platform", "any")WithServiceDecorator()Emit the Angular 22 @Service() decorator instead of @Injectable — a root-provided singleton that auto-enables inject() DI (mutually exclusive with WithProvidedIn, last wins)WithServiceDecorator(x => x.ComponentScoped())Angular 22 @Service({ autoProvided: false }) — a manually-provided, component/route-scoped serviceWithHttpResources()Generate httpResource methods with Signals for GET operations (Angular 19.2+)WithHttpResources(r => r.WithTrigger())Add optional trigger signal for lazy loading of httpResource methodsWithInterceptors()Generate Angular HTTP interceptors so cross-cutting concerns (auth, retries, error handling) live in interceptors instead of inline per-service codeWithResponseDateTransformation()Convert date / date-time strings in responses to Date objectsWithMethodNames(Func)Custom method naming ruleWithDocumentation()Enable JSDoc commentsWithOptionsObjectThreshold(int)Parameter count for options object (default: 4)
Auth · Headers · Resilience
12WithErrorHandling()Enable smart error handling based on HTTP status semanticsWithErrorHandling(errors => errors...)Per-status routing: ReturnNullFor(404, 403) · ReturnErrorFor(400, 422) · ThrowFor(401, 500)WithBearerAuth()Bearer token from env var (default API_TOKEN) — adds Authorization headerWithBearerAuth(string)Bearer token from a specific env var nameWithBearerAuth(string, string)Bearer token with custom header name (e.g. X-Api-Key)WithBasicAuth(string, string)HTTP Basic auth from username + password env varsWithCustomHeader(string, string)Static header from env var. Repeatable (e.g. X-Tenant-ID ← TENANT_ID)WithTimeout(double)Request timeout in seconds for all operationsWithTimeout(double?, double?, double?, double?)Granular timeout: seconds · connect · read · writeWithRetries()Retries with exponential backoff (default status 429, 503)WithRetries(int)Retries with a custom max-attempts countWithRetries(int, double, double, int[])Retries with full custom settings including status codes
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
2Verbose()Enable verbose loggingWithLogger(Action<string>)Route generation log output to a custom sink