Skip to content

Additional validation cases that could be typed (follow-up to #1187) #1188

@reuvenharrison

Description

@reuvenharrison

Follow-up to #1187, which typed every fmt.Errorf inside every Validate function in the openapi3 package. During that sweep I noted adjacent untyped sites; this records the ones that are genuinely spec Validate() errors and could benefit from typed clusters in a future PR. Not a prioritization signal.

Scope (trimmed). This now covers only errors raised from Validate() on the spec. An earlier version of this issue also listed loader $ref errors (loader.go), the JSON-Schema-compilation and value-validation paths (schema_jsonschema_validator.go, the schema.go value checks), and the NewRegexpFormatValidator constructor panic. Those are dropped: they fire during loading, during runtime value validation, or (for the constructor) at setup time, not during spec validation, so they never surface as Validate() findings and a typed cluster there wouldn't be reachable via the Validate() errors.As walk.

Candidates (spec validation only)

Each entry: current bare error → proposed typed cluster.

  • Duplicate value in enum: [...]EnumDuplicateValueError{Value}
  • Duplicate entry in required: [...]RequiredFieldDuplicatedError{Field}
  • oneOf / anyOf / allOf element validation failure → SchemaCombinatorElementValidationError{Combinator, Cause} (context wrapper)
  • tags element validation failure → TagInvalidError{Cause} (context wrapper)

Notes

  • All Error() strings can be preserved byte-for-byte, following the same backward-compat pattern as openapi3: type the remaining bare-error validation sites #1187.
  • The four-category model (Base / Cluster / Leaf / Context wrapper) documented in validation_error.go and validation_error_context.go applies.
  • No ordering implied; these are candidates, ranked however the maintainers prefer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions