An apispec extension for pyramid web framework.
pip install rebecca.apispec
config.include("rebecca.apispec")
add_apispec
is directive to add apispec global information.
config.add_apispec(title="example API", version="0.1")
apispec = config.get_apispec()
apispec
is property for apispec.
apispec = request.apispec
request.apispec.to_dict()
add_view(
...
responses_schema=DummyResponseSchema(),
)
add_view(
...
request_body_schema={
"application/json": {"schema": DummySchema()},
"multipart/form-data": {"schema": DummySchema()},
},
)
add_view(
query_schema=DummyQuerySchema(),
)
add_view(
responses_schema=responses_schema=DummyResponseSchema(),
)
add_view(
responses_schema={
"200": {
"content": {
"application/json": {"schema": responses_schema=DummyResponseSchema()}
}
}
)
render body from dumps of responses_schema
.
add_view(
responses_schema=responses_schema=DummyResponseSchema(),
renderer="apispec-schema",
)
rebecca.apispec
bundles swagger ui and hosts on /apispec.swaggerui
.
rebecca.apispec
hosts on /apispec.redoc
.