Releases: BRIKEV/openapi-mock-validator
Releases · BRIKEV/openapi-mock-validator
v0.2.0
Features
- content-type: Add optional
contentTypetoValidatorOptionsforvalidateResponseandvalidateRequest. Defaults toapplication/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-positiveMISSING_SCHEMAwarnings when a mock returns binary data like a QR code.
Internal
- normalize:
normalizeAllSchemasnow rewrites OpenAPI 3.0 → 3.1 schemas under every media-type entry incontent, not onlyapplication/json. Previously, schemas declared under e.g.multipart/form-dataorimage/jpegmissed the rewrite and could throw at validation time.
Full Changelog: v0.1.4...v0.2.0
v0.1.4
Bug Fixes
- error messages: Include property names in
requiredandadditionalPropertieserror messages. Instead ofunexpected property, unexpected propertyyou now getunexpected property "foo", unexpected property "bar"— making composition error summaries actually actionable.
Full Changelog: v0.1.3...v0.1.4
v0.1.3
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
- Discriminator resolution: When the schema declares a
Full Changelog: v0.1.2...v0.1.3
v0.1.2
Bug Fixes
- strict mode: Fix false positives when validating
oneOfschemas withallOfcomposition. Strict mode was applyingadditionalProperties: falseto eachallOfbranch independently, causing sibling properties to be rejected as unexpected. Now merges property keys acrossallOfbranches before applying strict constraints.
v0.1.1
Bug Fixes
- normalize: Handle
nullable: truewithouttypein OpenAPI 3.0 schemas. Schemas usingnullableonallOfcompositions or bare description objects were not being normalized, causing Ajv to throw"nullable" cannot be used without "type".
Maintenance
- Regenerate
package-lock.jsonfor cross-platform compatibility
Full Changelog: v0.1.0...v0.1.1
v0.1.0
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
$refdereferencing 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: falseinjection - Format validation via
ajv-formats(uuid, email, date-time, uri, ipv4, ipv6, etc.) - Reusable Ajv instance for fast bulk validation