pydantic-v2-patterns

Official

Advanced Pydantic v2 implementation patterns.

Authorflext-sh
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This Skill provides in-depth guidance and reusable patterns for advanced Pydantic v2 implementations, ensuring robust data modeling and validation within the FLEXT ecosystem.

Core Features & Use Cases

  • Advanced Validation: Implement complex validation logic using field_validator and model_validator.
  • Data Serialization: Define custom serialization logic for various data types and formats.
  • Discriminated Unions: Utilize discriminated unions for robust runtime polymorphism.
  • Strict Mode & TypeAdapter: Enforce strict data contracts and handle dynamic runtime validation.
  • Use Case: When defining complex API request or response models that require intricate validation rules, custom data transformations, or polymorphic behavior, these patterns ensure correctness and maintainability.

Quick Start

Apply the reusable annotated alias pattern for string stripping and non-empty validation to a new Pydantic model.

Dependency Matrix

Required Modules

None required

Components

references

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: pydantic-v2-patterns
Download link: https://github.com/flext-sh/flext/archive/main.zip#pydantic-v2-patterns

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.