Skip to main content
Version: 1.1.1

Feature Comparison

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

Legend: ✓ Supported | ✗ Not supported | ~ Partial


Validation Basics

FeaturePedantigoPydanticValidatorDocsComment
Required fieldsValidation
Optional fieldsValidation
Default values (static)Constraints
Default values (dynamic)Validation
Field presence detectionInitialization
Zero vs missing distinction~Initializationvalidator: requires omitempty tag workaround

String Constraints

FeaturePedantigoPydanticValidatorDocsComment
Min/Max lengthString
Exact length~StringPydantic: use min_length=max_length; no direct len
EmailFormat
URLFormat
URIFormat
UUIDFormat
UUID3/UUID4/UUID5Format
Regex/PatternString
Enum/OneOfConstraints
Enum case-insensitiveConstraints
Alpha/AlphanumericString
ASCII onlyString
Multibyte charsString
Contains/ExcludesString
Starts/Ends withString
Case validationString
Strip whitespaceString
String transformString

Numeric Constraints

FeaturePedantigoPydanticValidatorDocsComment
Min/Max valueNumeric
Greater/Less thanNumeric
Greater/Less or equalNumeric
Multiple ofNumeric
Decimal precisionNumeric
Disallow inf/nanNumeric
Strict typesGo is statically typed; no coercion like Python's "123"123
Positive/NegativeNumeric

Format Validators

FeaturePedantigoPydanticValidatorStandardDocsComment
IPv4/IPv6net.ParseIPFormat
IP (any)net.ParseIPFormat
CIDRRFC 4632Format
CIDRv4/CIDRv6RFC 4632Format
MAC addressIEEE 802Format
HostnameRFC 952Format
Hostname RFC1123RFC 1123Format
FQDNDNS standardFormat
Port0-65535Format
TCP/UDP addressnet.ResolveTCPAddrFormat
HTTP URLRFC 3986Format
HTTPS URLRFC 3986Format
Credit cardISO/IEC 7812Format
Bitcoin addressBase58CheckFormat
Bitcoin Bech32BIP-0173Format
Ethereum addressEIP-55Format
ISBNISO 2108Format
ISBN-10/ISBN-13ISO 2108Format
ISSNISO 3297Format
SSNU.S. SSAFormat
EINU.S. IRSFormat
Phone (E.164)~ITU-T E.164FormatPydantic: has PhoneNumber type but requires phonenumbers lib
LatitudeWGS 84Format
LongitudeWGS 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
HTMLHTML5Format
JWT~RFC 7519FormatPydantic: no built-in; use custom validator
JSON stringRFC 8259Format
Base64RFC 4648Format
Base64URLRFC 4648 §5Format
Base64RawURLRFC 4648 §3.2Format
Base32RFC 4648 §6Format
Data URIRFC 2397Format
URN (RFC 2141)RFC 2141Format
MD4RFC 1320Format
MD5RFC 1321Format
SHA256/384/512FIPS 180-4Format
MongoDB IDObjectIdFormat
CronCron exprFormat
Semver~Semver 2.0FormatPydantic: no built-in; use custom validator
Datetime formatGo layoutFormat
Timezone (IANA)IANA tz databaseFormat
ULIDCrockfordFormat
Luhn checksumISO 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 codesPer-countryFormat

Collection Validation

FeaturePedantigoPydanticValidatorDocsComment
Array/Slice min/maxCollection
Element validation (dive)Collection
Map validationCollection
Map key validation (keys)Collection
Unique itemsCollection
Set typesGo has no built-in set type; use map[T]struct{} or slice with unique
Tuple typesGo has no tuple type; use structs for fixed heterogeneous sequences

Cross-Field Validation

FeaturePedantigoPydanticValidatorDocsComment
Struct-level validatorsCross-Field
Field comparisonsCross-Field
Cross-struct validationCross-Field
Conditional requiredCross-Field
Conditional required (all)Cross-Field
Conditional exclusionCross-Field
Conditional exclusion (all)Cross-Field
Before validatorsPydantic's @field_validator(mode='before'); use custom unmarshaler in Go
After validatorsCustom Validators
Wrap validatorsPydantic decorator pattern; not idiomatic in Go

Type Support

FeaturePedantigoPydanticValidatorDocsComment
PrimitivesValidation
Pointers/OptionalValidation
Nested structsValidation
Slices/ListsCollection
Maps/DictsCollection
time.Time/datetime~Validationvalidator: limited datetime support, use custom
time.DurationValidation
Secret typesSecrets
Path types~Formatvalidator: file constraint but limited path types
Literal typesPython type hint; use oneof constraint in Go
Union typesUnions
Discriminated unionsUnions
Generic structsGo 1.18+ generics exist; complex to support fully
Enum types~~ConstraintsGo has no native enum; all use oneof/iota workarounds
DecimalUse shopspring/decimal package if needed

JSON Operations

FeaturePedantigoPydanticValidatorDocsComment
Unmarshal + validateSimple API
Marshal to JSONSimple API
Marshal with field exclusionSimple API
Marshal with field selectionSimple 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 methodsGo supports this natively; Pedantigo uses its own marshal
Streaming JSONStreaming
Partial JSON repairComplex edge case

Schema Generation

FeaturePedantigoPydanticValidatorDocsComment
JSON SchemaSchema
OpenAPI ($ref)Schema
Schema cachingSchema
Schema examplesSchema
Schema titleSchema
Field descriptionsSchema
Deprecated fieldsSchema

Struct Configuration

FeaturePedantigoPydanticValidatorDocsComment
Strict modePydantic strict mode prevents type coercion ("123"123); Go is statically typed so N/A
Extra fields forbidInitialization
Extra fields allowInitialization
Extra fields ignoreInitialization
Validate on assignmentPython can override __setattr__; Go structs are plain data
Validate defaultsInitialization
ORM modePydantic-specific for SQLAlchemy; use GORM/sqlx directly in Go
Arbitrary typesPydantic allows any Python type; Go is statically typed
Immutable structsGo has no built-in immutability; use unexported fields + getters

Error Handling

FeaturePedantigoPydanticValidatorDocsComment
Multiple errorsErrors
Field pathsErrors
Custom messages~ErrorsPedantigo: custom constraints can return custom messages; no per-field override syntax
Error codesErrors
i18n/l10n~Internationalized messages; significant work to implement
Custom error typesGo supports this; could expose more customization

Custom Validation

FeaturePedantigoPydanticValidatorDocsComment
Custom validatorsCustom Validators
Validator registrationCustom Validators
Alias tags~Custom ValidatorsPydantic: uses AliasPath/AliasChoices for field name aliasing, not constraint aliasing
Validator contextCustom Validators
Struct-levelCustom Validators
Plugin systemPydantic plugin architecture; not idiomatic in Go

Advanced Features

FeaturePedantigoPydanticValidatorDocsComment
Type adaptersPydantic-specific for custom type coercion
Root modelsPydantic's RootModel for non-dict types; use slice/map directly in Go
Dataclass supportPython dataclasses; Go uses structs natively
Config managementPydantic-settings; use Viper/envconfig in Go
Environment variablesPydantic-settings; use os.Getenv or Viper in Go
Struct copyingPydantic's model_copy(); use manual copy or copier package in Go
Struct field reflectionPydantic's model_fields; use reflect package in Go
Recursive structsValidation

Summary

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

CategoryCoverage
Validation Basics6/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