Skip to content

v14.1.0

Choose a tag to compare

@GianfrancoFrau GianfrancoFrau released this 21 Nov 10:54
· 1 commit to master since this release

πŸŽ‰ What's New in v14.1.0

This release adds complete OpenAPI 3.1.0 support while maintaining 100% backward compatibility with existing code.

✨ Major Features

1. OpenAPI 3.1.0 Full Support

  • βœ… Upgraded from OpenAPI 3.0.2 to 3.1.0
  • βœ… Complete JSON Schema Draft 2020-12 support
  • βœ… jsonSchemaDialect property added to OpenAPI documents
  • βœ… All OpenAPI 3.1 features available

2. Backward Compatibility Layer

  • βœ… JSON_SCHEMA_DRAFT_7 alias maintains compatibility with existing code
  • βœ… No breaking changes - existing code continues to work
  • βœ… Gradual migration path available
  • βœ… Legacy nullable property still supported

3. New JSON Schema Draft 2020-12 Features

dependentRequired - Make fields required based on other fields:

{
  "properties": {
    "creditCard": { "type": "boolean" },
    "cardNumber": { "type": "string" },
    "billingAddress": { "type": "string" }
  },
  "dependentRequired": {
    "creditCard": ["cardNumber", "billingAddress"]
  }
}

dependentSchemas - Apply conditional schemas:

{
  "dependentSchemas": {
    "creditCard": {
      "properties": {
        "cardType": { "enum": ["visa", "mastercard"] }
      },
      "required": ["cardType"]
    }
  }
}

Other new features:

  • prefixItems for tuple validation
  • const for constant values
  • contentSchema for encoded content validation
  • Enhanced schema references with $dynamicRef

4. Comprehensive Test Suite

  • βœ… 15 new tests specifically for OpenAPI 3.1 features
  • βœ… 302 total tests passing (100% pass rate)
  • βœ… 97.8% code coverage maintained
  • βœ… Tests for backward compatibility

πŸ“¦ Dependencies

  • openapi-police: 4.0.5 β†’ 5.0.0-beta.1 (OpenAPI 3.1 support)

πŸ”„ Migration Guide

No changes required! Your existing code will continue to work:

// This still works
import { JSON_SCHEMA_DRAFT_7 } from 'arrest';

// But you can also use the new name
import { JSON_SCHEMA_DRAFT_2020_12 } from 'arrest';

To adopt new features:

  1. Start using OpenAPI 3.1 features in your schemas
  2. Update nullable: true to type: ["string", "null"] (optional)
  3. Leverage new Draft 2020-12 validators

πŸ“Š Statistics

  • Tests: 302 passing (216 core + 71 MongoDB + 15 OpenAPI 3.1)
  • Coverage: 97.8% (non-MongoDB code)
  • Build: TypeScript compiles successfully
  • Breaking Changes: None

πŸ› Bug Fixes

No bug fixes in this release - pure feature addition.

πŸ“ Commits

  • 4e1333d chore: bump version to 14.1.0
  • 0a139d3 Add OpenAPI 3.1 backward compatibility and comprehensive tests
  • 78096a2 Merge feature/openapi-3.1-support: Add OpenAPI 3.1 support

πŸ”— Resources

⚠️ Known Issues

  • MongoDB tests require port 27017 to be available
  • Some validation features in dependentRequired may require openapi-police updates

Full Changelog: v14.0.1...v14.1.0