Skip to content

Commit

Permalink
Revert "Remove unused kwargs in Api.definition decorator"
Browse files Browse the repository at this point in the history
This reverts commit 0ed8a5b.

Those kwargs can be used when not calling definition in decoration mode:

api.definition('Pet')(PetSchema, extra_fields={'x-field': 'value'})
  • Loading branch information
lafrech committed Nov 9, 2018
1 parent 0ed8a5b commit 304bc0f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions flask_rest_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ def definition(self, name):
class PetSchema(Schema):
...
"""
def decorator(schema_cls):
def decorator(schema_cls, **kwargs):
if APISPEC_VERSION_MAJOR < 1:
self.spec.definition(name, schema=schema_cls)
self.spec.definition(name, schema=schema_cls, **kwargs)
else:
self.spec.components.schema(name, schema=schema_cls)
self.spec.components.schema(name, schema=schema_cls, **kwargs)
return schema_cls
return decorator

Expand Down

0 comments on commit 304bc0f

Please sign in to comment.