API Reference
pyramid_capstone
¶
Pyramid Capstone
A FastAPI-like decorator system for Pyramid that automatically handles validation and serialization using Marshmallow schemas and Cornice services.
Usage
from pyramid_capstone import th_api
@th_api.get('/users/{user_id}') def get_user(request, user_id: int) -> UserResponse: return UserResponse(id=user_id, name="John")
ParameterConflictError
¶
Bases: TypeHintedAPIError
Raised when there are conflicting parameter names between different sources.
This typically occurs during setup when the same parameter name appears in multiple places (e.g., both path and query parameters).
ParameterMissingError
¶
Bases: TypeHintedAPIError
Raised when a required parameter is missing from the request.
This occurs at runtime when a function requires a parameter that is not provided in the request.
SchemaGenerationError
¶
Bases: TypeHintedAPIError
Raised when automatic schema generation fails.
This can occur when type hints are not supported or when there are issues converting types to Marshmallow fields.
ServiceRegistrationError
¶
Bases: TypeHintedAPIError
Raised when there are issues registering a Cornice service.
This typically occurs during setup when the service configuration is invalid or conflicts with existing services.
TypeHintedAPIError
¶
Bases: Exception
Base exception for all type-hinted API errors.
includeme(config)
¶
Pyramid includeme function for pyramid-capstone.
This function is called when the library is included via config.include(). It sets up any necessary configuration for the library.