Skip to main content
Version: Next

Feature Comparison

How Pedantigo compares to Pydantic v2 and go-playground/validator v10.

Legend: ✓ Supported | ✗ Not supported | ~ Partial


Validation Basics​

FeaturePedantigoPydanticValidatorDocsComment
Required fields✓✓✓Validation
Optional fields✓✓✓Validation
Default values (static)✓✓✗Constraints
Default values (dynamic)✗✓✗—Pedantigo only supports static default=VALUE; no factory/function-based defaults
Field presence detection✓✓✓Initialization
Zero vs missing distinction✓✓~Initializationvalidator: requires omitempty tag workaround

String Constraints​

FeaturePedantigoPydanticValidatorDocsComment
Min/Max length✓✓✓String
Exact length✓~✓StringPydantic: use min_length=max_length; no direct len
Email✓✓✓Format
URL✓✓✓Format
URI✓✗✓Format
UUID✓✓✓Format
UUID3/UUID4/UUID5✓✗✓Format
Regex/Pattern✓✓✓String
Enum/OneOf✓✓✓Constraints
Enum case-insensitive✓✗✓Constraints
Alpha/Alphanumeric✓✗✓String
ASCII only✓✗✓String
Multibyte chars✓✗✓String
Contains/Excludes✓✗✓String
Starts/Ends with✓✗✓String
Case validation✓✗✓String
Strip whitespace✓✓✗String
String transform✓✓✗String

Numeric Constraints​

FeaturePedantigoPydanticValidatorDocsComment
Min/Max value✓✓✓Numeric
Greater/Less than✓✓✓Numeric
Greater/Less or equal✓✓✓Numeric
Multiple of✓✓✗Numeric
Decimal precision✓✓✗Numeric
Disallow inf/nan✓✓✗Numeric
Strict types✗✓✗—Go is statically typed; no coercion like Python's "123" → 123
Positive/Negative✓✓✗Numeric

Format Validators​

FeaturePedantigoPydanticValidatorStandardDocsComment
IPv4/IPv6✓✓✓net.ParseIPFormat
IP (any)✓✓✓net.ParseIPFormat
CIDR✓✓✓RFC 4632Format
CIDRv4/CIDRv6✓✓✓RFC 4632Format
MAC address✓✗✓IEEE 802Format
Hostname✓✗✓RFC 952Format
Hostname RFC1123✓✗✓RFC 1123Format
FQDN✓✗✓DNS standardFormat
Port✓✗✓0-65535Format
TCP/UDP address✓✗✓net.ResolveTCPAddrFormat
HTTP URL✓✗✓RFC 3986Format
HTTPS URL✓✗✓RFC 3986Format
Credit card✓✓✓ISO/IEC 7812Format
Bitcoin address✓✗✓Base58CheckFormat
Bitcoin Bech32✓✗✓BIP-0173Format
Ethereum address✓✗✓EIP-55Format
ISBN✓✗✓ISO 2108Format
ISBN-10/ISBN-13✓✗✓ISO 2108Format
ISSN✓✗✓ISO 3297Format
SSN✓✗✓U.S. SSAFormat
EIN✓✗✓U.S. IRSFormat
Phone (E.164)✓~✓ITU-T E.164FormatPydantic: has PhoneNumber type but requires phonenumbers lib
Latitude✓✗✓WGS 84Format
Longitude✓✗✓WGS 84Format
Hex color✓~✓CSS ColorFormatPydantic: has Color type but not individual validators
RGB/RGBA✓~✓CSS ColorFormatPydantic: has Color type but not individual validators
HSL/HSLA✓~✓CSS ColorFormatPydantic: has Color type but not individual validators
iscolor (alias)✓✗✓Any colorFormat
HTML✓✗✓HTML5Format
JWT✓~✓RFC 7519FormatPydantic: no built-in; use custom validator
JSON string✓✓✓RFC 8259Format
Base64✓✓✓RFC 4648Format
Base64URL✓✓✓RFC 4648 §5Format
Base64RawURL✓✗✓RFC 4648 §3.2Format
Base32✓✗✓RFC 4648 §6Format
Data URI✓✗✓RFC 2397Format
URN (RFC 2141)✓✗✓RFC 2141Format
MD4✓✗✓RFC 1320Format
MD5✓✗✓RFC 1321Format
SHA256/384/512✓✗✓FIPS 180-4Format
MongoDB ID✓✗✓ObjectIdFormat
Cron✓✗✓Cron exprFormat
Semver✓~✓Semver 2.0FormatPydantic: no built-in; use custom validator
Datetime format✓✓✓Go layoutFormat
Timezone (IANA)✓✗✓IANA tz databaseFormat
ULID✓✗✓CrockfordFormat
Luhn checksum✓✗✓ISO 7812Format
Country codes✓~✓ISO 3166-1FormatPydantic: no built-in; use pycountry lib
Currency codes✓~✓ISO 4217FormatPydantic: no built-in; use pycountry lib
Language codes✓~✓BCP 47FormatPydantic: no built-in; use langcodes lib
Postal codes✓✗✓Per-countryFormat

Collection Validation​

FeaturePedantigoPydanticValidatorDocsComment
Array/Slice min/max✓✓✓Collection
Element validation (dive)✓✓✓Collection
Map validation✓✓✓Collection
Map key validation (keys)✓✓✓Collection
Unique items✓✓✓Collection
Set types✗✓✗—Go has no built-in set type; use map[T]struct{} or slice with unique
Tuple types✗✓✗—Go has no tuple type; use structs for fixed heterogeneous sequences

