Open zach-hamm opened 1 year ago
Routes and views are not registered by config.pyramid_openapi3_spec
, one has to call pyramid_openapi3_register_routes
to register routes. Views are always registered by the user.
So I'm not sure what the problem is, can you provide more detail?
A route and view is added when you register your spec which you can see here:
By default a view is added and you can see the spec file. I had to disable it by committing the config and adding my own afterwards, but it would be nice if it was optional by the library. If there’s a different way to setup the library without creating a view let me know. I poked around and didn’t see anything so I followed what was in the README
Ahhh, now I see, you mean the route/view for the Swagger UI, I thought you meant the routes/views for endpoint defined in openapi.yaml
file.
If you wanna contribute this feature, having config.pyramid_openapi3_spec(swagger_ui=False)
seems like the cleanest way to do it in my eyes.
No that’s for the OpenAPI yaml file. The swagger UI registration has its own endpoint which is here:
The link I sent previously creates a route/view for the YAML file which you can see here:
It’s generating a new view where the YAML file is the response.
Ah, yes, you are correct, long day here, sorry.
All good! I’ve been out on vacation, but I don’t mind making these changes when I get back and opening up a PR for them if that sounds like a good idea to you.
A register_view=True
default flag for add_spec_view
sounds reasonable.
Hey @zach-hamm, do you want to keep working on this, or should I close the issue?
I was hoping to update the
config.pyramid_openapi3_spec
directive so that it registers the spec file to the library, but doesn't enable the route/view. The reason being is we need to perform some filtering on our spec file to determine if you have access to see all of the contents or not. Alternatively, there could be another way to just register the spec file without creating a view for it like:config.pyramid_openapi3_register_spec