OpenAPITools / OpenAPITools/openapi-generator
[BUG] [typescript-fetch] generated API references undeclared function objectToJSON
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
With a schema that contains an object as a property, generation for typescript-fetch produces an invalid client that contains a reference to an undeclared function objectToJSON.
openapi-generator version
latest (via docker hub)
OpenAPI declaration file content or url
See reprex at https://github.com/luketudge/openapi-reprex
Generation Details
docker run --rm \
-v "${PWD}:/local" \
openapitools/openapi-generator-cli generate \
-i /local/openapi.json \
-g typescript-fetch \
-c /local/openapi_gen_config_typescript.json \
-o /local/typescript
Steps to reproduce
https://github.com/luketudge/openapi-reprex
Related issues/PRs
Looks like a regression of #19280 but in a special case. Whereas the very similar bug reported there occurs for a schema in which the top-level item is declared as type 'object', the bug here is the same thing, but with a property that is declared as type object.
Suggest a fix
I'm looking into it. Not sure yet.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the generation command and the openapi-reprex repository linked in the issue, using the typescript-fetch generator and its Docker invocation to reproduce the output. Trace where the generated client references objectToJSON and confirm that the generated client no longer contains an undeclared function reference for object-valued properties.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, typescript
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100