Generated Output โ
What ng-openapi actually writes into your output directory, file by file. This is the canonical reference for the generated structure โ other pages link here instead of repeating it.
The Full Tree โ
With the default configuration (generateServices: true, dateType: "Date"):
<output>/
โโโ models/
โ โโโ index.ts # TypeScript interfaces, enums / unions
โ โโโ *.ts # One file per schema (only with modelFileStructure: 'per-type')
โ โโโ request-params.ts # Request-object interfaces (only with useSingleRequestParameter)
โโโ services/
โ โโโ index.ts # Service exports
โ โโโ *.service.ts # One Angular service per controller/tag
โโโ tokens/
โ โโโ index.ts # Injection tokens for this client
โโโ utils/
โ โโโ base-interceptor.ts # Routes client-scoped interceptors
โ โโโ date-transformer.ts # Date interceptor (only with dateType: "Date")
โ โโโ file-download.ts # Download helpers
โ โโโ http-params-builder.ts # Query-param serialization
โโโ providers.ts # provide<ClientName>Client() setup function
โโโ index.ts # Main barrel exportPlugins add their own directories next to these:
validators/โ Zod schemas, one file per controller (Zod plugin)resources/โhttpResource-based services (HTTP Resource plugin)
With generateServices: false only models/ and the main index.ts are generated.
File by File โ
models/index.ts โ
One interface per schema in the spec, plus enums in the style you chose via enumStyle. Date fields are typed Date or string depending on dateType. Type names can be decorated with a prefix/suffix via naming.models.
With modelFileStructure: 'per-type', each schema instead gets its own models/<kebab-name>.ts file (plus models/request-options.ts for the RequestOptions interface), and models/index.ts becomes a pure barrel re-exporting them โ imports from ../models and the main index.ts are unaffected.
models/request-params.ts โ
Only generated with useSingleRequestParameter: one exported <MethodName>Params interface per operation, re-exported through the models barrel.
services/*.service.ts โ
One injectable service per controller (OpenAPI tag), using inject(HttpClient) and this client's base-path token. Class names default to <Tag>Service and can be decorated via naming.services (file names are unaffected). Classes are decorated with @Injectable({ providedIn: "root" }), or Angular 22+'s @Service() when serviceDecorator is set to 'service'. Method names come from operationId, optionally transformed by customizeMethodName. When validation.response is enabled, each method accepts a parse hook in its trailing options parameter.
tokens/index.ts โ
Injection tokens namespaced per client so multiple clients can coexist (see Multiple Clients):
BASE_PATH_<CLIENTNAME>โ the API base URL (falls back to/api)HTTP_INTERCEPTORS_<CLIENTNAME>โ this client's interceptor instancesCLIENT_CONTEXT_TOKEN_<CLIENTNAME>โHttpContexttoken marking which client a request belongs to
For the default client, deprecated BASE_PATH / CLIENT_CONTEXT_TOKEN aliases are kept for backwards compatibility.
utils/base-interceptor.ts โ
A global interceptor that checks each request's HttpContext and applies this client's interceptor chain only to requests made by this client's services โ that's what keeps interceptors from leaking across clients.
utils/date-transformer.ts โ
Only generated with dateType: "Date". Contains ISO_DATE_REGEX, transformDates, and the DateInterceptor that converts ISO date strings in responses to Date objects. See the Date Transformer reference.
utils/file-download.ts โ
downloadFile, downloadFileOperator, and extractFilenameFromContentDisposition for handling blob downloads. See the File Download Helper reference.
utils/http-params-builder.ts โ
Serializes query parameters into HttpParams, handling arrays, nested objects, and Date values. Used internally by the generated services.
providers.ts โ
The provide<ClientName>Client() function (e.g. provideDefaultClient) plus its config interface. Wires up the base-path token, the base interceptor, client-scoped interceptors, and (with dateType: "Date") the date interceptor. See the Providers reference.
index.ts โ
Barrel export of everything above, so consumers can import from the output root.
Regeneration Notes โ
- Every file starts with a "Generated by ng-openapi โ do not edit" header; regeneration overwrites them, so put customizations in your own code (interceptors, wrappers), never in the output directory.
- Generated files carry
@ts-nocheckandeslint-disablepragmas so they don't fight your project's lint/strict settings. - Add the output directory to your API-generation script rather than committing manual tweaks โ see CLI Usage for workflow recipes.