Cross-Field Validation​

FeaturePedantigoPydanticValidatorDocsComment
Struct-level validators✓✓✓Cross-Field
Field comparisons✓✓✓Cross-Field
Cross-struct validation✓✓✓Cross-Field
Conditional required✓✓✓Cross-Field
Conditional required (all)✓✗✓Cross-Field
Conditional exclusion✓✓✓Cross-Field
Conditional exclusion (all)✓✗✓Cross-Field
Before validators✗✓✗—Pydantic's @field_validator(mode='before'); use custom unmarshaler in Go
After validators✓✓✗Custom Validators
Wrap validators✗✓✗—Pydantic decorator pattern; not idiomatic in Go

Type Support​

FeaturePedantigoPydanticValidatorDocsComment
Primitives✓✓✓Validation
Pointers/Optional✓✓✓Validation
Nested structs✓✓✓Validation
Slices/Lists✓✓✓Collection
Maps/Dicts✓✓✓Collection
time.Time/datetime✓✓~Validationvalidator: limited datetime support, use custom
time.Duration✓✓✗Validation
Secret types✓✓✗Secrets
Path types✓✓~Formatvalidator: file constraint but limited path types
Literal types✗✓✗—Python type hint; use oneof constraint in Go
Union types✓✓✗Unions
Discriminated unions✓✓✗Unions
Generic structs✗✓✗—Go 1.18+ generics exist; complex to support fully
Enum types~✓~ConstraintsGo has no native enum; all use oneof/iota workarounds
Decimal✗✓✗—Use shopspring/decimal package if needed

JSON Operations​

FeaturePedantigoPydanticValidatorDocsComment
Unmarshal + validate✓✓✗Simple API
Marshal to JSON✓✓✗Simple API
Marshal with field exclusion✓✓✗Simple API
Marshal with field selection✓✓✗Simple API
Marshal omitting zero values✓✓~Simple APIvalidator: uses standard omitempty json tag
Marshal using JSON tags~✓✓Simple APIPedantigo: respects json tag names but uses own marshal (doesn't call custom MarshalJSON)
Custom MarshalJSON methods✗✓✓—Go supports this natively; Pedantigo uses its own marshal
Streaming JSON✓✗✗Streaming
Partial JSON repair✗✗✗—Complex edge case

Schema Generation​

FeaturePedantigoPydanticValidatorDocsComment
JSON Schema✓✓✗Schema
OpenAPI ($ref)✓✓✗Schema
Schema caching✓✓✗Schema
Schema examples✓✓✗Schema
Schema title✓✓✗Schema
Field descriptions✓✓✗Schema
Deprecated fields✓✓✗Schema

Struct Configuration​

FeaturePedantigoPydanticValidatorDocsComment
Strict mode✗✓✗—Pydantic strict mode prevents type coercion ("123" → 123); Go is statically typed so N/A
Extra fields forbid✓✓✗Initialization
Extra fields allow✓✓✗Initialization
Extra fields ignore✓✓✗Initialization
Validate on assignment✗✓✗—Python can override __setattr__; Go structs are plain data
Validate defaults✓✓✗Initialization
ORM mode✗✓✗—Pydantic-specific for SQLAlchemy; use GORM/sqlx directly in Go
Arbitrary types✗✓✗—Pydantic allows any Python type; Go is statically typed
Immutable structs✗✓✗—Go has no built-in immutability; use unexported fields + getters

Error Handling​

FeaturePedantigoPydanticValidatorDocsComment
Multiple errors✓✓✓Errors
Field paths✓✓✓Errors
Custom messages~✓✓ErrorsPedantigo: custom constraints can return custom messages; no per-field override syntax
Error codes✓✓✗Errors
i18n/l10n✗~✓—Internationalized messages; significant work to implement
Custom error types✗✓✗—Go supports this; could expose more customization

Custom Validation​

FeaturePedantigoPydanticValidatorDocsComment
Custom validators✓✓✓Custom Validators
Validator registration✓✓✓Custom Validators
Alias tags✓~✓Custom ValidatorsPydantic: uses AliasPath/AliasChoices for field name aliasing, not constraint aliasing
Validator context✓✓✓Custom Validators
Struct-level✓✓✓Custom Validators
Plugin system✗✓✗—Pydantic plugin architecture; not idiomatic in Go

Advanced Features​

FeaturePedantigoPydanticValidatorDocsComment
Type adapters✗✓✗—Pydantic-specific for custom type coercion
Root models✗✓✗—Pydantic's RootModel for non-dict types; use slice/map directly in Go
Dataclass support✗✓✗—Python dataclasses; Go uses structs natively
Config management✗✓✗—Pydantic-settings; use Viper/envconfig in Go
Environment variables✗✓✗—Pydantic-settings; use os.Getenv or Viper in Go
Struct copying✗✓✗—Pydantic's model_copy(); use manual copy or copier package in Go
Struct field reflection✗✓✗—Pydantic's model_fields; use reflect package in Go
Recursive structs✓✓✓Validation

Summary​

126/147 features — Full parity with go-playground/validator. Strong parity with Pydantic v2 for features applicable to Go's type system.

CategoryCoverage
Validation Basics5/6
String Constraints16/16
Numeric Constraints7/8
Format Validators46/46
Collection Validation5/7
Cross-Field Validation7/10
Type Support12/15
JSON Operations7/9
Schema Generation7/7
Struct Configuration4/9
Error Handling4/6
Custom Validation5/6
Advanced Features1/8

Get Started​