You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As per the definition of Free-Form Objects described in Swagger documentation here, additionalProperties: true needs to be treated as dictionary values can be of any type.
I assume any is interpreted as Object.class in the world of Java.
During the parsing or codegen modeling (not sure), such an object is treated as UntypedProperty causing following errors during codegen
[ERROR] No Type defined for Property io.swagger.models.properties.UntypedProperty@0
[ERROR] String to be sanitized is null. Default to ERROR_UNKNOWN
Actual: additionalProperties=true is treated as UntypedProperty. Generated class does not extend HashMap
Expected: additionalProperties=true needs to be treated as ObjectProperty. Generated class should extend HashMap
Sample notation: pet.json << this one fails with above error
Place above swagger.json and pet.json in same folder and run the maven plugin to generate java code.
Related issues/PRs
Suggest a fix/enhancement
Treat "additionalProperties": true, exactly same as
"additionalProperties": {
"type": "object"
}
The text was updated successfully, but these errors were encountered:
EtonDoze
changed the title
additionalProperties Free-Form Object is getting mis-categorized as UntypedProperty
additionalProperties Free-Form Object is getting mis-categorized as UntypedPropertyFeb 6, 2018
EtonDoze
changed the title
additionalProperties Free-Form Object is getting mis-categorized as UntypedProperty
additionalProperties Free-Form Object is getting mis-categorized as UntypedProperty
Feb 6, 2018
EtonDoze
changed the title
additionalProperties Free-Form Object is getting mis-categorized as UntypedProperty
additionalProperties=true is getting mis-categorized as UntypedProperty
Feb 6, 2018
Description
As per the definition of
Free-Form Objects
described in Swagger documentation here,additionalProperties: true
needs to be treated as dictionary values can be of any type.I assume any is interpreted as Object.class in the world of Java.
During the parsing or codegen modeling (not sure), such an object is treated as
UntypedProperty
causing following errors during codegenActual:
additionalProperties=true
is treated asUntypedProperty
. Generated class does not extendHashMap
Expected:
additionalProperties=true
needs to be treated asObjectProperty
. Generated class should extendHashMap
Sample notation:
pet.json << this one fails with above error
pet.json << this one works without any error
Swagger-codegen version
v2.3.1
Swagger declaration file content or url
swagger.json
Command line used for generation
Used maven plugin
Steps to reproduce
Place above
swagger.json
andpet.json
in same folder and run the maven plugin to generate java code.Related issues/PRs
Suggest a fix/enhancement
Treat
"additionalProperties": true,
exactly same asThe text was updated successfully, but these errors were encountered: