61 lines
1.5 KiB
Go
61 lines
1.5 KiB
Go
package persona
|
|
|
|
// ValidateOption configures validation behavior.
|
|
type ValidateOption func(*validateConfig)
|
|
|
|
type validateConfig struct {
|
|
strictMode bool
|
|
allowRareFeatures bool
|
|
skipPlausibility bool
|
|
skipConsistency bool
|
|
skipMorphology bool
|
|
}
|
|
|
|
func defaultValidateConfig() *validateConfig {
|
|
return &validateConfig{
|
|
strictMode: false,
|
|
allowRareFeatures: false,
|
|
skipPlausibility: false,
|
|
skipConsistency: false,
|
|
skipMorphology: false,
|
|
}
|
|
}
|
|
|
|
// WithStrictMode enables strict validation that fails on warnings.
|
|
// By default, only errors cause validation to fail.
|
|
func WithStrictMode() ValidateOption {
|
|
return func(c *validateConfig) {
|
|
c.strictMode = true
|
|
}
|
|
}
|
|
|
|
// WithAllowRareFeatures allows rare but possible feature combinations.
|
|
// By default, rare features (< 1% probability) are treated as errors.
|
|
func WithAllowRareFeatures() ValidateOption {
|
|
return func(c *validateConfig) {
|
|
c.allowRareFeatures = true
|
|
}
|
|
}
|
|
|
|
// WithSkipPlausibility skips ethnicity plausibility checks.
|
|
// Use this for fantasy characters that don't need realistic features.
|
|
func WithSkipPlausibility() ValidateOption {
|
|
return func(c *validateConfig) {
|
|
c.skipPlausibility = true
|
|
}
|
|
}
|
|
|
|
// WithSkipConsistency skips cross-attribute consistency checks.
|
|
func WithSkipConsistency() ValidateOption {
|
|
return func(c *validateConfig) {
|
|
c.skipConsistency = true
|
|
}
|
|
}
|
|
|
|
// WithSkipMorphology skips humanoid morphology validation.
|
|
func WithSkipMorphology() ValidateOption {
|
|
return func(c *validateConfig) {
|
|
c.skipMorphology = true
|
|
}
|
|
}
|