Annotation Interface DefaultValue
Define the default keyword in the parameter schema to specify the default value for an optional parameter. The
default value is the one that the server uses if the client does not supply the parameter value in the request.
Note that the string value of this annotation will be parsed using
There are two common mistakes when setting a
JsonParser.parseString(String)
There are two common mistakes when setting a
DefaultValue
:
-
Using
DefaultValue
with @Required
. This does not make sense - if a value is required, the client must always send it, and the default value is never used. -
Using @
DefaultValue
to specify a sample value. This is not the intended use of @DefaultValue
and can lead to unexpected behavior in some Swagger tools.
-
Required Element Summary
Required Elements
-
Element Details
-
value
String value
-