Skip to content

cornice-apispec

OpenAPI 3 spec generation for Cornice and Pyramid services, with Marshmallow and marshmallow-oneofschema support.

You describe each view with pcm_* view predicates. The package walks the Pyramid introspector, builds one OpenAPI document per API version, and serves it at /{version}/openapi.json with an API explorer at /{version}/api-explorer.

Why this fork

cornice-apispec is a fork of pycornmarsh. It fixes OneOfSchema component name collisions.

When several API versions define schemas with the same class name, such as v1.PartSchema and v3.PartSchema, both resolve to the same component name. apispec then raises DuplicateComponentNameError.

OneofOpenAPIConverter detects the collision and qualifies the later name with the version taken from the schema's module path, for example V3PartSchema. See OneOfSchema collisions for the details.

Installation

pip install cornice-apispec

Requires Python 3.11 or newer.

Next steps