Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #14767
Closed
Open
Issue created Feb 20, 2023 by Administrator@rootContributor

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

Created by: t0mk

This is the spec I generated the code from: https://github.com/t0mk/metal-python-nextgen/blob/main/metal_openapi.fixed.yaml 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 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

Assignee
Assign to
Time tracking