Skip to content

Releases: BRIKEV/openapi-mock-validator

v0.3.0

Choose a tag to compare

@kevinccbsg kevinccbsg released this 08 May 21:00
27bb5fe

Internal

  • deps: Bump runtime and dev dependencies. Notably crosses ajv-formats v2 → v3. The only behavioral change in v3 is that the date-time and time formats now require a timezone per RFC3339 — strings like "2024-04-15T00:00:00" (no Z / offset) will now fail validation. Use the new iso-time / iso-date-time formats to opt back into the v2 behavior.
  • security: Bumping ajv to ^8.20.0 closes the high-severity fast-uri advisories (GHSA-q3j6-qgpj-74h6, GHSA-v39h-62p7-jpjc) pulled in transitively.
package from to
ajv ^8.18.0 ^8.20.0
ajv-formats ^2.1.1 ^3.0.1
@apidevtools/json-schema-ref-parser ^15.3.4 ^15.3.5
path-to-regexp ^8.4.0 ^8.4.2
vitest ^4.1.2 ^4.1.5
@vitest/coverage-v8 ^4.1.2 ^4.1.5

Full Changelog: v0.2.0...v0.3.0

v0.2.0

Choose a tag to compare

@kevinccbsg kevinccbsg released this 20 Apr 18:49
7a9172e

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

Choose a tag to compare

@kevinccbsg kevinccbsg released this 08 Apr 13:36

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

Choose a tag to compare

@kevinccbsg kevinccbsg released this 07 Apr 11:12

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

Choose a tag to compare

@kevinccbsg kevinccbsg released this 06 Apr 17:36

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

Choose a tag to compare

@kevinccbsg kevinccbsg released this 06 Apr 11:33

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

Choose a tag to compare

@kevinccbsg kevinccbsg released this 02 Apr 18:14

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