Skip to content
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

swagger-maven-plugin not generating object for @Schema defaultValue #4041

Closed
gizmo78 opened this issue Oct 18, 2021 · 0 comments · Fixed by #4063
Closed

swagger-maven-plugin not generating object for @Schema defaultValue #4041

gizmo78 opened this issue Oct 18, 2021 · 0 comments · Fixed by #4063

Comments

@gizmo78
Copy link

gizmo78 commented Oct 18, 2021

The swagger-maven-plugin does not appear to be generating an object type for @Schema defaultValue. Instead, it generates just the original String. Other annotations in @Schema (e.g. example) do generate the correct object type.

String SAMPLE = "{ "enabled": false, "interval": 30, "intervalUnit": "minute", "attempts": 6, "timePeriod": 5, "timePeriodUnit": "minute" }";

@Schema(description = "Description", example = SAMPLE defaultValue = SAMPLE)
public MyObject importMyObject;

Generated output from swagger-maven-plugin below. Notice the "default" is String whereas "example" is an object

"MyObject" : {
"type" : "object",
"properties" : {
"enabled" : {
"type" : "boolean"
},
"attempts" : {
"type" : "integer",
"format" : "int64"
},
"timePeriod" : {
"type" : "integer",
"format" : "int64"
},
"timePeriodUnit" : {
"type" : "string",
"enum" : [ "week", "day", "hour", "minute", "second" ]
},
"lockTimePeriod" : {
"type" : "integer",
"format" : "int64"
},
"lockTimePeriodUnit" : {
"type" : "string",
"enum" : [ "week", "day", "hour", "minute", "second" ]
}
},
"description" : "Description",
"example" : {
"enabled" : false,
"interval" : 30,
"intervalUnit" : "minute",
"attempts" : 6,
"timePeriod" : 5,
"timePeriodUnit" : "minute"
},
"default" : "{ "enabled":false, "interval": 30, "intervalUnit": "minute", "attempts": 6, "timePeriod": 5, "timePeriodUnit": "minute" }"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant