JSON Schema unit formatted for OpenAPI v3.1 specification.

This interface represents a single JSON schema unit that takes advantage of OpenAPI v3.1's enhanced capabilities and improved JSON Schema compatibility. It provides a more feature-rich and accurate representation of TypeScript types compared to the v3.0 format.

OpenAPI v3.1 advantages for this unit:

  • Full JSON Schema Draft 2020-12 compatibility
  • Native tuple type support using prefixItems
  • Proper null type handling via union types
  • Pattern properties for dynamic object keys
  • Enhanced const, enum, and validation capabilities
  • Better support for complex nested structures

Use cases for v3.1:

  • Modern OpenAPI implementations and tooling
  • Systems requiring accurate TypeScript type representation
  • Applications needing advanced JSON Schema features
  • New projects without legacy compatibility requirements
interface IV3_1<Type> {
    __type?: Type;
    components: IComponents;
    schema: IJsonSchema;
    version: "3.1";
}

Type Parameters

  • Type

    The original TypeScript type represented by this schema unit. Enables compile-time type safety and provides enhanced development experience with better IDE support.

Properties

__type?: Type

Type metadata for enhanced compile-time type safety.

This optional property preserves the original TypeScript type information for compile-time type checking and enhanced development experience. It enables type-safe operations and better IDE support without affecting the runtime JSON schema representation.

Enhanced type safety features:

  • Strong typing connection to original TypeScript definitions
  • Better IDE intellisense and error detection
  • Compile-time validation of schema usage patterns
  • Type-safe integration with validation and serialization libraries
  • Enhanced debugging and development experience

The property remains optional and undefined to maintain clean JSON serialization while preserving valuable compile-time information.

components: IComponents

Reusable schema components for OpenAPI v3.1.

Contains reusable schema definitions and components that leverage OpenAPI v3.1's enhanced capabilities. These components provide better type representation and more accurate schema definitions compared to v3.0.

Enhanced component features:

  • schemas: More accurate type definitions with v3.1 JSON Schema features
  • securitySchemes: Enhanced authentication scheme definitions
  • Better support for complex nested references
  • Improved handling of recursive and circular type dependencies

The components structure follows the emended OpenAPI v3.1 specification that simplifies certain patterns while maintaining full expressiveness.

schema: IJsonSchema

The primary JSON schema definition with v3.1 enhancements.

Contains the main JSON schema that accurately represents the TypeScript type using OpenAPI v3.1's enhanced capabilities. This schema can express complex TypeScript constructs that were not possible or accurate in v3.0.

Enhanced schema features include:

  • Tuple types using prefixItems for exact array structure
  • Union types with proper null handling via oneOf
  • Const values for literal types
  • Pattern properties for Record<string, T> types
  • Advanced validation constraints and metadata
  • Recursive type definitions with proper $ref handling

The schema follows the emended OpenAPI v3.1 format used by typia, which removes ambiguous expressions while maintaining full compatibility.

version: "3.1"

OpenAPI specification version identifier.

Always set to "3.1" to indicate this schema unit uses OpenAPI v3.1 format with enhanced JSON Schema compatibility and modern features.