Skip to content

Releases: BRIKEV/openapi-mock-validator

v0.2.0

20 Apr 18:49
7a9172e

Choose a tag to compare

Features

  • content-type: Add optional contentType to ValidatorOptions for validateResponse and validateRequest. Defaults to application/json (backwards compatible). Media-type resolution order is exact match → family wildcard (image/*) → */*. Unmatched binary content types (image/*, video/*, audio/*, application/octet-stream, application/pdf, application/zip) are silently bypassed — no more false-positive MISSING_SCHEMA warnings when a mock returns binary data like a QR code.

Internal

  • normalize: normalizeAllSchemas now rewrites OpenAPI 3.0 → 3.1 schemas under every media-type entry in content, not only application/json. Previously, schemas declared under e.g. multipart/form-data or image/jpeg missed the rewrite and could throw at validation time.

Full Changelog: v0.1.4...v0.2.0

v0.1.4

08 Apr 13:36

Choose a tag to compare

Bug Fixes

  • error messages: Include property names in required and additionalProperties error messages. Instead of unexpected property, unexpected property you now get unexpected property "foo", unexpected property "bar" — making composition error summaries actually actionable.

Full Changelog: v0.1.3...v0.1.4

v0.1.3

07 Apr 11:12

Choose a tag to compare

Features

  • Descriptive oneOf/anyOf error messages: Instead of the generic "does not match any allowed schema", errors now identify the best-matching branch and its specific sub-errors.
    • Discriminator resolution: When the schema declares a discriminator, errors pinpoint the matched branch:
      oneOf matched branch "card" (via discriminator "type"), but: unexpected property
    • Best-match fallback: When no discriminator is present, picks the branch with the fewest errors:
      anyOf best match (branch 1 of 2) failed: expected number, got string
    • Works with nested compositions (oneOf inside allOf), array items, and nullable schemas

Full Changelog: v0.1.2...v0.1.3

v0.1.2

06 Apr 17:36

Choose a tag to compare

Bug Fixes

  • strict mode: Fix false positives when validating oneOf schemas with allOf composition. Strict mode was applying additionalProperties: false to each allOf branch independently, causing sibling properties to be rejected as unexpected. Now merges property keys across allOf branches before applying strict constraints.

v0.1.1

06 Apr 11:33

Choose a tag to compare

Bug Fixes

  • normalize: Handle nullable: true without type in OpenAPI 3.0 schemas. Schemas using nullable on allOf compositions or bare description objects were not being normalized, causing Ajv to throw "nullable" cannot be used without "type".

Maintenance

  • Regenerate package-lock.json for cross-platform compatibility

Full Changelog: v0.1.0...v0.1.1

v0.1.0

02 Apr 18:14

Choose a tag to compare

Initial release

OpenAPI 3.0/3.1 mock validator — validates JSON payloads against OpenAPI specs to catch mock drift before it hits production.

Features

  • Validate response and request payloads against OpenAPI 3.0 and 3.1 specs
  • Automatic $ref dereferencing and 3.0 → 3.1 normalization (nullable, exclusiveMin/Max)
  • URL path matching with parameter support (/users/{userId})
  • Humanized error messages (missing required property, must be one of: ..., collapsed oneOf errors)
  • Strict mode with additionalProperties: false injection
  • Format validation via ajv-formats (uuid, email, date-time, uri, ipv4, ipv6, etc.)
  • Reusable Ajv instance for fast bulk validation