Type Alias IJsonSchemaCollection<Version, Types>

IJsonSchemaCollection: Version extends "3.0"
    ? IJsonSchemaCollection.IV3_0<Types>
    : IJsonSchemaCollection.IV3_1<Types>

Collection of JSON schemas with OpenAPI specification support.

IJsonSchemaCollection represents a comprehensive collection of JSON schemas that can be generated from TypeScript types using the typia.json.schemas() function. This interface supports both OpenAPI v3.0 and v3.1 specifications, with the ability to automatically generate appropriate schema definitions based on the specified version.

The collection includes:

  • Generated JSON schemas array containing schema definitions for the specified types
  • Reusable components that can be referenced across different schemas
  • Version-specific formatting that adheres to either OpenAPI v3.0 or v3.1 standards

Key differences between versions:

  • OpenAPI v3.0: Uses OpenApiV3.IJsonSchema format with limited tuple support
  • OpenAPI v3.1: Uses OpenApi.IJsonSchema format with full JSON Schema Draft 2020-12 compatibility

Type Parameters

  • Version extends "3.0" | "3.1" = "3.1"

    The OpenAPI specification version to target ("3.0" or "3.1"). Defaults to "3.1" for enhanced JSON Schema compatibility.

  • Types = unknown[]

    Array of original TypeScript types that were analyzed to generate the JSON schemas. This provides type safety and traceability back to the source TypeScript definitions.

// Generate schemas for OpenAPI v3.1 (default)
const schemas = typia.json.schemas<[User, Product]>();
// Type: IJsonSchemaCollection<"3.1", [User, Product]>

// Generate schemas for OpenAPI v3.0 (Swagger compatibility)
const swaggerSchemas = typia.json.schemas<[User, Product], "3.0">();
// Type: IJsonSchemaCollection<"3.0", [User, Product]>

Jeongho Nam - https://github.com/samchon