-
-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Closed
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)?
- 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
When response schema uses additionalProperties with $ref, the generated return type for request method is dict(str, list)
, which fails to deserialize because list
doesn't specify item types.
openapi-generator version
4.3.1, 5.0.0-beta, master
OpenAPI declaration file content or url
components:
schemas:
a: {type: object, additionalProperties: {$ref: '#/components/schemas/b'}}
b: {type: array, items: {type: string}}
paths:
/z:
get:
responses:
"200":
description: z
content: {application/json: {schema: {$ref: '#/components/schemas/a'}}}
Generation Details
rm -rf api
docker run --rm -i --user `id -u`:`id -g` -v `pwd`:/src \
openapitools/openapi-generator-cli generate \
-i /src/oapi.yaml \
-g python \
--package-name foo \
-o /src/api
Steps to reproduce
Observe that:
cat api/foo/api/default_api.py | grep rtype
lists a return type dict(str, list)
.
Related issues
I would expect this to have been fixed by #7383, but it still fails on master.
cc @spacether