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
  • #2028
Closed
Open
Issue created Jan 31, 2019 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

[BUG] [PYTHON] additionalProperties not supported

Created by: ivan-gomes

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

Generated Python clients do not have the ability to access the additional properties of models with additionalProperties defined. The only ones that can be accessed are those that are explicitly defined in the model and the rest are ignored. In contrast, the generated Java models extend HashMap when additionalProperties are defined and they can get accessed by Map#get(String).

openapi-generator version

4.0.0

OpenAPI declaration file content or url
  Element:
    type: "object"
    required:
    - "id"
    properties:
      id:
        type: "string"
      name:
        type: "string"
    additionalProperties:
      type: "object"

Full specification: https://github.com/Open-MBEE/mms/blob/develop/mms-ent/repo-amp/src/main/amp/web/mms/mms.swagger.yaml

Command line used for generation
java -jar /path/to/openapi-generator-cli.jar generate -i /path/to/mms.swagger.yaml -l python -o ~/tmp
Steps to reproduce

Inspecting the generated Element.py file after executing the command above with the specification above. There is also a usage of additionalProperties in the Petstore API that exhibits the same behavior.

Related issues/PRs

Clone of issue made and fixed in swagger-api/swagger-codegen: https://github.com/swagger-api/swagger-codegen/issues/8075

Suggest a fix

I believe that the additional properties can be stored in a dict, analogously to how they are handled in Java.

Assignee
Assign to
Time tracking