pyramid_jsonapi.metadata.OpenAPI package¶
Module contents¶
Generate OpenAPI documentation from Models, Schema and Endpoint info.
This module provides 2 metadata
views:
OpenAPI
- the Swagger UI.OpenAPI/specification
- the project OpenAPI specification (JSON).
Configuration¶
The config option openapi_file
can be used to provide a JSON or YAML
file which will be used to update the dynamically generated documentation.
Metadata for the OpenAPI documentation will be extracted from the PKG-INFO
data provided with the pyramid package that is using pyramid_jsonapi
,
using the pkginfo
module. This requires that the pyramid package can be
located in the python path (i.e it can be imported).
Documentation is dynamically generated from several sources:
Endpoint data -> endpoints, parameters, request and response content.
Model docstrings -> endpoint descriptions.
sqlalchemy columns -> schemas (via JSONSchema module).
- class pyramid_jsonapi.metadata.OpenAPI.OpenAPI(api)[source]¶
Bases:
object
Auto-generate OpenAPI documentation.
- static build_content(schema, description='', mediatype='application/vnd.api+json')[source]¶
Construct a content dictionary for a given schema.
- openapi_spec(request=None)[source]¶
Return the OpenAPI specification dict (as a pyramid view).
- Parameters
request (optional) – Pyramid Request object.
- Returns
OpenAPI template document.