What problem does it solve?
This Skill ensures your API schemas are secure, accurate, and maintainable by enforcing best practices for Pydantic V2 model configuration, preventing common pitfalls like data leaks and mass-assignment vulnerabilities.
Core Features & Use Cases
- Response Model Enforcement: Guarantees that API responses are strictly defined and filtered, protecting sensitive data.
- Absent-Over-Null Compliance: Configures responses to omit null fields, leading to cleaner and more compact data transfer.
- Polymorphism: Enables clear definition of complex, varied response structures using OpenAPI's
oneOf with Pydantic's Discriminator.
- Alias Generation: Manages API wire format conventions (e.g., camelCase) while maintaining Pythonic snake_case in the codebase.
- Model Naming Conventions: Enforces a standardized naming pattern for API models (
ResourceCreate, ResourceResponse, etc.) for clarity and consistency.
- Use Case: Reviewing a new Pydantic model for an API endpoint to ensure it adheres to security standards, uses correct naming conventions, and generates an accurate OpenAPI schema.
Quick Start
Use the governing-schema-implementation skill to audit the Pydantic models in the 'models/' directory for adherence to response model enforcement and naming conventions.