Make Swagger use primitive int and boolean in generated models

Viewed 3569

By default, for "type": "boolean" in JSON spec, Swagger will generate a Boolean (object, non-primitive, nullable) field in model. Is there a way to make Swagger generate boolean (primitive, non-nullable) fields in models instead?

The rationale is: Spring MVC is going to initialize these fields with null on invalid input, which is soooo undesirable. Better keep them with default values.

Same question with int vs Integer.

NB: Swagger has its own concept of "primitive" types which is totally unrelated to Java primitives and isn't what I seek.

1 Answers
Related