-
Notifications
You must be signed in to change notification settings - Fork 6k
Description
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).
Swagger-codegen version
2.3.1
Swagger 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 ~/Downloads/swagger-codegen-cli-2.3.1.jar generate -i ~/Documents/mms.swagger.yaml -l php -o ~/tmpSteps 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
Suggest a fix/enhancement
I believe that the additional properties can be stored in a dict, analogously to how they are handled in Java.