New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[java] "additionalProperties: true" for free form object in directory/map is not working #796
Comments
Related issue: #409 (this was only handling the case Can you post some examples of the expected changes to the generated code? I guess you expect something else for |
Hi, Based on my testing, public class MapTest1 extends HashMap<String, Object> {
......
} And public class MapTest3 extends HashMap<String, Object> {
......
} When should the value of properties But there is a declaration from Free-Form Objects that So what I expect for public class MapTest2 extends HashMap<String, Object> {
......
} |
Hi, there is any update or share your opinion. Thanks! |
I believe you want to describe arbitrary JSON, please use "type": "object" instead. Here is an example in JSON: "responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "object"
}
}
} Ref: https://stackoverflow.com/questions/35782175/how-to-receive-a-dynamic-response-in-a-swagger-spec |
@wing328 there is probably not that much difference between a Free-Form Object: "responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "object",
"additionalProperties": "true"
}
}
} and an object: "responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "object"
}
}
} But we should support the free form object. In a java (for example), having an Maybe my fix in a02b313 was not that great and need to be ajusted. |
Consider "additionalProperties: true" Fixes OpenAPITools#796
I have filed a PR: #849 |
Consider "additionalProperties: true" Fixes #796
Can you give version |
Consider "additionalProperties: true" Fixes OpenAPITools#796
Description
I am using openapi-generator-maven-plugin to generate the model pojo beans, but the hashmap object is not generated correct if "additionalProperties: true" introduced in declaration file.
openapi-generator version
OpenAPI declaration file content or url
Command line used for generation
mvn clean compile
Steps to reproduce
The maven pom.xml is
Suggest a fix/enhancement
Free-form objects can be defined in two ways as described in https://swagger.io/docs/specification/data-models/dictionaries/ . And "additionalProperties: {}" is working, so "additionalProperties: true" should be also supported.
The text was updated successfully, but these errors were encountered: