OpenAPITools/openapi-generator-cli

[BUG] python-nextgen, `from_dict` method not generated in class for "inner" schema

t0mk opened this issue · 1 comments

t0mk commented

The exception:

  File "/home/tomk/.local/lib/python3.8/site-packages/metal_python/models/ip_reservation_list.py", line 77, in from_dict
    "ip_addresses": [IPReservationListIpAddressesInner.from_dict(_item) for _item in obj.get("ip_addresses")] if obj.get("ip_addresses") is not None else None,
  File "/home/tomk/.local/lib/python3.8/site-packages/metal_python/models/ip_reservation_list.py", line 77, in <listcomp>
    "ip_addresses": [IPReservationListIpAddressesInner.from_dict(_item) for _item in obj.get("ip_addresses")] if obj.get("ip_addresses") is not None else None,
AttributeError: type object 'IPReservationListIpAddressesInner' has no attribute 'from_dict'

This is the spec I generated the code from:
https://github.com/t0mk/metal-python-nextgen/blob/main/metal_openapi.fixed.yaml

This is the class without from_dict:
https://github.com/t0mk/metal-python-nextgen/blob/main/metal_python/metal_python/models/ip_reservation_list_ip_addresses_inner.py

Here, another class calls the non-existent from_dict method of the inner class:
https://github.com/t0mk/metal-python-nextgen/blob/main/metal_python/metal_python/models/ip_reservation_list.py#L77

This is how I generate the sdk:

docker run --rm -u 1000:1000 -v /home/tomk/em/oag-metal-python:/local openapitools/openapi-generator-cli@sha256:67100c4bda1fb1886b5024e3a7549f905002f6393d19f828f438c902b8f85d67 generate \
	-i /local/./metal_openapi.fixed.yaml \
	-g python-nextgen \
	-o /local/metal_python \
	--git-repo-id metal-python-nextgen \
	--git-user-id t0mk  \
    --additional-properties=packageName=metal_python,packageVersion=0.0.1

I used docker container with the 6.4.0 release:
https://hub.docker.com/layers/openapitools/openapi-generator-cli/v6.4.0/images/sha256-67100c4bda1fb1886b5024e3a7549f905002f6393d19f828f438c902b8f85d67?context=explore

t0mk commented

wrong repo, the bug is now at
OpenAPITools/openapi-generator#14767