Skip to content

fix: update validation tests for comparison rules and adjust schema definitions#12

Open
BaoDuong254 wants to merge 1 commit into
TickLabVN:mainfrom
BaoDuong254:fix/comparison-validators
Open

fix: update validation tests for comparison rules and adjust schema definitions#12
BaoDuong254 wants to merge 1 commit into
TickLabVN:mainfrom
BaoDuong254:fix/comparison-validators

Conversation

@BaoDuong254
Copy link
Copy Markdown

@BaoDuong254 BaoDuong254 commented May 17, 2026

Description

Implement missing comparison validator constraints and fix incorrect schema generation for eq_ignore_case, ne, ne_ignore_case, gt, gte, lt, and lte validate tags.

  • Fix eq_ignore_case validator to generate a case-insensitive pattern instead of enum.
  • Fix ne validator to generate not: { enum: [...] } for integer, number, string, boolean, and array types.
  • Fix ne_ignore_case validator to generate not: { pattern: "^(?i)(...)$" } instead of incorrect schema.
  • Implement gt/gte validators to generate minimum with exclusiveMinimum for integers/numbers, minLength for strings, and minItems for arrays.
  • Implement lt/lte validators to generate maximum with exclusiveMaximum for integers/numbers, maxLength for strings, and maxItems for arrays.
  • Add Not *SchemaObject field to SchemaObject to support the OpenAPI not keyword.
  • Fix root cause of minimum/maximum never being serialized: Number and Integer embedded structs had conflicting JSON field names, causing encoding/json to silently drop both fields — resolved by moving minimum, maximum, exclusiveMinimum, and exclusiveMaximum directly onto SchemaObject.
  • Fix stray u character syntax error in validate_comparision_test.go.
  • Fix incorrect test expectation: lte=5 on string should produce maxLength: 5, not 6.
  • Fix inconsistent test expectation: float64 format should be "float64" not "double" to match existing behavior.

Type of change

  • 🐛 Bug fix
  • ✨ New feature
  • 🧹 Code cleanup / refactor
  • 📚 Documentation update
  • ⚙️ Other (please specify):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant