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

How should I add an existing Path instance to an APISpec instance #49

Closed
Trii opened this issue Feb 1, 2016 · 3 comments

Comments

@Trii
Copy link
Contributor

commented Feb 1, 2016

I tried to do something like:

spec = APISpec(**kwargs)
spec.add_path(Path(**kwargs))

And I received the following error (as I should have)

File "/Users/Josh/Developer/Kaplan/AWS-Lambda-APIGateway-POC/env/lib/python2.7/site-packages/apispec/core.py", line 169, in add_path
    self._paths.setdefault(path.path, path).update(path)
TypeError: unhashable type: 'Path'

Is there an easy way to add an existing Path object or do I need to duplicate the logic of self._paths.setdefault(path.path, path).update(path)?

If this functionality seems worthwhile, I can submit a PR to update APISpec.add_path to accept Path objects.

@sloria

This comment has been minimized.

Copy link
Member

commented Feb 6, 2016

@Trii Good catch. I would certainly accept a PR to pass a Path to add_path.

@Trii

This comment has been minimized.

Copy link
Contributor Author

commented Feb 6, 2016

Ok! I'll put one together on Monday.
On Sat, Feb 6, 2016 at 11:06 AM Steven Loria notifications@github.com
wrote:

@Trii https://github.com/Trii Good catch. I would certainly accept a PR
to pass a Path to add_path.


Reply to this email directly or view it on GitHub
#49 (comment)
.

@sloria

This comment has been minimized.

Copy link
Member

commented Feb 6, 2016

Awesome. Thanks!

Trii added a commit to Trii/apispec that referenced this issue Feb 10, 2016

APISpec.add_path now accepts Path objects
Had to do a little `basePath` dance, not as succinct as I'd like

Fixes marshmallow-code#49

@sloria sloria closed this in #50 Feb 11, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.