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

Allow using operationId to find the handler #2

Open
underyx opened this issue Nov 8, 2016 · 6 comments
Open

Allow using operationId to find the handler #2

underyx opened this issue Nov 8, 2016 · 6 comments

Comments

@underyx
Copy link

underyx commented Nov 8, 2016

I'd much rather have unique IDs in the existing operationId value for each handler, and then

  • either instantiate apiset with something like handlers_module='mymodule.handlers' to have it automatically getattr(mymodule.handlers, yaml['operationId']) the handlers from there.
  • or specify a dict in my app that maps operationIds to callables.
@aamalev
Copy link
Owner

aamalev commented Nov 8, 2016

I did not know about the "operationId", and it is an interesting idea. Must think how to organize operations subsystem.

@aleufroy
Copy link

This is a greate idea. As a generale purpose, it would be greate to only remove keys from the spec if its name starts with '$'.

@aamalev
Copy link
Owner

aamalev commented Nov 15, 2016

Resolved

from aiohttp_apiset.swagger.operations import OperationIdMapping

router = SwaggerRouter(default_validate=True)
router.add_search_dir('...')
opmap = OperationIdMapping()
opmap.add_operations(
    'mymodule',
    module.module,
    getPets='module.handler')
router.include('...yaml', basePath='/my/override/path', operationId_mapping=opmap)

@aamalev
Copy link
Owner

aamalev commented Nov 16, 2016

add_operations renamed to add

@underyx
Copy link
Author

underyx commented Nov 19, 2016

Wow, awesome job, @aamalev!

Would you like me to close this issue or is there any reason you kept it open?

@aamalev
Copy link
Owner

aamalev commented Nov 19, 2016

Need to document this functionality

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants