Skip to content

Commit

Permalink
Merge pull request #93 from va-dev/master
Browse files Browse the repository at this point in the history
Add custom schema name resolver for MarshmallowPlugin.
  • Loading branch information
maximdanilchenko committed May 28, 2020
2 parents efefd9d + ba786ba commit 98324c0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion aiohttp_apispec/aiohttp_apispec.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@ def __init__(
error_callback=None,
in_place=False,
prefix='',
schema_name_resolver=resolver,
**kwargs
):

self.plugin = MarshmallowPlugin(schema_name_resolver=resolver)
self.plugin = MarshmallowPlugin(schema_name_resolver=schema_name_resolver)
self.spec = APISpec(plugins=(self.plugin,), openapi_version="2.0", **kwargs)

self.url = url
Expand Down Expand Up @@ -184,6 +185,7 @@ def setup_aiohttp_apispec(
error_callback=None,
in_place: bool = False,
prefix: str = '',
schema_name_resolver: Callable = resolver,
**kwargs
) -> None:
"""
Expand Down Expand Up @@ -240,6 +242,7 @@ async def index(request):
instead of the moment of the on_startup signal.
If True, be sure all routes are added to router
:param prefix: prefix to add to all registered routes
:param schema_name_resolver: custom schema_name_resolver for MarshmallowPlugin.
:param kwargs: any apispec.APISpec kwargs
"""
AiohttpApiSpec(
Expand All @@ -253,5 +256,6 @@ async def index(request):
error_callback=error_callback,
in_place=in_place,
prefix=prefix,
schema_name_resolver=schema_name_resolver,
**kwargs
)

0 comments on commit 98324c0

Please sign in to comment.