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

add REPL completion for resource #8

Merged
merged 1 commit into from
Jun 20, 2017
Merged

add REPL completion for resource #8

merged 1 commit into from
Jun 20, 2017

Conversation

Jefftree
Copy link
Contributor

@Jefftree Jefftree commented Jun 20, 2017

Added iPython tab completion for client resource.

client = SwaggerClient.from_url('http://petstore.swagger.io/v2/swagger.json')
wrapped_client = ZipkinClientDecorator(client)

After typing wrapped_client.pet.<TAB>

Before: Completes with with_headers which is technically a private decorator function. We had to use wrapped_client.pet.resource.<TAB> to obtain the list of swagger operations. This was due to the fact that __getattr__ was set, but __dir__ was not set.

After: Completes with .addPet, .getPetById, etc. These are the functions we want to expose.

Testing

make test passes and also manually tested with a SwaggerClient.

@kaisen
Copy link
Member

kaisen commented Jun 20, 2017

nice! 🚢

@bplotnick
Copy link
Contributor

Yes! This fixes such an annoyance.

@bplotnick bplotnick merged commit 5f17287 into Yelp:master Jun 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants