How Pedantigo compares to Pydantic v2 and go-playground/validator v10.
Legend: ✓ Supported | ✗ Not supported | ~ Partial
Validation Basics
String Constraints
Numeric Constraints
| Feature | Pedantigo | Pydantic | Validator | Docs | Comment |
|---|
| 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 | |
| Feature | Pedantigo | Pydantic | Validator | Standard | Docs | Comment |
|---|
| IPv4/IPv6 | ✓ | ✓ | ✓ | net.ParseIP | Format | |
| IP (any) | ✓ | ✓ | ✓ | net.ParseIP | Format | |
| CIDR | ✓ | ✓ | ✓ | RFC 4632 | Format | |
| CIDRv4/CIDRv6 | ✓ | ✓ | ✓ | RFC 4632 | Format | |
| MAC address | ✓ | ✗ | ✓ | IEEE 802 | Format | |
| Hostname | ✓ | ✗ | ✓ | RFC 952 | Format | |
| Hostname RFC1123 | ✓ | ✗ | ✓ | RFC 1123 | Format | |
| FQDN | ✓ | ✗ | ✓ | DNS standard | Format | |
| Port | ✓ | ✗ | ✓ | 0-65535 | Format | |
| TCP/UDP address | ✓ | ✗ | ✓ | net.ResolveTCPAddr | Format | |
| HTTP URL | ✓ | ✗ | ✓ | RFC 3986 | Format | |
| HTTPS URL | ✓ | ✗ | ✓ | RFC 3986 | Format | |
| Credit card | ✓ | ✓ | ✓ | ISO/IEC 7812 | Format | |
| Bitcoin address | ✓ | ✗ | ✓ | Base58Check | Format | |
| Bitcoin Bech32 | ✓ | ✗ | ✓ | BIP-0173 | Format | |
| Ethereum address | ✓ | ✗ | ✓ | EIP-55 | Format | |
| ISBN | ✓ | ✗ | ✓ | ISO 2108 | Format | |
| ISBN-10/ISBN-13 | ✓ | ✗ | ✓ | ISO 2108 | Format | |
| ISSN | ✓ | ✗ | ✓ | ISO 3297 | Format | |
| SSN | ✓ | ✗ | ✓ | U.S. SSA | Format | |
| EIN | ✓ | ✗ | ✓ | U.S. IRS | Format | |
| Phone (E.164) | ✓ | ~ | ✓ | ITU-T E.164 | Format | Pydantic: has PhoneNumber type but requires phonenumbers lib |
| Latitude | ✓ | ✗ | ✓ | WGS 84 | Format | |
| Longitude | ✓ | ✗ | ✓ | WGS 84 | Format | |
| Hex color | ✓ | ~ | ✓ | CSS Color | Format | Pydantic: has Color type but not individual validators |
| RGB/RGBA | ✓ | ~ | ✓ | CSS Color | Format | Pydantic: has Color type but not individual validators |
| HSL/HSLA | ✓ | ~ | ✓ | CSS Color | Format | Pydantic: has Color type but not individual validators |
| iscolor (alias) | ✓ | ✗ | ✓ | Any color | Format | |
| HTML | ✓ | ✗ | ✓ | HTML5 | Format | |
| JWT | ✓ | ~ | ✓ | RFC 7519 | Format | Pydantic: no built-in; use custom validator |
| JSON string | ✓ | ✓ | ✓ | RFC 8259 | Format | |
| Base64 | ✓ | ✓ | ✓ | RFC 4648 | Format | |
| Base64URL | ✓ | ✓ | ✓ | RFC 4648 §5 | Format | |
| Base64RawURL | ✓ | ✗ | ✓ | RFC 4648 §3.2 | Format | |
| Base32 | ✓ | ✗ | ✓ | RFC 4648 §6 | Format | |
| Data URI | ✓ | ✗ | ✓ | RFC 2397 | Format | |
| URN (RFC 2141) | ✓ | ✗ | ✓ | RFC 2141 | Format | |
| MD4 | ✓ | ✗ | ✓ | RFC 1320 | Format | |
| MD5 | ✓ | ✗ | ✓ | RFC 1321 | Format | |
| SHA256/384/512 | ✓ | ✗ | ✓ | FIPS 180-4 | Format | |
| MongoDB ID | ✓ | ✗ | ✓ | ObjectId | Format | |
| Cron | ✓ | ✗ | ✓ | Cron expr | Format | |
| Semver | ✓ | ~ | ✓ | Semver 2.0 | Format | Pydantic: no built-in; use custom validator |
| Datetime format | ✓ | ✓ | ✓ | Go layout | Format | |
| Timezone (IANA) | ✓ | ✗ | ✓ | IANA tz database | Format | |
| ULID | ✓ | ✗ | ✓ | Crockford | Format | |
| Luhn checksum | ✓ | ✗ | ✓ | ISO 7812 | Format | |
| Country codes | ✓ | ~ | ✓ | ISO 3166-1 | Format | Pydantic: no built-in; use pycountry lib |
| Currency codes | ✓ | ~ | ✓ | ISO 4217 | Format | Pydantic: no built-in; use pycountry lib |
| Language codes | ✓ | ~ | ✓ | BCP 47 | Format | Pydantic: no built-in; use langcodes lib |
| Postal codes | ✓ | ✗ | ✓ | Per-country | Format | |
Collection Validation
| Feature | Pedantigo | Pydantic | Validator | Docs | Comment |
|---|
| 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
| Feature | Pedantigo | Pydantic | Validator | Docs | Comment |
|---|
| 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
| Feature | Pedantigo | Pydantic | Validator | Docs | Comment |
|---|
| Primitives | ✓ | ✓ | ✓ | Validation | |
| Pointers/Optional | ✓ | ✓ | ✓ | Validation | |
| Nested structs | ✓ | ✓ | ✓ | Validation | |
| Slices/Lists | ✓ | ✓ | ✓ | Collection | |
| Maps/Dicts | ✓ | ✓ | ✓ | Collection | |
| time.Time/datetime | ✓ | ✓ | ~ | Validation | validator: limited datetime support, use custom |
| time.Duration | ✓ | ✓ | ✗ | Validation | |
| Secret types | ✓ | ✓ | ✗ | Secrets | |
| Path types | ✓ | ✓ | ~ | Format | validator: 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 | ~ | ✓ | ~ | Constraints | Go has no native enum; all use oneof/iota workarounds |
| Decimal | ✗ | ✓ | ✗ | — | Use shopspring/decimal package if needed |
JSON Operations
| Feature | Pedantigo | Pydantic | Validator | Docs | Comment |
|---|
| 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 API | validator: uses standard omitempty json tag |
| Marshal using JSON tags | ~ | ✓ | ✓ | Simple API | Pedantigo: 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
Struct Configuration
| Feature | Pedantigo | Pydantic | Validator | Docs | Comment |
|---|
| 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
| Feature | Pedantigo | Pydantic | Validator | Docs | Comment |
|---|
| Multiple errors | ✓ | ✓ | ✓ | Errors | |
| Field paths | ✓ | ✓ | ✓ | Errors | |
| Custom messages | ~ | ✓ | ✓ | Errors | Pedantigo: 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
Advanced Features
| Feature | Pedantigo | Pydantic | Validator | Docs | Comment |
|---|
| 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
127/147 features — Full parity with go-playground/validator. Strong parity with Pydantic v2 for features applicable
to Go's type system.
| Category | Coverage |
|---|
| Validation Basics | 6/6 |
| String Constraints | 16/16 |
| Numeric Constraints | 7/8 |
| Format Validators | 46/46 |
| Collection Validation | 5/7 |
| Cross-Field Validation | 7/10 |
| Type Support | 12/15 |
| JSON Operations | 7/9 |
| Schema Generation | 7/7 |
| Struct Configuration | 4/9 |
| Error Handling | 4/6 |
| Custom Validation | 5/6 |
| Advanced Features | 1/8 |
Get Started