Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: unhashable type #12

Open
shazz opened this issue Jul 18, 2019 · 5 comments
Open

TypeError: unhashable type #12

shazz opened this issue Jul 18, 2019 · 5 comments
Assignees
Labels
question Further information is requested

Comments

@shazz
Copy link

shazz commented Jul 18, 2019

Hi,

when I pass my Falcon resource to apispec I got this error:

    loginResource = LoginResource(user_service)
    deviceResource = DeviceResource()
    api.add_route('/api/login', loginResource)
    api.add_route('/api/devices', deviceResource)

    # Create an APISpec
    from apispec import APISpec
    from apispec.ext.marshmallow import MarshmallowPlugin
    from falcon_apispec import FalconPlugin

    spec = APISpec(
        title='Swagger Backend API',
        version='1.0.0',
        openapi_version='2.0',
        plugins=[
            FalconPlugin(api),
            MarshmallowPlugin(),
        ],
    )

    # pass created resource into `path` for APISpec
    spec.path(resource=deviceResource)
$ python -u test.py
Traceback (most recent call last):
  File "test.py", line 214, in <module>
    spec.path(resource=deviceResource)
  File "C:\Work\Analytics\git\test\falcon-test\.venv\lib\site-packages\apispec\core.py", line 347, in path
    path=path, operations=operations, parameters=parameters, **kwargs
  File "C:\Work\Analytics\git\test\falcon-test\.venv\lib\site-packages\falcon_apispec\falcon_plugin.py", line 30, in path_helper
    resource_uri_mapping = self._generate_resource_uri_mapping(self._app)
  File "C:\Work\Analytics\git\test\falcon-test\.venv\lib\site-packages\falcon_apispec\falcon_plugin.py", line 23, in _generate_resource_uri_mapping
    mapping[resource] = uri
TypeError: unhashable type: 'LoginResource'

which is not on the resource I have added...
Any idea ?

Thanks!

@alysivji
Copy link
Owner

What version of falcon-apispec and apispec are you using?

@shazz
Copy link
Author

shazz commented Jul 22, 2019

$ pip freeze
apispec==2.0.2
Beaker==1.10.1
falcon==2.0.0
falcon-apispec==0.3.0
falcon-auth==2.0.1
falcon-middleware-beaker==0.0.1
falcon-policy==0.2.0
gunicorn==19.9.0
marshmallow==2.19.5
mohawk==1.0.0
PyJWT==1.7.1
PyYAML==5.1.1
six==1.12.0
Yapsy==1.12.0

@shazz
Copy link
Author

shazz commented Jul 26, 2019

did it help ?

@alysivji
Copy link
Owner

Sorry for the delay, will be taking a look at this tonight or tomorrow night.

@alysivji alysivji self-assigned this Jul 26, 2019
@alysivji alysivji added the bug Something isn't working label Jul 26, 2019
@alysivji
Copy link
Owner

@shazz Could you share the LoginResource you are using? Not sure how your __init__ works.

@alysivji alysivji added question Further information is requested and removed bug Something isn't working labels Sep 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants