-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Open
Labels
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- What's the version of OpenAPI Generator used?
- Have you search for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Bounty to sponsor the fix (example)
Description
If models in the spec are named as lower cased language-specific types, it bypasses sanity checks and produces undesirable result.
E.g. my model is named map. Then the generated interface is named Map, and the api file silently maps that to any
openapi-generator version
master
OpenAPI declaration file content or url
Command line used for generation
docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate \
-i /local/spec.yaml \
-g typescript-angular \
-o /local/generated
Steps to reproduce
- Run command above
- Check the generated
model/map.tsandapi/default.service.ts - Existing output:
// model/map.ts:
export interface Map { ... }
// api/default.service.ts
public mapGet(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: '*/*'}): Observable<any>;
- Expected output
// model/map.ts:
export interface ModelMap { ... }
// api/default.service.ts
public mapGet(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: '*/*'}): Observable<ModelMap>;
Related issues/PRs
It's somewhat similar to #5104 .
Suggest a fix
Half of the problem (generating a correct model name) is addressed in #5138
The proper result type in api file (instead of any) still needs a separate fix.
Reactions are currently unavailable