Now that webargs is using marshmallow internally, we specify default argument values using the missing parameter:
arg = fields.Str(missing='foo')
But apispec doesn't check the missing key when introspective parameter defaults--it only checks default. To get the correct swagger default, we have to specify both parameters:
arg = fields.Str(missing='foo', default='foo')
Which isn't ideal.
Since we're using the same logic to introspect fields and schemas that are used for serialization and deserialization, one approach would be to tell field2property and related methods whether they're introspecting load or dump. For the specific case of parameter defaults, we'd check default for dump and missing for load.
Now that webargs is using marshmallow internally, we specify default argument values using the
missingparameter:But apispec doesn't check the
missingkey when introspective parameter defaults--it only checksdefault. To get the correct swagger default, we have to specify both parameters:Which isn't ideal.
Since we're using the same logic to introspect fields and schemas that are used for serialization and deserialization, one approach would be to tell
field2propertyand related methods whether they're introspecting load or dump. For the specific case of parameter defaults, we'd checkdefaultfor dump andmissingfor load.