__init__() missing 2 required positional arguments: 'schema_name_resolver' and 'spec'
See original GitHub issueHello, I’m getting the error below. Am I missing anything?
../../../env36/lib64/python3.6/site-packages/flask_base/app.py:1: in <module>
from flasgger import Swagger, LazyString, LazyJSONEncoder
../../../env36/lib64/python3.6/site-packages/flasgger/__init__.py:8: in <module>
from .base import Swagger, Flasgger, NO_SANITIZER, BR_SANITIZER, MK_SANITIZER, LazyJSONEncoder # noqa
../../../env36/lib64/python3.6/site-packages/flasgger/base.py:37: in <module>
from .utils import extract_definitions
../../../env36/lib64/python3.6/site-packages/flasgger/utils.py:22: in <module>
from .marshmallow_apispec import SwaggerView
../../../env36/lib64/python3.6/site-packages/flasgger/marshmallow_apispec.py:13: in <module>
openapi_converter = openapi.OpenAPIConverter(openapi_version='2.0')
E TypeError: __init__() missing 2 required positional arguments: 'schema_name_resolver' and 'spec'
Issue Analytics
- State:
- Created 5 years ago
- Reactions:23
- Comments:12 (1 by maintainers)
Top Results From Across the Web
TypeError: __init__() missing 2 required positional arguments
The Python TypeError: init () missing 2 required positional arguments occurs when we forget to provide 2 required arguments when instantiating a class....
Read more >Developers - __init__() missing 2 required positional arguments
__init__() missing 2 required positional arguments: 'schema_name_resolver' and 'spec' ... Hello, I'm getting the error below. Am I missing ...
Read more >TypeError: __init__() missing 2 required positional arguments
I'm trying to return some values from a function in a class but it's giving me this error. TypeError: __init__() missing 2 required...
Read more >TypeError: __init__() missing 1 required positional argument
here is my code: import torch import torchaudio import matplotlib.pyplot as plt import os import torch.nn as nn import soundfile as sf from ......
Read more >Built-in Plugins — apispec 6.0.2 documentation
APISpec plugin for translating marshmallow schemas to OpenAPI/JSONSchema format. Parameters. schema_name_resolver (callable) –.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have identified the same error, although I was unable to trace the exact change in either module: apispec or marshmallow.
Investigation
The error reports in flasgger:
The file was last changed 8 months ago with 54d9e77 on 29 Jun 2018: https://github.com/rochacbruno/flasgger/blob/master/flasgger/marshmallow_apispec.py
The file imports the following:
from apispec.ext.marshmallow import openapi
Which leads us to: https://github.com/marshmallow-code/apispec/blob/dev/apispec/ext/marshmallow/openapi.py#L107 After reviewing the commits, it seems the following changes may have resulted in the error in flasgger:
The fix to flasgger
https://github.com/rochacbruno/flasgger/blob/master/flasgger/marshmallow_apispec.py#L13
This change enables the code to run, but I am not aware of any underlying implications or restrictions of specifying None.
Note: apisepc contains a default resolver method, again I am not aware of whether flasgger should default to this. https://github.com/marshmallow-code/apispec/blob/dev/apispec/ext/marshmallow/__init__.py#L40
I hope this investigation helps in the resolution of the issue.
This issue is fixed now, but still not in
pypi
. Try to install it usingpip install https://github.com/rochacbruno/flasgger/tarball/master
.