Pyramid swagger mount point

31 views
Skip to first unread message

Silviu Dicu

unread,
Sep 13, 2017, 3:03:37 PM9/13/17
to pylons-discuss
Hello,

I started to use pyramid_swagger - http://pyramid-swagger.readthedocs.io/en/latest/index.html for an api project, which works quite
nice but I didn't figure it out how can I mount it under a specific url. I'm using the composite:main and the config I have is

 [composite:main]
 use = egg:rutter#urlmap
 /marketing = marketing
 / = api

The swagger is configured as

settings['pyramid_swagger.base_path_api_docs'] = 'api/'
settings['pyramid_swagger.schema_directory'] = 'api/api_docs/'
settings['pyramid_swagger.schema_file'] = 'swagger.json'
settings['pyramid_swagger.enable_api_doc_views'] = True
settings['pyramid_swagger.swagger_versions'] = '2.0'
settings['pyramid_swagger.use_models'] = True

All this works ... however if I want to use something like


 [composite:main]
 use = egg:rutter#urlmap
 /marketing = marketing
 /apiv1 = api

Swagger will not make available the swagger_data['X'] where X is a resource ... hence is not enabled.

Is any way to configure pyramid swagger for this problem ?

thanks.




Silviu Dicu

unread,
Sep 13, 2017, 9:14:01 PM9/13/17
to pylons-discuss
Found the problem ... basically the swagger will kick in only for the path that is defined as basePath from the definition (swagger.json).
Pyramid was happy to mount the app under any path.  
Reply all
Reply to author
Forward
0 new messages