Update bun.lock and package.json to include new dependencies and version updates. Enhance README with build process instructions and usage examples for schema generation. Refactor OpenAPI type definitions for improved clarity and modularity across versions 2.0, 3.0, and 3.1.

This commit is contained in:
Luke Hagar
2025-09-30 02:15:35 +00:00
parent adc25abc0b
commit 9716dbf335
86 changed files with 155777 additions and 6332 deletions

View File

@@ -1,4 +1,5 @@
import type { Extension } from "../extensions";
import type { XMLObject } from "../xml";
import type { Schema } from "../schema";
/**
@@ -106,56 +107,64 @@ import type { Schema } from "../schema";
* ```
*/
export interface ArraySchema extends Extension {
/**
* The type of the schema. Must be "array" for array schemas.
*
* This property is required and must be set to "array" to indicate
* that this schema represents an ordered collection of items.
*
* @example "array"
*/
type: "array";
/**
* The type of the schema. Must be "array" for array schemas.
*
* This property is required and must be set to "array" to indicate
* that this schema represents an ordered collection of items.
*
* @example "array"
*/
type: "array";
/**
* Required if type is "array". Describes the type of items in the array.
*
* The definition is the same as the one from JSON Schema, but references
* the Swagger Schema Object definition instead. This allows for complex
* nested structures and references to other schema definitions.
*
* @example { type: "string" }
* @example { $ref: "#/definitions/User" }
* @example { type: "object", properties: { name: { type: "string" } } }
*/
items: Schema; // Forward declaration to avoid circular imports
/**
* Required if type is "array". Describes the type of items in the array.
*
* The definition is the same as the one from JSON Schema, but references
* the Swagger Schema Object definition instead. This allows for complex
* nested structures and references to other schema definitions.
*
* @example { type: "string" }
* @example { $ref: "#/definitions/User" }
* @example { type: "object", properties: { name: { type: "string" } } }
*/
items: Schema; // Forward declaration to avoid circular imports
/**
* An array is valid against "maxItems" if its length is less than or equal to this value.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.2 | JSON Schema Validation - maxItems}
*
* @example 10
* @example 100
*/
maxItems?: number;
/**
* An array is valid against "maxItems" if its length is less than or equal to this value.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.2 | JSON Schema Validation - maxItems}
*
* @example 10
* @example 100
*/
maxItems?: number;
/**
* An array is valid against "minItems" if its length is greater than or equal to this value.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.3 | JSON Schema Validation - minItems}
*
* @example 1
* @example 2
*/
minItems?: number;
/**
* An array is valid against "minItems" if its length is greater than or equal to this value.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.3 | JSON Schema Validation - minItems}
*
* @example 1
* @example 2
*/
minItems?: number;
/**
* An array is valid against "uniqueItems" if all its elements are unique.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.4 | JSON Schema Validation - uniqueItems}
*
* @example true
* @example false
*/
uniqueItems?: boolean;
/**
* An array is valid against "uniqueItems" if all its elements are unique.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.4 | JSON Schema Validation - uniqueItems}
*
* @example true
* @example false
*/
uniqueItems?: boolean;
/**
* XML representation metadata for the schema.
* Allows for fine-tuned XML model definitions.
*
* @example { name: "users", wrapped: true }
*/
xml?: XMLObject;
}

View File

@@ -1,4 +1,5 @@
import type { Extension } from "../extensions";
import type { XMLObject } from "../xml";
/**
* -----
@@ -80,93 +81,101 @@ import type { Extension } from "../extensions";
* ```
*/
export interface BooleanSchema extends Extension {
/**
* The type of the schema. Must be "boolean" for boolean schemas.
*
* This property is required and must be set to "boolean" to indicate
* that this schema represents true/false values.
*
* @example "boolean"
*/
type: "boolean";
/**
* The type of the schema. Must be "boolean" for boolean schemas.
*
* This property is required and must be set to "boolean" to indicate
* that this schema represents true/false values.
*
* @example "boolean"
*/
type: "boolean";
/**
* The extending format for the previously mentioned type.
* See Swagger 2.0 Data Type Formats for further details.
*
* Formats provide additional semantic information about the data type,
* enabling more precise validation and better tooling support. Swagger 2.0
* defines several standard formats, but custom formats are also allowed.
*
* @see {@link https://swagger.io/specification/v2/#dataTypeFormat | Swagger 2.0 Data Type Formats}
*
* @example "int32"
* @example "date"
* @example "email"
* @example "uuid"
*/
format?: string;
/**
* The extending format for the previously mentioned type.
* See Swagger 2.0 Data Type Formats for further details.
*
* Formats provide additional semantic information about the data type,
* enabling more precise validation and better tooling support. Swagger 2.0
* defines several standard formats, but custom formats are also allowed.
*
* @see {@link https://swagger.io/specification/v2/#dataTypeFormat | Swagger 2.0 Data Type Formats}
*
* @example "int32"
* @example "date"
* @example "email"
* @example "uuid"
*/
format?: string;
/**
* A short description of the schema. GFM syntax can be used for rich text representation.
*
* This description should provide clear information about what the schema
* represents and how it should be used. It's commonly displayed in API
* documentation and code generation tools.
*
* @example "A user object containing basic information"
* @example "Email address in RFC 5322 format"
*/
description?: string;
/**
* A short description of the schema. GFM syntax can be used for rich text representation.
*
* This description should provide clear information about what the schema
* represents and how it should be used. It's commonly displayed in API
* documentation and code generation tools.
*
* @example "A user object containing basic information"
* @example "Email address in RFC 5322 format"
*/
description?: string;
/**
* A short title for the schema.
*
* The title provides a human-readable name for the schema, often used
* in documentation and UI displays. It should be concise but descriptive.
*
* @example "User"
* @example "Pet"
* @example "Order"
*/
title?: string;
/**
* A short title for the schema.
*
* The title provides a human-readable name for the schema, often used
* in documentation and UI displays. It should be concise but descriptive.
*
* @example "User"
* @example "Pet"
* @example "Order"
*/
title?: string;
/**
* Declares the value of the schema that the server will use if none is provided.
* Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object.
*
* This is a Swagger 2.0 specific requirement that differs from JSON Schema.
* The default value must be valid according to the schema's type and constraints.
*
* @example "defaultValue"
* @example 10
* @example { name: "John", age: 30 }
* @example ["item1", "item2"]
*/
default?: unknown;
/**
* Declares the value of the schema that the server will use if none is provided.
* Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object.
*
* This is a Swagger 2.0 specific requirement that differs from JSON Schema.
* The default value must be valid according to the schema's type and constraints.
*
* @example "defaultValue"
* @example 10
* @example { name: "John", age: 30 }
* @example ["item1", "item2"]
*/
default?: unknown;
/**
* An instance validates successfully against this keyword if its value is equal to one of the elements in this keyword's array value.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1 | JSON Schema Validation - enum}
*
* @example ["option1", "option2", "option3"]
* @example ["red", "green", "blue"]
* @example [1, 2, 3, 4, 5]
*/
enum?: unknown[];
/**
* An instance validates successfully against this keyword if its value is equal to one of the elements in this keyword's array value.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1 | JSON Schema Validation - enum}
*
* @example ["option1", "option2", "option3"]
* @example ["red", "green", "blue"]
* @example [1, 2, 3, 4, 5]
*/
enum?: unknown[];
/**
* A free-form property to include an example of an instance for this schema.
*
* Examples help developers understand how to use the schema and what kind
* of data is expected. They are commonly used by documentation generators
* and API testing tools.
*
* @example { name: "Puma", id: 1 }
* @example "example string value"
* @example 42
* @example ["item1", "item2"]
*/
example?: unknown;
/**
* A free-form property to include an example of an instance for this schema.
*
* Examples help developers understand how to use the schema and what kind
* of data is expected. They are commonly used by documentation generators
* and API testing tools.
*
* @example { name: "Puma", id: 1 }
* @example "example string value"
* @example 42
* @example ["item1", "item2"]
*/
example?: unknown;
/**
* XML representation metadata for the schema.
* Allows for fine-tuned XML model definitions.
*
* @example { name: "isActive", attribute: false }
*/
xml?: XMLObject;
}

View File

@@ -1,4 +1,5 @@
import type { Extension } from "../extensions";
import type { XMLObject } from "../xml";
/**
* -----
@@ -78,94 +79,102 @@ import type { Extension } from "../extensions";
* ```
*/
export interface FileSchema extends Extension {
/**
* The type of the schema. Must be "file" for file schemas.
*
* This property is required and must be set to "file" to indicate
* that this schema represents file data. This is a Swagger 2.0 specific
* type that extends JSON Schema.
*
* @example "file"
*/
type: "file";
/**
* The type of the schema. Must be "file" for file schemas.
*
* This property is required and must be set to "file" to indicate
* that this schema represents file data. This is a Swagger 2.0 specific
* type that extends JSON Schema.
*
* @example "file"
*/
type: "file";
/**
* The extending format for the previously mentioned type.
* See Swagger 2.0 Data Type Formats for further details.
*
* Formats provide additional semantic information about the data type,
* enabling more precise validation and better tooling support. Swagger 2.0
* defines several standard formats, but custom formats are also allowed.
*
* @see {@link https://swagger.io/specification/v2/#dataTypeFormat | Swagger 2.0 Data Type Formats}
*
* @example "int32"
* @example "date"
* @example "email"
* @example "uuid"
*/
format?: string;
/**
* The extending format for the previously mentioned type.
* See Swagger 2.0 Data Type Formats for further details.
*
* Formats provide additional semantic information about the data type,
* enabling more precise validation and better tooling support. Swagger 2.0
* defines several standard formats, but custom formats are also allowed.
*
* @see {@link https://swagger.io/specification/v2/#dataTypeFormat | Swagger 2.0 Data Type Formats}
*
* @example "int32"
* @example "date"
* @example "email"
* @example "uuid"
*/
format?: string;
/**
* A short description of the schema. GFM syntax can be used for rich text representation.
*
* This description should provide clear information about what the schema
* represents and how it should be used. It's commonly displayed in API
* documentation and code generation tools.
*
* @example "A user object containing basic information"
* @example "Email address in RFC 5322 format"
*/
description?: string;
/**
* A short description of the schema. GFM syntax can be used for rich text representation.
*
* This description should provide clear information about what the schema
* represents and how it should be used. It's commonly displayed in API
* documentation and code generation tools.
*
* @example "A user object containing basic information"
* @example "Email address in RFC 5322 format"
*/
description?: string;
/**
* A short title for the schema.
*
* The title provides a human-readable name for the schema, often used
* in documentation and UI displays. It should be concise but descriptive.
*
* @example "User"
* @example "Pet"
* @example "Order"
*/
title?: string;
/**
* A short title for the schema.
*
* The title provides a human-readable name for the schema, often used
* in documentation and UI displays. It should be concise but descriptive.
*
* @example "User"
* @example "Pet"
* @example "Order"
*/
title?: string;
/**
* Declares the value of the schema that the server will use if none is provided.
* Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object.
*
* This is a Swagger 2.0 specific requirement that differs from JSON Schema.
* The default value must be valid according to the schema's type and constraints.
*
* @example "defaultValue"
* @example 10
* @example { name: "John", age: 30 }
* @example ["item1", "item2"]
*/
default?: unknown;
/**
* Declares the value of the schema that the server will use if none is provided.
* Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object.
*
* This is a Swagger 2.0 specific requirement that differs from JSON Schema.
* The default value must be valid according to the schema's type and constraints.
*
* @example "defaultValue"
* @example 10
* @example { name: "John", age: 30 }
* @example ["item1", "item2"]
*/
default?: unknown;
/**
* An instance validates successfully against this keyword if its value is equal to one of the elements in this keyword's array value.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1 | JSON Schema Validation - enum}
*
* @example ["option1", "option2", "option3"]
* @example ["red", "green", "blue"]
* @example [1, 2, 3, 4, 5]
*/
enum?: unknown[];
/**
* An instance validates successfully against this keyword if its value is equal to one of the elements in this keyword's array value.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1 | JSON Schema Validation - enum}
*
* @example ["option1", "option2", "option3"]
* @example ["red", "green", "blue"]
* @example [1, 2, 3, 4, 5]
*/
enum?: unknown[];
/**
* A free-form property to include an example of an instance for this schema.
*
* Examples help developers understand how to use the schema and what kind
* of data is expected. They are commonly used by documentation generators
* and API testing tools.
*
* @example { name: "Puma", id: 1 }
* @example "example string value"
* @example 42
* @example ["item1", "item2"]
*/
example?: unknown;
/**
* A free-form property to include an example of an instance for this schema.
*
* Examples help developers understand how to use the schema and what kind
* of data is expected. They are commonly used by documentation generators
* and API testing tools.
*
* @example { name: "Puma", id: 1 }
* @example "example string value"
* @example 42
* @example ["item1", "item2"]
*/
example?: unknown;
/**
* XML representation metadata for the schema.
* Allows for fine-tuned XML model definitions.
*
* @example { name: "fileData", attribute: false }
*/
xml?: XMLObject;
}

View File

@@ -1,4 +1,5 @@
import type { Extension } from "../extensions";
import type { XMLObject } from "../xml";
/**
* -----
@@ -93,142 +94,150 @@ import type { Extension } from "../extensions";
* ```
*/
export interface IntegerSchema extends Extension {
/**
* The type of the schema. Must be "integer" for integer schemas.
*
* This property is required and must be set to "integer" to indicate
* that this schema represents whole number data without fractional components.
*
* @example "integer"
*/
type: "integer";
/**
* The type of the schema. Must be "integer" for integer schemas.
*
* This property is required and must be set to "integer" to indicate
* that this schema represents whole number data without fractional components.
*
* @example "integer"
*/
type: "integer";
/**
* The extending format for the previously mentioned type.
* See Swagger 2.0 Data Type Formats for further details.
*
* Formats provide additional semantic information about the data type,
* enabling more precise validation and better tooling support. Swagger 2.0
* defines several standard formats, but custom formats are also allowed.
*
* @see {@link https://swagger.io/specification/v2/#dataTypeFormat | Swagger 2.0 Data Type Formats}
*
* @example "int32"
* @example "int64"
*/
format?: string;
/**
* The extending format for the previously mentioned type.
* See Swagger 2.0 Data Type Formats for further details.
*
* Formats provide additional semantic information about the data type,
* enabling more precise validation and better tooling support. Swagger 2.0
* defines several standard formats, but custom formats are also allowed.
*
* @see {@link https://swagger.io/specification/v2/#dataTypeFormat | Swagger 2.0 Data Type Formats}
*
* @example "int32"
* @example "int64"
*/
format?: string;
/**
* A short description of the schema. GFM syntax can be used for rich text representation.
*
* This description should provide clear information about what the schema
* represents and how it should be used. It's commonly displayed in API
* documentation and code generation tools.
*
* @example "A user object containing basic information"
* @example "Email address in RFC 5322 format"
*/
description?: string;
/**
* A short description of the schema. GFM syntax can be used for rich text representation.
*
* This description should provide clear information about what the schema
* represents and how it should be used. It's commonly displayed in API
* documentation and code generation tools.
*
* @example "A user object containing basic information"
* @example "Email address in RFC 5322 format"
*/
description?: string;
/**
* A short title for the schema.
*
* The title provides a human-readable name for the schema, often used
* in documentation and UI displays. It should be concise but descriptive.
*
* @example "User"
* @example "Pet"
* @example "Order"
*/
title?: string;
/**
* A short title for the schema.
*
* The title provides a human-readable name for the schema, often used
* in documentation and UI displays. It should be concise but descriptive.
*
* @example "User"
* @example "Pet"
* @example "Order"
*/
title?: string;
/**
* Declares the value of the schema that the server will use if none is provided.
* Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object.
*
* This is a Swagger 2.0 specific requirement that differs from JSON Schema.
* The default value must be valid according to the schema's type and constraints.
*
* @example "defaultValue"
* @example 10
* @example { name: "John", age: 30 }
* @example ["item1", "item2"]
*/
default?: unknown;
/**
* Declares the value of the schema that the server will use if none is provided.
* Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object.
*
* This is a Swagger 2.0 specific requirement that differs from JSON Schema.
* The default value must be valid according to the schema's type and constraints.
*
* @example "defaultValue"
* @example 10
* @example { name: "John", age: 30 }
* @example ["item1", "item2"]
*/
default?: unknown;
/**
* An instance validates successfully against this keyword if its value is equal to one of the elements in this keyword's array value.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1 | JSON Schema Validation - enum}
*
* @example ["option1", "option2", "option3"]
* @example ["red", "green", "blue"]
* @example [1, 2, 3, 4, 5]
*/
enum?: unknown[];
/**
* An instance validates successfully against this keyword if its value is equal to one of the elements in this keyword's array value.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1 | JSON Schema Validation - enum}
*
* @example ["option1", "option2", "option3"]
* @example ["red", "green", "blue"]
* @example [1, 2, 3, 4, 5]
*/
enum?: unknown[];
/**
* A free-form property to include an example of an instance for this schema.
*
* Examples help developers understand how to use the schema and what kind
* of data is expected. They are commonly used by documentation generators
* and API testing tools.
*
* @example { name: "Puma", id: 1 }
* @example "example string value"
* @example 42
* @example ["item1", "item2"]
*/
example?: unknown;
/**
* A free-form property to include an example of an instance for this schema.
*
* Examples help developers understand how to use the schema and what kind
* of data is expected. They are commonly used by documentation generators
* and API testing tools.
*
* @example { name: "Puma", id: 1 }
* @example "example string value"
* @example 42
* @example ["item1", "item2"]
*/
example?: unknown;
/**
* A number is valid against "multipleOf" if the result of the division
* of the instance by this keyword's value is an integer.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.1 | JSON Schema Validation - multipleOf}
*
* @example 2
* @example 1
*/
multipleOf?: number;
/**
* A number is valid against "multipleOf" if the result of the division
* of the instance by this keyword's value is an integer.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.1 | JSON Schema Validation - multipleOf}
*
* @example 2
* @example 1
*/
multipleOf?: number;
/**
* A number is valid against "maximum" if it is less than or equal to this value.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2 | JSON Schema Validation - maximum}
*
* @example 100
* @example 2147483647
*/
maximum?: number;
/**
* A number is valid against "maximum" if it is less than or equal to this value.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2 | JSON Schema Validation - maximum}
*
* @example 100
* @example 2147483647
*/
maximum?: number;
/**
* A number is valid against "exclusiveMaximum" if it is strictly less than this value.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2 | JSON Schema Validation - exclusiveMaximum}
*
* @example false
* @example true
*/
exclusiveMaximum?: boolean;
/**
* A number is valid against "exclusiveMaximum" if it is strictly less than this value.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2 | JSON Schema Validation - exclusiveMaximum}
*
* @example false
* @example true
*/
exclusiveMaximum?: boolean;
/**
* A number is valid against "minimum" if it is greater than or equal to this value.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3 | JSON Schema Validation - minimum}
*
* @example 0
* @example 1
*/
minimum?: number;
/**
* A number is valid against "minimum" if it is greater than or equal to this value.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3 | JSON Schema Validation - minimum}
*
* @example 0
* @example 1
*/
minimum?: number;
/**
* A number is valid against "exclusiveMinimum" if it is strictly greater than this value.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3 | JSON Schema Validation - exclusiveMinimum}
*
* @example false
* @example true
*/
exclusiveMinimum?: boolean;
/**
* A number is valid against "exclusiveMinimum" if it is strictly greater than this value.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3 | JSON Schema Validation - exclusiveMinimum}
*
* @example false
* @example true
*/
exclusiveMinimum?: boolean;
/**
* XML representation metadata for the schema.
* Allows for fine-tuned XML model definitions.
*
* @example { name: "userId", attribute: false }
*/
xml?: XMLObject;
}

View File

@@ -1,4 +1,5 @@
import type { Extension } from "../extensions";
import type { XMLObject } from "../xml";
/**
* -----
@@ -96,144 +97,152 @@ import type { Extension } from "../extensions";
* ```
*/
export interface NumberSchema extends Extension {
/**
* The type of the schema. Must be "number" for number schemas.
*
* This property is required and must be set to "number" to indicate
* that this schema represents numeric data (both integers and floating-point).
*
* @example "number"
*/
type: "number";
/**
* The type of the schema. Must be "number" for number schemas.
*
* This property is required and must be set to "number" to indicate
* that this schema represents numeric data (both integers and floating-point).
*
* @example "number"
*/
type: "number";
/**
* The extending format for the previously mentioned type.
* See Swagger 2.0 Data Type Formats for further details.
*
* Formats provide additional semantic information about the data type,
* enabling more precise validation and better tooling support. Swagger 2.0
* defines several standard formats, but custom formats are also allowed.
*
* @see {@link https://swagger.io/specification/v2/#dataTypeFormat | Swagger 2.0 Data Type Formats}
*
* @example "int32"
* @example "date"
* @example "email"
* @example "uuid"
*/
format?: string;
/**
* The extending format for the previously mentioned type.
* See Swagger 2.0 Data Type Formats for further details.
*
* Formats provide additional semantic information about the data type,
* enabling more precise validation and better tooling support. Swagger 2.0
* defines several standard formats, but custom formats are also allowed.
*
* @see {@link https://swagger.io/specification/v2/#dataTypeFormat | Swagger 2.0 Data Type Formats}
*
* @example "int32"
* @example "date"
* @example "email"
* @example "uuid"
*/
format?: string;
/**
* A short description of the schema. GFM syntax can be used for rich text representation.
*
* This description should provide clear information about what the schema
* represents and how it should be used. It's commonly displayed in API
* documentation and code generation tools.
*
* @example "A user object containing basic information"
* @example "Email address in RFC 5322 format"
*/
description?: string;
/**
* A short description of the schema. GFM syntax can be used for rich text representation.
*
* This description should provide clear information about what the schema
* represents and how it should be used. It's commonly displayed in API
* documentation and code generation tools.
*
* @example "A user object containing basic information"
* @example "Email address in RFC 5322 format"
*/
description?: string;
/**
* A short title for the schema.
*
* The title provides a human-readable name for the schema, often used
* in documentation and UI displays. It should be concise but descriptive.
*
* @example "User"
* @example "Pet"
* @example "Order"
*/
title?: string;
/**
* A short title for the schema.
*
* The title provides a human-readable name for the schema, often used
* in documentation and UI displays. It should be concise but descriptive.
*
* @example "User"
* @example "Pet"
* @example "Order"
*/
title?: string;
/**
* Declares the value of the schema that the server will use if none is provided.
* Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object.
*
* This is a Swagger 2.0 specific requirement that differs from JSON Schema.
* The default value must be valid according to the schema's type and constraints.
*
* @example "defaultValue"
* @example 10
* @example { name: "John", age: 30 }
* @example ["item1", "item2"]
*/
default?: unknown;
/**
* Declares the value of the schema that the server will use if none is provided.
* Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object.
*
* This is a Swagger 2.0 specific requirement that differs from JSON Schema.
* The default value must be valid according to the schema's type and constraints.
*
* @example "defaultValue"
* @example 10
* @example { name: "John", age: 30 }
* @example ["item1", "item2"]
*/
default?: unknown;
/**
* An instance validates successfully against this keyword if its value is equal to one of the elements in this keyword's array value.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1 | JSON Schema Validation - enum}
*
* @example ["option1", "option2", "option3"]
* @example ["red", "green", "blue"]
* @example [1, 2, 3, 4, 5]
*/
enum?: unknown[];
/**
* An instance validates successfully against this keyword if its value is equal to one of the elements in this keyword's array value.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1 | JSON Schema Validation - enum}
*
* @example ["option1", "option2", "option3"]
* @example ["red", "green", "blue"]
* @example [1, 2, 3, 4, 5]
*/
enum?: unknown[];
/**
* A free-form property to include an example of an instance for this schema.
*
* Examples help developers understand how to use the schema and what kind
* of data is expected. They are commonly used by documentation generators
* and API testing tools.
*
* @example { name: "Puma", id: 1 }
* @example "example string value"
* @example 42
* @example ["item1", "item2"]
*/
example?: unknown;
/**
* A free-form property to include an example of an instance for this schema.
*
* Examples help developers understand how to use the schema and what kind
* of data is expected. They are commonly used by documentation generators
* and API testing tools.
*
* @example { name: "Puma", id: 1 }
* @example "example string value"
* @example 42
* @example ["item1", "item2"]
*/
example?: unknown;
/**
* A number is valid against "multipleOf" if the result of the division
* of the instance by this keyword's value is an integer.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.1 | JSON Schema Validation - multipleOf}
*
* @example 2
* @example 0.01
*/
multipleOf?: number;
/**
* A number is valid against "multipleOf" if the result of the division
* of the instance by this keyword's value is an integer.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.1 | JSON Schema Validation - multipleOf}
*
* @example 2
* @example 0.01
*/
multipleOf?: number;
/**
* A number is valid against "maximum" if it is less than or equal to this value.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2 | JSON Schema Validation - maximum}
*
* @example 100
* @example 999.99
*/
maximum?: number;
/**
* A number is valid against "maximum" if it is less than or equal to this value.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2 | JSON Schema Validation - maximum}
*
* @example 100
* @example 999.99
*/
maximum?: number;
/**
* A number is valid against "exclusiveMaximum" if it is strictly less than this value.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2 | JSON Schema Validation - exclusiveMaximum}
*
* @example false
* @example true
*/
exclusiveMaximum?: boolean;
/**
* A number is valid against "exclusiveMaximum" if it is strictly less than this value.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2 | JSON Schema Validation - exclusiveMaximum}
*
* @example false
* @example true
*/
exclusiveMaximum?: boolean;
/**
* A number is valid against "minimum" if it is greater than or equal to this value.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3 | JSON Schema Validation - minimum}
*
* @example 0
* @example 1
*/
minimum?: number;
/**
* A number is valid against "minimum" if it is greater than or equal to this value.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3 | JSON Schema Validation - minimum}
*
* @example 0
* @example 1
*/
minimum?: number;
/**
* A number is valid against "exclusiveMinimum" if it is strictly greater than this value.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3 | JSON Schema Validation - exclusiveMinimum}
*
* @example false
* @example true
*/
exclusiveMinimum?: boolean;
/**
* A number is valid against "exclusiveMinimum" if it is strictly greater than this value.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3 | JSON Schema Validation - exclusiveMinimum}
*
* @example false
* @example true
*/
exclusiveMinimum?: boolean;
/**
* XML representation metadata for the schema.
* Allows for fine-tuned XML model definitions.
*
* @example { name: "price", attribute: false }
*/
xml?: XMLObject;
}

View File

@@ -1,4 +1,5 @@
import type { Extension } from "../extensions";
import type { XMLObject } from "../xml";
import type { Schema } from "../schema";
/**
@@ -117,90 +118,98 @@ import type { Schema } from "../schema";
* ```
*/
export interface ObjectSchema extends Extension {
/**
* The type of the schema. Must be "object" for object schemas.
*
* This property is required and must be set to "object" to indicate
* that this schema represents structured data with named properties.
*
* @example "object"
*/
type?: "object";
/**
* The type of the schema. Must be "object" for object schemas.
*
* This property is required and must be set to "object" to indicate
* that this schema represents structured data with named properties.
*
* @example "object"
*/
type?: "object";
/**
* The properties of the object. The definition is the same as the one from
* JSON Schema, but references the Swagger Schema Object definition instead.
*
* Each property name maps to a schema definition that describes the type
* and validation rules for that property. Properties can be of any type
* supported by Swagger schemas, including primitives, objects, arrays,
* and references.
*
* @example { name: { type: "string" }, age: { type: "integer" } }
* @example { address: { $ref: "#/definitions/Address" } }
*/
properties?: Record<string, Schema>; // Forward declaration to avoid circular imports
/**
* The properties of the object. The definition is the same as the one from
* JSON Schema, but references the Swagger Schema Object definition instead.
*
* Each property name maps to a schema definition that describes the type
* and validation rules for that property. Properties can be of any type
* supported by Swagger schemas, including primitives, objects, arrays,
* and references.
*
* @example { name: { type: "string" }, age: { type: "integer" } }
* @example { address: { $ref: "#/definitions/Address" } }
*/
properties?: Record<string, Schema>; // Forward declaration to avoid circular imports
/**
* A list of required properties. Properties marked as required being true
* MUST be present in the object.
*
* This array contains the names of properties that must be present in
* any valid instance of this object schema. Properties not listed here
* are considered optional.
*
* @example ["name", "email"]
* @example ["id", "type", "createdAt"]
*/
required?: string[];
/**
* A list of required properties. Properties marked as required being true
* MUST be present in the object.
*
* This array contains the names of properties that must be present in
* any valid instance of this object schema. Properties not listed here
* are considered optional.
*
* @example ["name", "email"]
* @example ["id", "type", "createdAt"]
*/
required?: string[];
/**
* Additional properties for the object. Can be a boolean or a schema.
* The definition is the same as the one from JSON Schema, but references
* the Swagger Schema Object definition instead.
*
* - If true, additional properties of any type are allowed
* - If false, no additional properties are allowed
* - If a schema, additional properties must conform to that schema
*
* @example true
* @example false
* @example { type: "string" }
* @example { $ref: "#/definitions/AdditionalProperty" }
*/
additionalProperties?: boolean | Schema; // Forward declaration to avoid circular imports
/**
* Additional properties for the object. Can be a boolean or a schema.
* The definition is the same as the one from JSON Schema, but references
* the Swagger Schema Object definition instead.
*
* - If true, additional properties of any type are allowed
* - If false, no additional properties are allowed
* - If a schema, additional properties must conform to that schema
*
* @example true
* @example false
* @example { type: "string" }
* @example { $ref: "#/definitions/AdditionalProperty" }
*/
additionalProperties?: boolean | Schema; // Forward declaration to avoid circular imports
/**
* An array of schemas that this schema must validate against.
* All schemas in the array must be valid for the object to be valid.
* The definition is the same as the one from JSON Schema, but references
* the Swagger Schema Object definition instead.
*
* This enables schema composition and inheritance patterns, allowing
* objects to extend or combine multiple base schemas.
*
* @example [{ $ref: "#/definitions/BaseUser" }, { type: "object", properties: { ... } }]
* @example [{ $ref: "#/definitions/Identifiable" }, { $ref: "#/definitions/Timestamped" }]
*/
allOf?: Schema[]; // Forward declaration to avoid circular imports
/**
* An array of schemas that this schema must validate against.
* All schemas in the array must be valid for the object to be valid.
* The definition is the same as the one from JSON Schema, but references
* the Swagger Schema Object definition instead.
*
* This enables schema composition and inheritance patterns, allowing
* objects to extend or combine multiple base schemas.
*
* @example [{ $ref: "#/definitions/BaseUser" }, { type: "object", properties: { ... } }]
* @example [{ $ref: "#/definitions/Identifiable" }, { $ref: "#/definitions/Timestamped" }]
*/
allOf?: Schema[]; // Forward declaration to avoid circular imports
/**
* An object is valid against "maxProperties" if its number of properties is less than or equal to this value.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.4.1 | JSON Schema Validation - maxProperties}
*
* @example 10
* @example 50
*/
maxProperties?: number;
/**
* An object is valid against "maxProperties" if its number of properties is less than or equal to this value.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.4.1 | JSON Schema Validation - maxProperties}
*
* @example 10
* @example 50
*/
maxProperties?: number;
/**
* An object is valid against "minProperties" if its number of properties is greater than or equal to this value.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.4.2 | JSON Schema Validation - minProperties}
*
* @example 1
* @example 2
*/
minProperties?: number;
/**
* An object is valid against "minProperties" if its number of properties is greater than or equal to this value.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.4.2 | JSON Schema Validation - minProperties}
*
* @example 1
* @example 2
*/
minProperties?: number;
/**
* XML representation metadata for the schema.
* Allows for fine-tuned XML model definitions.
*
* @example { name: "user", attribute: false }
*/
xml?: XMLObject;
}

View File

@@ -1,4 +1,5 @@
import type { Extension } from "../extensions";
import type { XMLObject } from "../xml";
/**
* -----
@@ -91,135 +92,143 @@ import type { Extension } from "../extensions";
* ```
*/
export interface StringSchema extends Extension {
/**
* The type of the schema. Must be "string" for string schemas.
*
* This property is required and must be set to "string" to indicate
* that this schema represents string data.
*
* @see {@link https://swagger.io/specification/v2/#data-types | Swagger 2.0 Specification - type}
*
* @example "string"
*/
type: "string";
/**
* The type of the schema. Must be "string" for string schemas.
*
* This property is required and must be set to "string" to indicate
* that this schema represents string data.
*
* @see {@link https://swagger.io/specification/v2/#data-types | Swagger 2.0 Specification - type}
*
* @example "string"
*/
type: "string";
/**
* The extending format for the previously mentioned type.
* See Swagger 2.0 Data Type Formats for further details.
*
* Formats provide additional semantic information about the data type,
* enabling more precise validation and better tooling support. Swagger 2.0
* defines several standard formats, but custom formats are also allowed.
*
* @see {@link https://swagger.io/specification/v2/#dataTypeFormat | Swagger 2.0 Data Type Formats}
*
* @example "int32"
* @example "date"
* @example "email"
* @example "uuid"
*/
format?: string;
/**
* The extending format for the previously mentioned type.
* See Swagger 2.0 Data Type Formats for further details.
*
* Formats provide additional semantic information about the data type,
* enabling more precise validation and better tooling support. Swagger 2.0
* defines several standard formats, but custom formats are also allowed.
*
* @see {@link https://swagger.io/specification/v2/#dataTypeFormat | Swagger 2.0 Data Type Formats}
*
* @example "int32"
* @example "date"
* @example "email"
* @example "uuid"
*/
format?: string;
/**
* A short description of the schema. GFM syntax can be used for rich text representation.
*
* This description should provide clear information about what the schema
* represents and how it should be used. It's commonly displayed in API
* documentation and code generation tools.
*
* @see {@link https://swagger.io/specification/v2/#schema-object | Swagger 2.0 Specification - description}
*
* @example "A user object containing basic information"
* @example "Email address in RFC 5322 format"
*/
description?: string;
/**
* A short description of the schema. GFM syntax can be used for rich text representation.
*
* This description should provide clear information about what the schema
* represents and how it should be used. It's commonly displayed in API
* documentation and code generation tools.
*
* @see {@link https://swagger.io/specification/v2/#schema-object | Swagger 2.0 Specification - description}
*
* @example "A user object containing basic information"
* @example "Email address in RFC 5322 format"
*/
description?: string;
/**
* A short title for the schema.
*
* The title provides a human-readable name for the schema, often used
* in documentation and UI displays. It should be concise but descriptive.
*
* @see {@link https://swagger.io/specification/v2/#schema-object | Swagger 2.0 Specification - title}
*
* @example "User"
* @example "Pet"
* @example "Order"
*/
title?: string;
/**
* A short title for the schema.
*
* The title provides a human-readable name for the schema, often used
* in documentation and UI displays. It should be concise but descriptive.
*
* @see {@link https://swagger.io/specification/v2/#schema-object | Swagger 2.0 Specification - title}
*
* @example "User"
* @example "Pet"
* @example "Order"
*/
title?: string;
/**
* Declares the value of the schema that the server will use if none is provided.
* Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object.
*
* This is a Swagger 2.0 specific requirement that differs from JSON Schema.
* The default value must be valid according to the schema's type and constraints.
*
* @see {@link https://swagger.io/specification/v2/#schema-object | Swagger 2.0 Specification - default}
*
* @example "defaultValue"
* @example 10
* @example { name: "John", age: 30 }
* @example ["item1", "item2"]
*/
default?: unknown;
/**
* Declares the value of the schema that the server will use if none is provided.
* Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object.
*
* This is a Swagger 2.0 specific requirement that differs from JSON Schema.
* The default value must be valid according to the schema's type and constraints.
*
* @see {@link https://swagger.io/specification/v2/#schema-object | Swagger 2.0 Specification - default}
*
* @example "defaultValue"
* @example 10
* @example { name: "John", age: 30 }
* @example ["item1", "item2"]
*/
default?: unknown;
/**
* An instance validates successfully against this keyword if its value is equal to one of the elements in this keyword's array value.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1 | JSON Schema Validation - enum}
*
* @example ["option1", "option2", "option3"]
* @example ["red", "green", "blue"]
* @example [1, 2, 3, 4, 5]
*/
enum?: unknown[];
/**
* An instance validates successfully against this keyword if its value is equal to one of the elements in this keyword's array value.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1 | JSON Schema Validation - enum}
*
* @example ["option1", "option2", "option3"]
* @example ["red", "green", "blue"]
* @example [1, 2, 3, 4, 5]
*/
enum?: unknown[];
/**
* A free-form property to include an example of an instance for this schema.
*
* Examples help developers understand how to use the schema and what kind
* of data is expected. They are commonly used by documentation generators
* and API testing tools.
*
* @see {@link https://swagger.io/specification/v2/#schema-object | Swagger 2.0 Specification - example}
*
* @example { name: "Puma", id: 1 }
* @example "example string value"
* @example 42
* @example ["item1", "item2"]
*/
example?: unknown;
/**
* A free-form property to include an example of an instance for this schema.
*
* Examples help developers understand how to use the schema and what kind
* of data is expected. They are commonly used by documentation generators
* and API testing tools.
*
* @see {@link https://swagger.io/specification/v2/#schema-object | Swagger 2.0 Specification - example}
*
* @example { name: "Puma", id: 1 }
* @example "example string value"
* @example 42
* @example ["item1", "item2"]
*/
example?: unknown;
/**
* A string is valid against "maxLength" if its length is less than or equal to this value.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.1 | JSON Schema Validation - maxLength}
*
* @example 100
* @example 255
*/
maxLength?: number;
/**
* A string is valid against "maxLength" if its length is less than or equal to this value.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.1 | JSON Schema Validation - maxLength}
*
* @example 100
* @example 255
*/
maxLength?: number;
/**
* A string is valid against "minLength" if its length is greater than or equal to this value.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.2 | JSON Schema Validation - minLength}
*
* @example 1
* @example 8
*/
minLength?: number;
/**
* A string is valid against "minLength" if its length is greater than or equal to this value.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.2 | JSON Schema Validation - minLength}
*
* @example 1
* @example 8
*/
minLength?: number;
/**
* A string is valid against "pattern" if the regular expression matches the string successfully.
* The regular expression syntax follows ECMA 262.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.3 | JSON Schema Validation - pattern}
* @see {@link https://www.ecma-international.org/ecma-262/5.1/#sec-15.10 | ECMA 262 Regular Expression Syntax}
*
* @example "^[a-zA-Z0-9]+$"
* @example "^\\d{4}-\\d{2}-\\d{2}$"
*/
pattern?: string;
/**
* A string is valid against "pattern" if the regular expression matches the string successfully.
* The regular expression syntax follows ECMA 262.
*
* @see {@link https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.3 | JSON Schema Validation - pattern}
* @see {@link https://www.ecma-international.org/ecma-262/5.1/#sec-15.10 | ECMA 262 Regular Expression Syntax}
*
* @example "^[a-zA-Z0-9]+$"
* @example "^\\d{4}-\\d{2}-\\d{2}$"
*/
pattern?: string;
/**
* XML representation metadata for the schema.
* Allows for fine-tuned XML model definitions.
*
* @example { name: "userName", attribute: false }
*/
xml?: XMLObject;
}

View File

@@ -58,18 +58,18 @@ import type { Extension } from "./extensions";
* };
* ```
*/
export interface Example extends Extension {
/**
* The name of the property MUST be one of the Operation produces values
* (either implicit or inherited). The value SHOULD be an example of what
* such a response would look like.
*
* The property name corresponds to a MIME type that the operation can produce.
* The value should be a realistic example of the response data in that format.
*
* @example { "application/json": { name: "Puma", type: "Dog" } }
* @example { "application/xml": "<pet><name>Puma</name></pet>" }
* @example { "text/plain": "Success" }
*/
[mimeType: string]: unknown;
export interface Examples extends Extension {
/**
* The name of the property MUST be one of the Operation produces values
* (either implicit or inherited). The value SHOULD be an example of what
* such a response would look like.
*
* The property name corresponds to a MIME type that the operation can produce.
* The value should be a realistic example of the response data in that format.
*
* @example { "application/json": { name: "Puma", type: "Dog" } }
* @example { "application/xml": "<pet><name>Puma</name></pet>" }
* @example { "text/plain": "Success" }
*/
[mimeType: string]: unknown;
}

View File

@@ -2,73 +2,73 @@
// This file serves as the main entry point for all OpenAPI 2.0 type definitions
export type {
ArraySchema,
BooleanSchema,
FileSchema,
IntegerSchema,
NumberSchema,
ObjectSchema,
// Individual schema types
StringSchema,
ArraySchema,
BooleanSchema,
FileSchema,
IntegerSchema,
NumberSchema,
ObjectSchema,
// Individual schema types
StringSchema,
} from "./data-types";
export type { Example } from "./example";
export type { Examples } from "./example";
// Re-export all types for convenience
export type {
// Core types
Extension,
// Core types
Extension,
} from "./extensions";
export type { ExternalDocumentation } from "./externalDocs";
export type {
Contact,
// Info types
Info,
License,
Contact,
// Info types
Info,
License,
} from "./info";
export type {
Header,
Items,
Operation,
Parameter,
// Path types
PathItemObject,
Paths,
Response,
Header,
Items,
Operation,
Parameter,
// Path types
PathItem,
Paths,
Response,
} from "./paths";
export type {
// References
BaseReference,
Reference,
// References
BaseReference,
Reference,
} from "./references";
export type {
Definitions,
ParametersDefinitions,
ResponsesDefinitions,
// Schema types
Schema,
XML,
Definitions,
ParametersDefinitions,
ResponsesDefinitions,
// Schema types
Schema,
XML,
} from "./schema";
export type {
Scopes,
SecurityDefinitions,
SecurityRequirement,
// Security types
SecurityScheme,
Scopes,
SecurityDefinitions,
SecurityRequirement,
// Security types
SecurityScheme,
} from "./security";
// Export the main specification type
export type { Specification } from "./spec";
export type {
// Utility types
Tag,
// Utility types
Tag,
} from "./tags";
export type {
// XML Object
XMLObject,
// XML Object
XMLObject,
} from "./xml";
// All supporting types are now defined in their respective modules:
// - spec.ts: Specification (main root type)
// - info.ts: Info, Contact, License
// - paths.ts: PathItemObject, Operation, Parameter, Response, Header, Items
// - paths.ts: PathItem, Operation, Parameter, Response, Header, Items
// - schema.ts: Schema, XML, Definitions, ParametersDefinitions, ResponsesDefinitions
// - security.ts: SecurityScheme, SecurityRequirement, Scopes, SecurityDefinitions
// - shallow.ts: Tag, ExternalDocumentation, Reference, Example, Paths

File diff suppressed because it is too large Load Diff

View File

@@ -2,64 +2,64 @@
// This file serves as the main entry point for all OpenAPI 3.0 type definitions
export type {
// Components types
Components,
// Components types
Components,
} from "./components";
// Re-export all types for convenience
export type {
// Core types
Extension,
// Core types
Extension,
} from "./extensions";
export type { ExternalDocumentation } from "./externalDocs";
export type {
Contact,
// Info types
Info,
License,
Contact,
// Info types
Info,
License,
} from "./info";
export type {
Callback,
Encoding,
Example,
Header,
Link,
MediaType,
Operation,
Parameter,
PathItemObject,
// Path types
Paths,
RequestBody,
Response,
Callback,
Encoding,
Example,
Header,
Link,
MediaType,
Operation,
Parameter,
PathItem,
// Path types
Paths,
RequestBody,
Response,
} from "./paths";
export type { Reference } from "./references";
export type {
Discriminator,
// Schema types
Schema,
Discriminator,
// Schema types
Schema,
} from "./schema";
export type {
OAuthFlow,
OAuthFlows,
SecurityRequirement,
// Security types
SecurityScheme,
OAuthFlow,
OAuthFlows,
SecurityRequirement,
// Security types
SecurityScheme,
} from "./security";
export type {
// Server types
Server,
ServerVariable,
// Server types
Server,
ServerVariable,
} from "./servers";
// Export the main specification type
export type { Specification } from "./spec";
export type {
// Utility types
Tag,
// Utility types
Tag,
} from "./tags";
export type {
// XML types
XML,
// XML types
XML,
} from "./xml";

File diff suppressed because it is too large Load Diff

View File

@@ -29,108 +29,141 @@ import type { Extension } from "./extensions";
* @property `x-${string}` - Specification Extensions
*
* @note
* All fields are optional.
* All fields are optional. The `xml` object has no effect when placed on root schemas
* in OpenAPI 3.0.x - it only affects property schemas (nested schemas).
*
* -----
* Examples
* -----
*
* @example (simple XML):
* @example (simple XML element):
* ```ts
* const xml: XML = {
* name: "animal"
* };
* ```
*
* @example (XML attribute):
* ```ts
* const xml: XML = {
* name: "id",
* attribute: true
* };
* ```
*
* @example (namespaced XML):
* ```ts
* const xml: XML = {
* name: "user",
* namespace: "http://example.com/schema",
* prefix: "ex"
* };
* ```
*
* @example (wrapped array):
* ```ts
* const xml: XML = {
* name: "users",
* wrapped: true
* };
* ```
*
* @example (array items with custom name):
* ```ts
* const xml: XML = {
* name: "user"
* };
* ```
*/
export interface XML extends Extension {
/**
* Replaces the name of the element/attribute used for the described schema property.
* When defined within items, it will affect the name of the individual XML elements within the list.
* When defined alongside type being array (outside the items), it will affect the wrapping element
* and only if wrapped is true. If wrapped is false, it will affect the items within the array.
* *
* | Version | Reference |
* |---|-----|
* | 3.0.4 | {@link https://spec.openapis.org/oas/v3.0.4#xml-object | OpenAPI 3.0.4 XML Object - name} |
* | 3.0.3 | {@link https://spec.openapis.org/oas/v3.0.3#xml-object | OpenAPI 3.0.3 XML Object - name} |
* | 3.0.2 | {@link https://spec.openapis.org/oas/v3.0.2#xml-object | OpenAPI 3.0.2 XML Object - name} |
* | 3.0.1 | {@link https://spec.openapis.org/oas/v3.0.1#xml-object | OpenAPI 3.0.1 XML Object - name} |
* | 3.0.0 | {@link https://spec.openapis.org/oas/v3.0.0#xml-object | OpenAPI 3.0.0 XML Object - name} |
* @property `name` - Optional Replaces the name of the element/attribute used for the described schema property
*
* @example "animal"
* @example "item"
*/
name?: string;
/**
* Replaces the name of the element/attribute used for the described schema property.
* When defined within items, it will affect the name of the individual XML elements within the list.
* When defined alongside type being array (outside the items), it will affect the wrapping element
* and only if wrapped is true. If wrapped is false, it will affect the items within the array.
* *
* | Version | Reference |
* |---|-----|
* | 3.0.4 | {@link https://spec.openapis.org/oas/v3.0.4#xml-object | OpenAPI 3.0.4 XML Object - name} |
* | 3.0.3 | {@link https://spec.openapis.org/oas/v3.0.3#xml-object | OpenAPI 3.0.3 XML Object - name} |
* | 3.0.2 | {@link https://spec.openapis.org/oas/v3.0.2#xml-object | OpenAPI 3.0.2 XML Object - name} |
* | 3.0.1 | {@link https://spec.openapis.org/oas/v3.0.1#xml-object | OpenAPI 3.0.1 XML Object - name} |
* | 3.0.0 | {@link https://spec.openapis.org/oas/v3.0.0#xml-object | OpenAPI 3.0.0 XML Object - name} |
* @property `name` - Optional Replaces the name of the element/attribute used for the described schema property
*
* @example "animal"
* @example "item"
*/
name?: string;
/**
* The URL of the namespace definition. Value SHOULD be in the form of a URL.
* *
* | Version | Reference |
* |---|-----|
* | 3.0.4 | {@link https://spec.openapis.org/oas/v3.0.4#xml-object | OpenAPI 3.0.4 XML Object - namespace} |
* | 3.0.3 | {@link https://spec.openapis.org/oas/v3.0.3#xml-object | OpenAPI 3.0.3 XML Object - namespace} |
* | 3.0.2 | {@link https://spec.openapis.org/oas/v3.0.2#xml-object | OpenAPI 3.0.2 XML Object - namespace} |
* | 3.0.1 | {@link https://spec.openapis.org/oas/v3.0.1#xml-object | OpenAPI 3.0.1 XML Object - namespace} |
* | 3.0.0 | {@link https://spec.openapis.org/oas/v3.0.0#xml-object | OpenAPI 3.0.0 XML Object - namespace} |
* @property `namespace` - Optional The URL of the namespace definition
*
* @example "http://example.com/schema"
* @example "http://www.w3.org/XML/1998/namespace"
*/
namespace?: string;
/**
* The URL of the namespace definition. Value SHOULD be in the form of a URL.
* *
* | Version | Reference |
* |---|-----|
* | 3.0.4 | {@link https://spec.openapis.org/oas/v3.0.4#xml-object | OpenAPI 3.0.4 XML Object - namespace} |
* | 3.0.3 | {@link https://spec.openapis.org/oas/v3.0.3#xml-object | OpenAPI 3.0.3 XML Object - namespace} |
* | 3.0.2 | {@link https://spec.openapis.org/oas/v3.0.2#xml-object | OpenAPI 3.0.2 XML Object - namespace} |
* | 3.0.1 | {@link https://spec.openapis.org/oas/v3.0.1#xml-object | OpenAPI 3.0.1 XML Object - namespace} |
* | 3.0.0 | {@link https://spec.openapis.org/oas/v3.0.0#xml-object | OpenAPI 3.0.0 XML Object - namespace} |
* @property `namespace` - Optional The URL of the namespace definition
*
* @example "http://example.com/schema"
* @example "http://www.w3.org/XML/1998/namespace"
*/
namespace?: string;
/**
* The prefix to be used for the name.
* *
* | Version | Reference |
* |---|-----|
* | 3.0.4 | {@link https://spec.openapis.org/oas/v3.0.4#xml-object | OpenAPI 3.0.4 XML Object - prefix} |
* | 3.0.3 | {@link https://spec.openapis.org/oas/v3.0.3#xml-object | OpenAPI 3.0.3 XML Object - prefix} |
* | 3.0.2 | {@link https://spec.openapis.org/oas/v3.0.2#xml-object | OpenAPI 3.0.2 XML Object - prefix} |
* | 3.0.1 | {@link https://spec.openapis.org/oas/v3.0.1#xml-object | OpenAPI 3.0.1 XML Object - prefix} |
* | 3.0.0 | {@link https://spec.openapis.org/oas/v3.0.0#xml-object | OpenAPI 3.0.0 XML Object - prefix} |
* @property `prefix` - Optional The prefix to be used for the name
*
* @example "xs"
* @example "ns"
*/
prefix?: string;
/**
* The prefix to be used for the name.
* *
* | Version | Reference |
* |---|-----|
* | 3.0.4 | {@link https://spec.openapis.org/oas/v3.0.4#xml-object | OpenAPI 3.0.4 XML Object - prefix} |
* | 3.0.3 | {@link https://spec.openapis.org/oas/v3.0.3#xml-object | OpenAPI 3.0.3 XML Object - prefix} |
* | 3.0.2 | {@link https://spec.openapis.org/oas/v3.0.2#xml-object | OpenAPI 3.0.2 XML Object - prefix} |
* | 3.0.1 | {@link https://spec.openapis.org/oas/v3.0.1#xml-object | OpenAPI 3.0.1 XML Object - prefix} |
* | 3.0.0 | {@link https://spec.openapis.org/oas/v3.0.0#xml-object | OpenAPI 3.0.0 XML Object - prefix} |
* @property `prefix` - Optional The prefix to be used for the name
*
* @example "xs"
* @example "ns"
*/
prefix?: string;
/**
* Declares whether the property definition translates to an attribute instead of an element.
* Default value is false.
* *
* | Version | Reference |
* |---|-----|
* | 3.0.4 | {@link https://spec.openapis.org/oas/v3.0.4#xml-object | OpenAPI 3.0.4 XML Object - attribute} |
* | 3.0.3 | {@link https://spec.openapis.org/oas/v3.0.3#xml-object | OpenAPI 3.0.3 XML Object - attribute} |
* | 3.0.2 | {@link https://spec.openapis.org/oas/v3.0.2#xml-object | OpenAPI 3.0.2 XML Object - attribute} |
* | 3.0.1 | {@link https://spec.openapis.org/oas/v3.0.1#xml-object | OpenAPI 3.0.1 XML Object - attribute} |
* | 3.0.0 | {@link https://spec.openapis.org/oas/v3.0.0#xml-object | OpenAPI 3.0.0 XML Object - attribute} |
* @property `attribute` - Optional Declares whether the property definition translates to an attribute instead of an element
*
* @example true
* @example false
*/
attribute?: boolean;
/**
* Declares whether the property definition translates to an attribute instead of an element.
* Default value is false.
* *
* | Version | Reference |
* |---|-----|
* | 3.0.4 | {@link https://spec.openapis.org/oas/v3.0.4#xml-object | OpenAPI 3.0.4 XML Object - attribute} |
* | 3.0.3 | {@link https://spec.openapis.org/oas/v3.0.3#xml-object | OpenAPI 3.0.3 XML Object - attribute} |
* | 3.0.2 | {@link https://spec.openapis.org/oas/v3.0.2#xml-object | OpenAPI 3.0.2 XML Object - attribute} |
* | 3.0.1 | {@link https://spec.openapis.org/oas/v3.0.1#xml-object | OpenAPI 3.0.1 XML Object - attribute} |
* | 3.0.0 | {@link https://spec.openapis.org/oas/v3.0.0#xml-object | OpenAPI 3.0.0 XML Object - attribute} |
* @property `attribute` - Optional Declares whether the property definition translates to an attribute instead of an element
*
* @example true
* @example false
*/
attribute?: boolean;
/**
* MAY be used only for an array definition. Signifies whether the array is wrapped (for example,
* <books><book/><book/></books>) or unwrapped (<book/><book/>). Default value is false.
* The definition takes effect only when defined alongside type being array (outside the items).
* *
* | Version | Reference |
* |---|-----|
* | 3.0.4 | {@link https://spec.openapis.org/oas/v3.0.4#xml-object | OpenAPI 3.0.4 XML Object - wrapped} |
* | 3.0.3 | {@link https://spec.openapis.org/oas/v3.0.3#xml-object | OpenAPI 3.0.3 XML Object - wrapped} |
* | 3.0.2 | {@link https://spec.openapis.org/oas/v3.0.2#xml-object | OpenAPI 3.0.2 XML Object - wrapped} |
* | 3.0.1 | {@link https://spec.openapis.org/oas/v3.0.1#xml-object | OpenAPI 3.0.1 XML Object - wrapped} |
* | 3.0.0 | {@link https://spec.openapis.org/oas/v3.0.0#xml-object | OpenAPI 3.0.0 XML Object - wrapped} |
* @property `wrapped` - Optional MAY be used only for an array definition. Signifies whether the array is wrapped
*
* @example true
* @example false
*/
wrapped?: boolean;
/**
* MAY be used only for an array definition. Signifies whether the array is wrapped (for example,
* <books><book/><book/></books>) or unwrapped (<book/><book/>). Default value is false.
* The definition takes effect only when defined alongside type being array (outside the items).
* *
* | Version | Reference |
* |---|-----|
* | 3.0.4 | {@link https://spec.openapis.org/oas/v3.0.4#xml-object | OpenAPI 3.0.4 XML Object - wrapped} |
* | 3.0.3 | {@link https://spec.openapis.org/oas/v3.0.3#xml-object | OpenAPI 3.0.3 XML Object - wrapped} |
* | 3.0.2 | {@link https://spec.openapis.org/oas/v3.0.2#xml-object | OpenAPI 3.0.2 XML Object - wrapped} |
* | 3.0.1 | {@link https://spec.openapis.org/oas/v3.0.1#xml-object | OpenAPI 3.0.1 XML Object - wrapped} |
* | 3.0.0 | {@link https://spec.openapis.org/oas/v3.0.0#xml-object | OpenAPI 3.0.0 XML Object - wrapped} |
* @property `wrapped` - Optional MAY be used only for an array definition. Signifies whether the array is wrapped
*
* @example true
* @example false
*/
wrapped?: boolean;
}

View File

@@ -1,13 +1,13 @@
import type { Extension } from "./extensions";
import type {
Callback,
Example,
Header,
Link,
Parameter,
PathItemObject,
RequestBody,
Response,
Callback,
Example,
Header,
Link,
Parameter,
PathItem,
RequestBody,
Response,
} from "./paths";
import type { Reference } from "./references";
import type { Schema } from "./schema";
@@ -71,73 +71,73 @@ import type { SecurityScheme } from "./security";
* ```
*/
export interface Components extends Extension {
/**
* An object to hold reusable Schema Objects.
*
* @example { User: { type: "object", properties: { id: { type: "integer" } } } }
*/
schemas?: Record<string, Schema | Reference>;
/**
* An object to hold reusable Schema Objects.
*
* @example { User: { type: "object", properties: { id: { type: "integer" } } } }
*/
schemas?: Record<string, Schema | Reference>;
/**
* An object to hold reusable Response Objects.
*
* @example { NotFound: { description: "Resource not found" } }
*/
responses?: Record<string, Response | Reference>;
/**
* An object to hold reusable Response Objects.
*
* @example { NotFound: { description: "Resource not found" } }
*/
responses?: Record<string, Response | Reference>;
/**
* An object to hold reusable Parameter Objects.
*
* @example { UserId: { name: "userId", in: "path", required: true, schema: { type: "string" } } }
*/
parameters?: Record<string, Parameter | Reference>;
/**
* An object to hold reusable Parameter Objects.
*
* @example { UserId: { name: "userId", in: "path", required: true, schema: { type: "string" } } }
*/
parameters?: Record<string, Parameter | Reference>;
/**
* An object to hold reusable Example Objects.
*
* @example { UserExample: { value: { id: 1, name: "John Doe" } } }
*/
examples?: Record<string, Example | Reference>;
/**
* An object to hold reusable Example Objects.
*
* @example { UserExample: { value: { id: 1, name: "John Doe" } } }
*/
examples?: Record<string, Example | Reference>;
/**
* An object to hold reusable Request Body Objects.
*
* @example { UserRequestBody: { description: "User data", content: { "application/json": { schema: { $ref: "#/components/schemas/User" } } } } }
*/
requestBodies?: Record<string, RequestBody | Reference>;
/**
* An object to hold reusable Request Body Objects.
*
* @example { UserRequestBody: { description: "User data", content: { "application/json": { schema: { $ref: "#/components/schemas/User" } } } } }
*/
requestBodies?: Record<string, RequestBody | Reference>;
/**
* An object to hold reusable Header Objects.
*
* @example { RateLimit: { description: "Rate limit per hour", schema: { type: "integer" } } }
*/
headers?: Record<string, Header | Reference>;
/**
* An object to hold reusable Header Objects.
*
* @example { RateLimit: { description: "Rate limit per hour", schema: { type: "integer" } } }
*/
headers?: Record<string, Header | Reference>;
/**
* An object to hold reusable Security Scheme Objects.
*
* @example { ApiKeyAuth: { type: "apiKey", in: "header", name: "X-API-KEY" } }
*/
securitySchemes?: Record<string, SecurityScheme | Reference>;
/**
* An object to hold reusable Security Scheme Objects.
*
* @example { ApiKeyAuth: { type: "apiKey", in: "header", name: "X-API-KEY" } }
*/
securitySchemes?: Record<string, SecurityScheme | Reference>;
/**
* An object to hold reusable Link Objects.
*
* @example { UserOrders: { operationId: "getOrdersByUserId", parameters: { userId: "$response.body#/id" } } }
*/
links?: Record<string, Link | Reference>;
/**
* An object to hold reusable Link Objects.
*
* @example { UserOrders: { operationId: "getOrdersByUserId", parameters: { userId: "$response.body#/id" } } }
*/
links?: Record<string, Link | Reference>;
/**
* An object to hold reusable Callback Objects.
*
* @example { UserCreatedCallback: { "{$request.body#/callbackUrl}": { post: { requestBody: { description: "User created event" } } } } }
*/
callbacks?: Record<string, Callback | Reference>;
/**
* An object to hold reusable Callback Objects.
*
* @example { UserCreatedCallback: { "{$request.body#/callbackUrl}": { post: { requestBody: { description: "User created event" } } } } }
*/
callbacks?: Record<string, Callback | Reference>;
/**
* An object to hold reusable Path Item Objects.
*
* @example { UserPath: { get: { summary: "Get user by ID" } } }
*/
pathItems?: Record<string, PathItemObject | Reference>;
/**
* An object to hold reusable Path Item Objects.
*
* @example { UserPath: { get: { summary: "Get user by ID" } } }
*/
pathItems?: Record<string, PathItem | Reference>;
}

View File

@@ -1,4 +1,5 @@
import type { Extension } from "../extensions";
import type { XML } from "../xml";
/**
* -----
@@ -82,129 +83,137 @@ import type { Extension } from "../extensions";
* ```
*/
export interface ArraySchema extends Extension {
/**
* The type identifier for array schemas.
* Must be "array".
*/
type: "array";
/**
* The type identifier for array schemas.
* Must be "array".
*/
type: "array";
/**
* The schema for array items.
* All items in the array must conform to this schema.
*
* Example: `{ type: "string" }`
*/
items?: unknown;
/**
* The schema for array items.
* All items in the array must conform to this schema.
*
* Example: `{ type: "string" }`
*/
items?: unknown;
/**
* The schema for array items at specific positions.
* Items at position i must conform to the schema at index i.
*
* Example: `[{ type: "string" }, { type: "number" }]`
*/
prefixItems?: unknown[];
/**
* The schema for array items at specific positions.
* Items at position i must conform to the schema at index i.
*
* Example: `[{ type: "string" }, { type: "number" }]`
*/
prefixItems?: unknown[];
/**
* The schema that the array must contain at least one item matching.
* At least one item in the array must conform to this schema.
*
* Example: `{ type: "string", enum: ["admin"] }`
*/
contains?: unknown;
/**
* The schema that the array must contain at least one item matching.
* At least one item in the array must conform to this schema.
*
* Example: `{ type: "string", enum: ["admin"] }`
*/
contains?: unknown;
/**
* The minimum number of items that must match the contains schema.
* Must be a non-negative integer.
*
* Example: `1`
*/
minContains?: number;
/**
* The minimum number of items that must match the contains schema.
* Must be a non-negative integer.
*
* Example: `1`
*/
minContains?: number;
/**
* The maximum number of items that must match the contains schema.
* Must be a non-negative integer.
*
* Example: `5`
*/
maxContains?: number;
/**
* The maximum number of items that must match the contains schema.
* Must be a non-negative integer.
*
* Example: `5`
*/
maxContains?: number;
/**
* The minimum number of items in the array.
* Must be a non-negative integer.
*
* Example: `1`
*/
minItems?: number;
/**
* The minimum number of items in the array.
* Must be a non-negative integer.
*
* Example: `1`
*/
minItems?: number;
/**
* The maximum number of items in the array.
* Must be a non-negative integer.
*
* Example: `10`
*/
maxItems?: number;
/**
* The maximum number of items in the array.
* Must be a non-negative integer.
*
* Example: `10`
*/
maxItems?: number;
/**
* Whether array items must be unique.
* If true, all items in the array must be unique.
*
* Example: `true`
*/
uniqueItems?: boolean;
/**
* Whether array items must be unique.
* If true, all items in the array must be unique.
*
* Example: `true`
*/
uniqueItems?: boolean;
/**
* An array of allowed values for the array.
* The value must be one of the values in this array.
*
* Example: `[["a", "b"], ["c", "d"]]`
*/
enum?: unknown[];
/**
* An array of allowed values for the array.
* The value must be one of the values in this array.
*
* Example: `[["a", "b"], ["c", "d"]]`
*/
enum?: unknown[];
/**
* A single allowed value for the array.
* The value must be exactly this value.
*
* Example: `["a", "b"]`
*/
const?: unknown;
/**
* A single allowed value for the array.
* The value must be exactly this value.
*
* Example: `["a", "b"]`
*/
const?: unknown;
/**
* An example value for the array.
* This is for documentation purposes only.
*
* Example: `["a", "b"]`
*/
example?: unknown[];
/**
* An example value for the array.
* This is for documentation purposes only.
*
* Example: `["a", "b"]`
*/
example?: unknown[];
/**
* An array of example values for the array.
* These are for documentation purposes only.
*
* Example: `[["a", "b"], ["c", "d"]]`
*/
examples?: unknown[][];
/**
* An array of example values for the array.
* These are for documentation purposes only.
*
* Example: `[["a", "b"], ["c", "d"]]`
*/
examples?: unknown[][];
/**
* The default value for the array.
* This value will be used if no value is provided.
*
* Example: `[]`
*/
default?: unknown[];
/**
* The default value for the array.
* This value will be used if no value is provided.
*
* Example: `[]`
*/
default?: unknown[];
/**
* A short title for the schema.
* This is for documentation purposes only.
*
* Example: `"User Tags"`
*/
title?: string;
/**
* A short title for the schema.
* This is for documentation purposes only.
*
* Example: `"User Tags"`
*/
title?: string;
/**
* A description of the schema.
* CommonMark syntax MAY be used for rich text representation.
*
* Example: `"Array of user tags"`
*/
description?: string;
/**
* A description of the schema.
* CommonMark syntax MAY be used for rich text representation.
*
* Example: `"Array of user tags"`
*/
description?: string;
/**
* XML representation metadata for the schema.
* Allows for fine-tuned XML model definitions.
*
* Example: `{ name: "users", wrapped: true }`
*/
xml?: XML;
}

View File

@@ -1,4 +1,5 @@
import type { Extension } from "../extensions";
import type { XML } from "../xml";
/**
* -----
@@ -65,65 +66,73 @@ import type { Extension } from "../extensions";
* ```
*/
export interface BooleanSchema extends Extension {
/**
* The type identifier for boolean schemas.
* Must be "boolean".
*/
type: "boolean";
/**
* The type identifier for boolean schemas.
* Must be "boolean".
*/
type: "boolean";
/**
* An array of allowed values for the boolean.
* The value must be one of the values in this array.
*
* Example: `[true, false]`
*/
enum?: boolean[];
/**
* An array of allowed values for the boolean.
* The value must be one of the values in this array.
*
* Example: `[true, false]`
*/
enum?: boolean[];
/**
* A single allowed value for the boolean.
* The value must be exactly this value.
*
* Example: `true`
*/
const?: boolean;
/**
* A single allowed value for the boolean.
* The value must be exactly this value.
*
* Example: `true`
*/
const?: boolean;
/**
* An example value for the boolean.
* This is for documentation purposes only.
*
* Example: `true`
*/
example?: boolean;
/**
* An example value for the boolean.
* This is for documentation purposes only.
*
* Example: `true`
*/
example?: boolean;
/**
* An array of example values for the boolean.
* These are for documentation purposes only.
*
* Example: `[true, false]`
*/
examples?: boolean[];
/**
* An array of example values for the boolean.
* These are for documentation purposes only.
*
* Example: `[true, false]`
*/
examples?: boolean[];
/**
* The default value for the boolean.
* This value will be used if no value is provided.
*
* Example: `false`
*/
default?: boolean;
/**
* The default value for the boolean.
* This value will be used if no value is provided.
*
* Example: `false`
*/
default?: boolean;
/**
* A short title for the schema.
* This is for documentation purposes only.
*
* Example: `"Is Active"`
*/
title?: string;
/**
* A short title for the schema.
* This is for documentation purposes only.
*
* Example: `"Is Active"`
*/
title?: string;
/**
* A description of the schema.
* CommonMark syntax MAY be used for rich text representation.
*
* Example: `"Whether the user is active"`
*/
description?: string;
/**
* A description of the schema.
* CommonMark syntax MAY be used for rich text representation.
*
* Example: `"Whether the user is active"`
*/
description?: string;
/**
* XML representation metadata for the schema.
* Allows for fine-tuned XML model definitions.
*
* Example: `{ name: "isActive", attribute: false }`
*/
xml?: XML;
}

View File

@@ -1,4 +1,5 @@
import type { Extension } from "../extensions";
import type { XML } from "../xml";
/**
* -----
@@ -83,115 +84,123 @@ import type { Extension } from "../extensions";
* ```
*/
export interface CompositionSchema extends Extension {
/**
* An array of schemas that must all be satisfied.
* The value must conform to all schemas in the array.
*
* Example: `[{ type: "object" }, { properties: { name: { type: "string" } } }]`
*/
allOf?: unknown[];
/**
* An array of schemas that must all be satisfied.
* The value must conform to all schemas in the array.
*
* Example: `[{ type: "object" }, { properties: { name: { type: "string" } } }]`
*/
allOf?: unknown[];
/**
* An array of schemas where at least one must be satisfied.
* The value must conform to at least one schema in the array.
*
* Example: `[{ type: "string" }, { type: "number" }]`
*/
anyOf?: unknown[];
/**
* An array of schemas where at least one must be satisfied.
* The value must conform to at least one schema in the array.
*
* Example: `[{ type: "string" }, { type: "number" }]`
*/
anyOf?: unknown[];
/**
* An array of schemas where exactly one must be satisfied.
* The value must conform to exactly one schema in the array.
*
* Example: `[{ type: "string" }, { type: "number" }]`
*/
oneOf?: unknown[];
/**
* An array of schemas where exactly one must be satisfied.
* The value must conform to exactly one schema in the array.
*
* Example: `[{ type: "string" }, { type: "number" }]`
*/
oneOf?: unknown[];
/**
* A schema that must not be satisfied.
* The value must not conform to this schema.
*
* Example: `{ type: "string" }`
*/
not?: unknown;
/**
* A schema that must not be satisfied.
* The value must not conform to this schema.
*
* Example: `{ type: "string" }`
*/
not?: unknown;
/**
* A schema for conditional validation.
* Used with `then` and `else` for conditional logic.
*
* Example: `{ type: "object", properties: { type: { const: "user" } } }`
*/
if?: unknown;
/**
* A schema for conditional validation.
* Used with `then` and `else` for conditional logic.
*
* Example: `{ type: "object", properties: { type: { const: "user" } } }`
*/
if?: unknown;
/**
* A schema to apply if the `if` condition is met.
* The value must conform to this schema if the `if` schema is satisfied.
*
* Example: `{ type: "object", properties: { name: { type: "string" } } }`
*/
then?: unknown;
/**
* A schema to apply if the `if` condition is met.
* The value must conform to this schema if the `if` schema is satisfied.
*
* Example: `{ type: "object", properties: { name: { type: "string" } } }`
*/
then?: unknown;
/**
* A schema to apply if the `if` condition is not met.
* The value must conform to this schema if the `if` schema is not satisfied.
*
* Example: `{ type: "object", properties: { id: { type: "string" } } }`
*/
else?: unknown;
/**
* A schema to apply if the `if` condition is not met.
* The value must conform to this schema if the `if` schema is not satisfied.
*
* Example: `{ type: "object", properties: { id: { type: "string" } } }`
*/
else?: unknown;
/**
* An array of allowed values.
* The value must be one of the values in this array.
*
* Example: `["active", "inactive"]`
*/
enum?: unknown[];
/**
* An array of allowed values.
* The value must be one of the values in this array.
*
* Example: `["active", "inactive"]`
*/
enum?: unknown[];
/**
* A single allowed value.
* The value must be exactly this value.
*
* Example: `"active"`
*/
const?: unknown;
/**
* A single allowed value.
* The value must be exactly this value.
*
* Example: `"active"`
*/
const?: unknown;
/**
* An example value for the composition.
* This is for documentation purposes only.
*
* Example: `"example"`
*/
example?: unknown;
/**
* An example value for the composition.
* This is for documentation purposes only.
*
* Example: `"example"`
*/
example?: unknown;
/**
* An array of example values.
* These are for documentation purposes only.
*
* Example: `["example1", "example2"]`
*/
examples?: unknown[];
/**
* An array of example values.
* These are for documentation purposes only.
*
* Example: `["example1", "example2"]`
*/
examples?: unknown[];
/**
* The default value.
* This value will be used if no value is provided.
*
* Example: `"default"`
*/
default?: unknown;
/**
* The default value.
* This value will be used if no value is provided.
*
* Example: `"default"`
*/
default?: unknown;
/**
* A short title for the schema.
* This is for documentation purposes only.
*
* Example: `"Composed Schema"`
*/
title?: string;
/**
* A short title for the schema.
* This is for documentation purposes only.
*
* Example: `"Composed Schema"`
*/
title?: string;
/**
* A description of the schema.
* CommonMark syntax MAY be used for rich text representation.
*
* Example: `"A schema composed of multiple schemas"`
*/
description?: string;
/**
* A description of the schema.
* CommonMark syntax MAY be used for rich text representation.
*
* Example: `"A schema composed of multiple schemas"`
*/
description?: string;
/**
* XML representation metadata for the schema.
* Allows for fine-tuned XML model definitions.
*
* Example: `{ name: "composedSchema", attribute: false }`
*/
xml?: XML;
}

View File

@@ -1,4 +1,5 @@
import type { Extension } from "../extensions";
import type { XML } from "../xml";
/**
* -----
@@ -74,113 +75,121 @@ import type { Extension } from "../extensions";
* ```
*/
export interface IntegerSchema extends Extension {
/**
* The type identifier for integer schemas.
* Must be "integer".
*/
type: "integer";
/**
* The type identifier for integer schemas.
* Must be "integer".
*/
type: "integer";
/**
* The format of the integer.
* See OpenAPI 3.1.x Data Type Formats for further details.
*
* Example: `"int32"`, `"int64"`
*/
format?: string;
/**
* The format of the integer.
* See OpenAPI 3.1.x Data Type Formats for further details.
*
* Example: `"int32"`, `"int64"`
*/
format?: string;
/**
* The integer must be a multiple of this value.
* Must be a positive integer.
*
* Example: `5`
*/
multipleOf?: number;
/**
* The integer must be a multiple of this value.
* Must be a positive integer.
*
* Example: `5`
*/
multipleOf?: number;
/**
* The maximum value of the integer (inclusive).
* The integer must be less than or equal to this value.
*
* Example: `100`
*/
maximum?: number;
/**
* The maximum value of the integer (inclusive).
* The integer must be less than or equal to this value.
*
* Example: `100`
*/
maximum?: number;
/**
* The minimum value of the integer (inclusive).
* The integer must be greater than or equal to this value.
*
* Example: `0`
*/
minimum?: number;
/**
* The minimum value of the integer (inclusive).
* The integer must be greater than or equal to this value.
*
* Example: `0`
*/
minimum?: number;
/**
* The maximum value of the integer (exclusive).
* The integer must be less than this value.
*
* Example: `100`
*/
exclusiveMaximum?: number;
/**
* The maximum value of the integer (exclusive).
* The integer must be less than this value.
*
* Example: `100`
*/
exclusiveMaximum?: number;
/**
* The minimum value of the integer (exclusive).
* The integer must be greater than this value.
*
* Example: `0`
*/
exclusiveMinimum?: number;
/**
* The minimum value of the integer (exclusive).
* The integer must be greater than this value.
*
* Example: `0`
*/
exclusiveMinimum?: number;
/**
* An array of allowed values for the integer.
* The value must be one of the values in this array.
*
* Example: `[1, 2, 3, 4, 5]`
*/
enum?: number[];
/**
* An array of allowed values for the integer.
* The value must be one of the values in this array.
*
* Example: `[1, 2, 3, 4, 5]`
*/
enum?: number[];
/**
* A single allowed value for the integer.
* The value must be exactly this value.
*
* Example: `42`
*/
const?: number;
/**
* A single allowed value for the integer.
* The value must be exactly this value.
*
* Example: `42`
*/
const?: number;
/**
* An example value for the integer.
* This is for documentation purposes only.
*
* Example: `42`
*/
example?: number;
/**
* An example value for the integer.
* This is for documentation purposes only.
*
* Example: `42`
*/
example?: number;
/**
* An array of example values for the integer.
* These are for documentation purposes only.
*
* Example: `[1, 2, 3]`
*/
examples?: number[];
/**
* An array of example values for the integer.
* These are for documentation purposes only.
*
* Example: `[1, 2, 3]`
*/
examples?: number[];
/**
* The default value for the integer.
* This value will be used if no value is provided.
*
* Example: `0`
*/
default?: number;
/**
* The default value for the integer.
* This value will be used if no value is provided.
*
* Example: `0`
*/
default?: number;
/**
* A short title for the schema.
* This is for documentation purposes only.
*
* Example: `"User ID"`
*/
title?: string;
/**
* A short title for the schema.
* This is for documentation purposes only.
*
* Example: `"User ID"`
*/
title?: string;
/**
* A description of the schema.
* CommonMark syntax MAY be used for rich text representation.
*
* Example: `"The unique identifier of the user"`
*/
description?: string;
/**
* A description of the schema.
* CommonMark syntax MAY be used for rich text representation.
*
* Example: `"The unique identifier of the user"`
*/
description?: string;
/**
* XML representation metadata for the schema.
* Allows for fine-tuned XML model definitions.
*
* Example: `{ name: "userId", attribute: false }`
*/
xml?: XML;
}

View File

@@ -1,4 +1,5 @@
import type { Extension } from "../extensions";
import type { XML } from "../xml";
/**
* -----
@@ -74,113 +75,121 @@ import type { Extension } from "../extensions";
* ```
*/
export interface NumberSchema extends Extension {
/**
* The type identifier for number schemas.
* Must be "number".
*/
type: "number";
/**
* The type identifier for number schemas.
* Must be "number".
*/
type: "number";
/**
* The format of the number.
* See OpenAPI 3.1.x Data Type Formats for further details.
*
* Example: `"float"`, `"double"`
*/
format?: string;
/**
* The format of the number.
* See OpenAPI 3.1.x Data Type Formats for further details.
*
* Example: `"float"`, `"double"`
*/
format?: string;
/**
* The number must be a multiple of this value.
* Must be a positive number.
*
* Example: `0.5`
*/
multipleOf?: number;
/**
* The number must be a multiple of this value.
* Must be a positive number.
*
* Example: `0.5`
*/
multipleOf?: number;
/**
* The maximum value of the number (inclusive).
* The number must be less than or equal to this value.
*
* Example: `100`
*/
maximum?: number;
/**
* The maximum value of the number (inclusive).
* The number must be less than or equal to this value.
*
* Example: `100`
*/
maximum?: number;
/**
* The minimum value of the number (inclusive).
* The number must be greater than or equal to this value.
*
* Example: `0`
*/
minimum?: number;
/**
* The minimum value of the number (inclusive).
* The number must be greater than or equal to this value.
*
* Example: `0`
*/
minimum?: number;
/**
* The maximum value of the number (exclusive).
* The number must be less than this value.
*
* Example: `100`
*/
exclusiveMaximum?: number;
/**
* The maximum value of the number (exclusive).
* The number must be less than this value.
*
* Example: `100`
*/
exclusiveMaximum?: number;
/**
* The minimum value of the number (exclusive).
* The number must be greater than this value.
*
* Example: `0`
*/
exclusiveMinimum?: number;
/**
* The minimum value of the number (exclusive).
* The number must be greater than this value.
*
* Example: `0`
*/
exclusiveMinimum?: number;
/**
* An array of allowed values for the number.
* The value must be one of the values in this array.
*
* Example: `[1, 2, 3, 4, 5]`
*/
enum?: number[];
/**
* An array of allowed values for the number.
* The value must be one of the values in this array.
*
* Example: `[1, 2, 3, 4, 5]`
*/
enum?: number[];
/**
* A single allowed value for the number.
* The value must be exactly this value.
*
* Example: `42`
*/
const?: number;
/**
* A single allowed value for the number.
* The value must be exactly this value.
*
* Example: `42`
*/
const?: number;
/**
* An example value for the number.
* This is for documentation purposes only.
*
* Example: `42`
*/
example?: number;
/**
* An example value for the number.
* This is for documentation purposes only.
*
* Example: `42`
*/
example?: number;
/**
* An array of example values for the number.
* These are for documentation purposes only.
*
* Example: `[1.5, 2.7, 3.14]`
*/
examples?: number[];
/**
* An array of example values for the number.
* These are for documentation purposes only.
*
* Example: `[1.5, 2.7, 3.14]`
*/
examples?: number[];
/**
* The default value for the number.
* This value will be used if no value is provided.
*
* Example: `0`
*/
default?: number;
/**
* The default value for the number.
* This value will be used if no value is provided.
*
* Example: `0`
*/
default?: number;
/**
* A short title for the schema.
* This is for documentation purposes only.
*
* Example: `"Price"`
*/
title?: string;
/**
* A short title for the schema.
* This is for documentation purposes only.
*
* Example: `"Price"`
*/
title?: string;
/**
* A description of the schema.
* CommonMark syntax MAY be used for rich text representation.
*
* Example: `"The price of the item"`
*/
description?: string;
/**
* A description of the schema.
* CommonMark syntax MAY be used for rich text representation.
*
* Example: `"The price of the item"`
*/
description?: string;
/**
* XML representation metadata for the schema.
* Allows for fine-tuned XML model definitions.
*
* Example: `{ name: "price", attribute: false }`
*/
xml?: XML;
}

View File

@@ -1,4 +1,5 @@
import type { Extension } from "../extensions";
import type { XML } from "../xml";
/**
* -----
@@ -87,139 +88,147 @@ import type { Extension } from "../extensions";
* ```
*/
export interface ObjectSchema extends Extension {
/**
* The type identifier for object schemas.
* Must be "object".
*/
type: "object";
/**
* The type identifier for object schemas.
* Must be "object".
*/
type: "object";
/**
* A map of property names to their schemas.
* Each property in the object must conform to its corresponding schema.
*
* Example: `{ name: { type: "string" }, age: { type: "number" } }`
*/
properties?: Record<string, unknown>;
/**
* A map of property names to their schemas.
* Each property in the object must conform to its corresponding schema.
*
* Example: `{ name: { type: "string" }, age: { type: "number" } }`
*/
properties?: Record<string, unknown>;
/**
* An array of required property names.
* These properties must be present in the object.
*
* Example: `["name", "email"]`
*/
required?: string[];
/**
* An array of required property names.
* These properties must be present in the object.
*
* Example: `["name", "email"]`
*/
required?: string[];
/**
* The schema for additional properties not defined in properties.
* If false, no additional properties are allowed.
* If true, any additional properties are allowed.
* If a schema, additional properties must conform to this schema.
*
* Example: `{ type: "string" }` or `false` or `true`
*/
additionalProperties?: unknown | boolean;
/**
* The schema for additional properties not defined in properties.
* If false, no additional properties are allowed.
* If true, any additional properties are allowed.
* If a schema, additional properties must conform to this schema.
*
* Example: `{ type: "string" }` or `false` or `true`
*/
additionalProperties?: unknown | boolean;
/**
* A map of regex patterns to schemas.
* Properties whose names match a pattern must conform to the corresponding schema.
*
* Example: `{ "^S_": { type: "string" } }`
*/
patternProperties?: Record<string, unknown>;
/**
* A map of regex patterns to schemas.
* Properties whose names match a pattern must conform to the corresponding schema.
*
* Example: `{ "^S_": { type: "string" } }`
*/
patternProperties?: Record<string, unknown>;
/**
* The schema for property names.
* All property names in the object must conform to this schema.
*
* Example: `{ type: "string", pattern: "^[A-Za-z][A-Za-z0-9]*$" }`
*/
propertyNames?: unknown;
/**
* The schema for property names.
* All property names in the object must conform to this schema.
*
* Example: `{ type: "string", pattern: "^[A-Za-z][A-Za-z0-9]*$" }`
*/
propertyNames?: unknown;
/**
* The minimum number of properties in the object.
* Must be a non-negative integer.
*
* Example: `1`
*/
minProperties?: number;
/**
* The minimum number of properties in the object.
* Must be a non-negative integer.
*
* Example: `1`
*/
minProperties?: number;
/**
* The maximum number of properties in the object.
* Must be a non-negative integer.
*
* Example: `10`
*/
maxProperties?: number;
/**
* The maximum number of properties in the object.
* Must be a non-negative integer.
*
* Example: `10`
*/
maxProperties?: number;
/**
* A map of property names to arrays of required properties.
* If a property is present, the properties in its array must also be present.
*
* Example: `{ credit_card: ["billing_address"] }`
*/
dependentRequired?: Record<string, string[]>;
/**
* A map of property names to arrays of required properties.
* If a property is present, the properties in its array must also be present.
*
* Example: `{ credit_card: ["billing_address"] }`
*/
dependentRequired?: Record<string, string[]>;
/**
* A map of property names to schemas.
* If a property is present, the object must conform to the corresponding schema.
*
* Example: `{ credit_card: { type: "object", properties: { number: { type: "string" } } } }`
*/
dependentSchemas?: Record<string, unknown>;
/**
* A map of property names to schemas.
* If a property is present, the object must conform to the corresponding schema.
*
* Example: `{ credit_card: { type: "object", properties: { number: { type: "string" } } } }`
*/
dependentSchemas?: Record<string, unknown>;
/**
* An array of allowed values for the object.
* The value must be one of the values in this array.
*
* Example: `[{ name: "John" }, { name: "Jane" }]`
*/
enum?: Record<string, unknown>[];
/**
* An array of allowed values for the object.
* The value must be one of the values in this array.
*
* Example: `[{ name: "John" }, { name: "Jane" }]`
*/
enum?: Record<string, unknown>[];
/**
* A single allowed value for the object.
* The value must be exactly this value.
*
* Example: `{ name: "John" }`
*/
const?: Record<string, unknown>;
/**
* A single allowed value for the object.
* The value must be exactly this value.
*
* Example: `{ name: "John" }`
*/
const?: Record<string, unknown>;
/**
* An example value for the object.
* This is for documentation purposes only.
*
* Example: `{ name: "John" }`
*/
example?: Record<string, unknown>;
/**
* An example value for the object.
* This is for documentation purposes only.
*
* Example: `{ name: "John" }`
*/
example?: Record<string, unknown>;
/**
* An array of example values for the object.
* These are for documentation purposes only.
*
* Example: `[{ name: "John", age: 30 }]`
*/
examples?: Record<string, unknown>[];
/**
* An array of example values for the object.
* These are for documentation purposes only.
*
* Example: `[{ name: "John", age: 30 }]`
*/
examples?: Record<string, unknown>[];
/**
* The default value for the object.
* This value will be used if no value is provided.
*
* Example: `{}`
*/
default?: Record<string, unknown>;
/**
* The default value for the object.
* This value will be used if no value is provided.
*
* Example: `{}`
*/
default?: Record<string, unknown>;
/**
* A short title for the schema.
* This is for documentation purposes only.
*
* Example: `"User"`
*/
title?: string;
/**
* A short title for the schema.
* This is for documentation purposes only.
*
* Example: `"User"`
*/
title?: string;
/**
* A description of the schema.
* CommonMark syntax MAY be used for rich text representation.
*
* Example: `"A user object"`
*/
description?: string;
/**
* A description of the schema.
* CommonMark syntax MAY be used for rich text representation.
*
* Example: `"A user object"`
*/
description?: string;
/**
* XML representation metadata for the schema.
* Allows for fine-tuned XML model definitions.
*
* Example: `{ name: "user", attribute: false }`
*/
xml?: XML;
}

View File

@@ -1,4 +1,5 @@
import type { Extension } from "../extensions";
import type { XML } from "../xml";
/**
* -----
@@ -30,6 +31,7 @@ import type { Extension } from "../extensions";
* @property `description` - Optional Description of the schema
* @property `contentMediaType` - Optional The media type of the content
* @property `contentEncoding` - Optional The encoding of the content
* @property `xml` - Optional XML representation metadata
* @property `x-${string}` - Specification Extensions
*
* @note
@@ -82,113 +84,121 @@ import type { Extension } from "../extensions";
* ```
*/
export interface StringSchema extends Extension {
/**
* The type identifier for string schemas.
* Must be "string".
*/
type: "string";
/**
* The type identifier for string schemas.
* Must be "string".
*/
type: "string";
/**
* The format of the string.
* See OpenAPI 3.1.x Data Type Formats for further details.
*
* Example: `"email"`, `"date-time"`, `"uuid"`
*/
format?: string;
/**
* The format of the string.
* See OpenAPI 3.1.x Data Type Formats for further details.
*
* Example: `"email"`, `"date-time"`, `"uuid"`
*/
format?: string;
/**
* The maximum length of the string.
* Must be a non-negative integer.
*
* Example: `255`
*/
maxLength?: number;
/**
* The maximum length of the string.
* Must be a non-negative integer.
*
* Example: `255`
*/
maxLength?: number;
/**
* The minimum length of the string.
* Must be a non-negative integer.
*
* Example: `1`
*/
minLength?: number;
/**
* The minimum length of the string.
* Must be a non-negative integer.
*
* Example: `1`
*/
minLength?: number;
/**
* A regular expression pattern that the string must match.
* Should be a valid ECMA 262 regular expression.
*
* Example: `"^[A-Za-z0-9]+$"`
*/
pattern?: string;
/**
* A regular expression pattern that the string must match.
* Should be a valid ECMA 262 regular expression.
*
* Example: `"^[A-Za-z0-9]+$"`
*/
pattern?: string;
/**
* An array of allowed values for the string.
* The value must be one of the values in this array.
*
* Example: `["active", "inactive", "pending"]`
*/
enum?: string[];
/**
* An array of allowed values for the string.
* The value must be one of the values in this array.
*
* Example: `["active", "inactive", "pending"]`
*/
enum?: string[];
/**
* A single allowed value for the string.
* The value must be exactly this value.
*
* Example: `"active"`
*/
const?: string;
/**
* A single allowed value for the string.
* The value must be exactly this value.
*
* Example: `"active"`
*/
const?: string;
/**
* An example value for the string.
* This is for documentation purposes only.
*
* Example: `"example@email.com"`
*/
example?: string;
/**
* An example value for the string.
* This is for documentation purposes only.
*
* Example: `"example@email.com"`
*/
example?: string;
/**
* An array of example values for the string.
* These are for documentation purposes only.
*
* Example: `["example@email.com", "test@domain.com"]`
*/
examples?: string[];
/**
* An array of example values for the string.
* These are for documentation purposes only.
*
* Example: `["example@email.com", "test@domain.com"]`
*/
examples?: string[];
/**
* The default value for the string.
* This value will be used if no value is provided.
*
* Example: `"default"`
*/
default?: string;
/**
* The default value for the string.
* This value will be used if no value is provided.
*
* Example: `"default"`
*/
default?: string;
/**
* A short title for the schema.
* This is for documentation purposes only.
*
* Example: `"User Email"`
*/
title?: string;
/**
* A short title for the schema.
* This is for documentation purposes only.
*
* Example: `"User Email"`
*/
title?: string;
/**
* A description of the schema.
* CommonMark syntax MAY be used for rich text representation.
*
* Example: `"The email address of the user"`
*/
description?: string;
/**
* A description of the schema.
* CommonMark syntax MAY be used for rich text representation.
*
* Example: `"The email address of the user"`
*/
description?: string;
/**
* The media type of the content. This is used to specify the media type
* of the content when the string represents encoded content.
*
* Example: `"image/png"`, `"application/json"`
*/
contentMediaType?: string;
/**
* The media type of the content. This is used to specify the media type
* of the content when the string represents encoded content.
*
* Example: `"image/png"`, `"application/json"`
*/
contentMediaType?: string;
/**
* The encoding of the content. This is used to specify how the content
* is encoded when the string represents encoded content.
*
* Example: `"base64"`, `"base64url"`, `"quoted-printable"`
*/
contentEncoding?: string;
/**
* The encoding of the content. This is used to specify how the content
* is encoded when the string represents encoded content.
*
* Example: `"base64"`, `"base64url"`, `"quoted-printable"`
*/
contentEncoding?: string;
/**
* XML representation metadata for the schema.
* Allows for fine-tuned XML model definitions.
*
* Example: `{ name: "userName", attribute: false }`
*/
xml?: XML;
}

View File

@@ -54,39 +54,44 @@ export type { Contact, Info, License } from "./info";
* @see {@link https://spec.openapis.org/oas/v3.1.1#callback-object | OpenAPI 3.1.1 Callback Object}
*/
export type {
Callback,
Encoding,
Example,
Header,
Link,
MediaType,
Operation,
Parameter,
PathItemObject,
Paths,
RequestBody,
Response,
Responses,
Callback,
Encoding,
Example,
Header,
Link,
MediaType,
Operation,
Parameter,
PathItem,
Paths,
RequestBody,
Response,
} from "./paths";
export type { Reference } from "./references";
/**
* Data type definitions.
*
* @see {@link https://spec.openapis.org/oas/v3.1.1#data-type-object | OpenAPI 3.1.1 Data Type Object}
*/
export type {
ArraySchema,
BooleanSchema,
CompositionSchema,
IntegerSchema,
NumberSchema,
ObjectSchema,
ReferenceSchema,
StringSchema,
} from "./data-types";
/**
* Schema definition types based on JSON Schema Draft 2020-12.
*
* @see {@link https://spec.openapis.org/oas/v3.1.1#schema-object | OpenAPI 3.1.1 Schema Object}
* @see {@link https://json-schema.org/draft/2020-12/json-schema-core.html | JSON Schema Draft 2020-12}
*/
export type {
ArraySchema,
BooleanSchema,
CompositionSchema,
Discriminator,
IntegerSchema,
NumberSchema,
ObjectSchema,
ReferenceSchema,
Schema,
StringSchema,
} from "./schema";
export type { Discriminator, Schema } from "./schema";
/**
* Security scheme and authentication types.
*
@@ -96,10 +101,10 @@ export type {
* @see {@link https://spec.openapis.org/oas/v3.1.1#security-requirement-object | OpenAPI 3.1.1 Security Requirement Object}
*/
export type {
OAuthFlow,
OAuthFlows,
SecurityRequirement,
SecurityScheme,
OAuthFlow,
OAuthFlows,
SecurityRequirement,
SecurityScheme,
} from "./security";
/**
* Server configuration types.
@@ -115,6 +120,13 @@ export type { Server, ServerVariable } from "./servers";
*/
export type { Specification } from "./spec";
/**
* Status code definitions.
*
* @see {@link https://spec.openapis.org/oas/v3.1.1#responses-object | OpenAPI 3.1.1 Responses Object}
*/
export type { ResponsesMap } from "./status";
/**
* Utility and metadata types.
*

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,5 @@
import type { Extension } from "./extensions";
import type { ExternalDocumentation } from "./externalDocs";
/**
* -----
@@ -54,89 +55,27 @@ import type { Extension } from "./extensions";
* ```
*/
export interface Tag extends Extension {
/**
* The name of the tag. This field is required.
*
* @example "users"
* @example "pets"
* @example "authentication"
*/
name: string;
/**
* The name of the tag. This field is required.
*
* @example "users"
* @example "pets"
* @example "authentication"
*/
name: string;
/**
* A short description for the tag. CommonMark syntax MAY be used for rich text representation.
*
* @example "User management operations"
* @example "Pet store operations"
*/
description?: string;
/**
* A short description for the tag. CommonMark syntax MAY be used for rich text representation.
*
* @example "User management operations"
* @example "Pet store operations"
*/
description?: string;
/**
* Additional external documentation for this tag.
*
* @example { description: "Find out more about user management", url: "https://example.com/docs/users" }
*/
externalDocs?: ExternalDocumentation;
}
/**
* -----
* External Documentation Object
* -----
*
* Allows referencing an external resource for extended documentation.
*
* | Version | Reference |
* |---|-----|
* | 3.1.1 | {@link https://spec.openapis.org/oas/v3.1.1#external-documentation-object | OpenAPI 3.1.1 External Documentation Object} |
* | 3.1.0 | {@link https://spec.openapis.org/oas/v3.1.0#external-documentation-object | OpenAPI 3.1.0 External Documentation Object} |
*
* -----
* Fields
* -----
*
* @property `description` - Optional A short description of the target documentation
* @property `url` - Required The URL for the target documentation
* @property `x-${string}` - Specification Extensions
*
* @note
* The `url` field is required.
*
* -----
* Examples
* -----
*
* @example (simple external docs):
* ```ts
* const externalDocs: ExternalDocumentation = {
* url: "https://example.com/docs"
* };
* ```
*
* @example (external docs with description):
* ```ts
* const externalDocs: ExternalDocumentation = {
* description: "Find out more about our API",
* url: "https://example.com/docs"
* };
* ```
*/
export interface ExternalDocumentation extends Extension {
/**
* A short description of the target documentation. CommonMark syntax MAY be used
* for rich text representation.
*
* @example "Find out more about our API"
* @example "Additional documentation for this endpoint"
*/
description?: string;
/**
* The URL for the target documentation. This field is required and MUST be in the
* format of a URL.
*
* @example "https://example.com/docs"
* @example "https://docs.example.com/api"
*/
url: string;
/**
* Additional external documentation for this tag.
*
* @example { description: "Find out more about user management", url: "https://example.com/docs/users" }
*/
externalDocs?: ExternalDocumentation;
}

View File

@@ -1,5 +1,5 @@
import type { Extension } from "./extensions";
import type { PathItemObject } from "./paths";
import type { PathItem } from "./paths";
import type { Reference } from "./references";
/**
@@ -26,7 +26,7 @@ import type { Reference } from "./references";
* -----
*
* @property `{webhookName}` - A unique string to refer to each webhook
* @property `PathItemObject` - The Path Item Object describing the webhook request
* @property `PathItem` - The Path Item Object describing the webhook request
* @property `Reference` - A reference to a Path Item Object
* @property `x-${string}` - Specification Extensions
*
@@ -128,4 +128,4 @@ import type { Reference } from "./references";
* };
* ```
*/
export type Webhooks = Record<string, PathItemObject | Reference> & Extension;
export type Webhooks = Record<string, PathItem | Reference> & Extension;

View File

@@ -27,28 +27,20 @@ import type { Extension } from "./extensions";
* @property `x-${string}` - Specification Extensions
*
* @note
* All fields are optional.
* All fields are optional. The `xml` object has no effect when placed on root schemas
* in OpenAPI 3.1.x - it only affects property schemas (nested schemas).
*
* -----
* Examples
* -----
*
* @example (simple XML):
* @example (simple XML element):
* ```ts
* const xml: XML = {
* name: "user"
* };
* ```
*
* @example (XML with namespace):
* ```ts
* const xml: XML = {
* name: "user",
* namespace: "http://example.com/schema/user",
* prefix: "user"
* };
* ```
*
* @example (XML attribute):
* ```ts
* const xml: XML = {
@@ -57,6 +49,15 @@ import type { Extension } from "./extensions";
* };
* ```
*
* @example (namespaced XML):
* ```ts
* const xml: XML = {
* name: "user",
* namespace: "http://example.com/schema/user",
* prefix: "user"
* };
* ```
*
* @example (wrapped array):
* ```ts
* const xml: XML = {
@@ -64,54 +65,61 @@ import type { Extension } from "./extensions";
* wrapped: true
* };
* ```
*
* @example (array items with custom name):
* ```ts
* const xml: XML = {
* name: "user"
* };
* ```
*/
export interface XML extends Extension {
/**
* Replaces the name of the element/attribute used for the described schema property.
* When defined within the Items Object (items), it will affect the name of the individual
* XML elements within the list. When defined alongside type being array (outside the items),
* it will affect the wrapping element and only if wrapped is true. If wrapped is false,
* it will be ignored.
*
* @example "user"
* @example "id"
* @example "users"
*/
name?: string;
/**
* Replaces the name of the element/attribute used for the described schema property.
* When defined within the Items Object (items), it will affect the name of the individual
* XML elements within the list. When defined alongside type being array (outside the items),
* it will affect the wrapping element and only if wrapped is true. If wrapped is false,
* it will be ignored.
*
* @example "user"
* @example "id"
* @example "users"
*/
name?: string;
/**
* The URI of the namespace definition. This MUST be in the form of an absolute URI.
*
* @example "http://example.com/schema/user"
* @example "http://www.w3.org/XML/1998/namespace"
*/
namespace?: string;
/**
* The URI of the namespace definition. This MUST be in the form of an absolute URI.
*
* @example "http://example.com/schema/user"
* @example "http://www.w3.org/XML/1998/namespace"
*/
namespace?: string;
/**
* The prefix to be used for the name.
*
* @example "user"
* @example "xml"
*/
prefix?: string;
/**
* The prefix to be used for the name.
*
* @example "user"
* @example "xml"
*/
prefix?: string;
/**
* Declares whether the property definition translates to an attribute instead of an element.
* Default value is false.
*
* @example true
* @example false
*/
attribute?: boolean;
/**
* Declares whether the property definition translates to an attribute instead of an element.
* Default value is false.
*
* @example true
* @example false
*/
attribute?: boolean;
/**
* MAY be used only for an array definition. Signifies whether the array is wrapped
* (for example, `<books><book/><book/></books>`) or unwrapped
* (for example, `<book/><book/>`). Default value is false. The definition takes effect
* only when defined alongside type being array (outside the items).
*
* @example true
* @example false
*/
wrapped?: boolean;
/**
* MAY be used only for an array definition. Signifies whether the array is wrapped
* (for example, `<books><book/><book/></books>`) or unwrapped
* (for example, `<book/><book/>`). Default value is false. The definition takes effect
* only when defined alongside type being array (outside the items).
*
* @example true
* @example false
*/
wrapped?: boolean;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,6 @@
import type { Extension } from "../extensions";
import type { Schema } from "../schema";
import type { XML } from "../xml";
/**
* -----
@@ -32,6 +33,7 @@ import type { Schema } from "../schema";
* @property `default` - Optional Default value
* @property `title` - Optional Short title for the schema
* @property `description` - Optional Description of the schema
* @property `xml` - Optional XML representation metadata
* @property `x-${string}` - Specification Extensions
*
* @note
@@ -82,121 +84,130 @@ import type { Schema } from "../schema";
* ```
*/
export interface ArraySchema extends Extension {
/**
* The type identifier for array schemas.
* Must be "array".
*/
type: "array";
/**
* The type identifier for array schemas.
* Must be "array".
*/
type: "array";
/**
* The schema for array items.
* All items in the array must conform to this schema.
*
* Example: `{ type: "string" }`
*/
items?: Schema;
/**
* The schema for array items.
* All items in the array must conform to this schema.
*
* Example: `{ type: "string" }`
*/
items?: Schema;
/**
* The schema for array items at specific positions.
* Items at position i must conform to the schema at index i.
*
* Example: `[{ type: "string" }, { type: "number" }]`
*/
prefixItems?: Schema[];
/**
* The schema for array items at specific positions.
* Items at position i must conform to the schema at index i.
*
* Example: `[{ type: "string" }, { type: "number" }]`
*/
prefixItems?: Schema[];
/**
* The schema that the array must contain at least one item matching.
* At least one item in the array must conform to this schema.
*
* Example: `{ type: "string", enum: ["admin"] }`
*/
contains?: Schema;
/**
* The schema that the array must contain at least one item matching.
* At least one item in the array must conform to this schema.
*
* Example: `{ type: "string", enum: ["admin"] }`
*/
contains?: Schema;
/**
* The minimum number of items that must match the contains schema.
* Must be a non-negative integer.
*
* Example: `1`
*/
minContains?: number;
/**
* The minimum number of items that must match the contains schema.
* Must be a non-negative integer.
*
* Example: `1`
*/
minContains?: number;
/**
* The maximum number of items that must match the contains schema.
* Must be a non-negative integer.
*
* Example: `5`
*/
maxContains?: number;
/**
* The maximum number of items that must match the contains schema.
* Must be a non-negative integer.
*
* Example: `5`
*/
maxContains?: number;
/**
* The minimum number of items in the array.
* Must be a non-negative integer.
*
* Example: `1`
*/
minItems?: number;
/**
* The minimum number of items in the array.
* Must be a non-negative integer.
*
* Example: `1`
*/
minItems?: number;
/**
* The maximum number of items in the array.
* Must be a non-negative integer.
*
* Example: `10`
*/
maxItems?: number;
/**
* The maximum number of items in the array.
* Must be a non-negative integer.
*
* Example: `10`
*/
maxItems?: number;
/**
* Whether array items must be unique.
* If true, all items in the array must be unique.
*
* Example: `true`
*/
uniqueItems?: boolean;
/**
* Whether array items must be unique.
* If true, all items in the array must be unique.
*
* Example: `true`
*/
uniqueItems?: boolean;
/**
* An array of allowed values for the array.
* The value must be one of the values in this array.
*
* Example: `[["a", "b"], ["c", "d"]]`
*/
enum?: unknown[];
/**
* An array of allowed values for the array.
* The value must be one of the values in this array.
*
* Example: `[["a", "b"], ["c", "d"]]`
*/
enum?: unknown[];
/**
* A single allowed value for the array.
* The value must be exactly this value.
*
* Example: `["a", "b"]`
*/
const?: unknown;
/**
* A single allowed value for the array.
* The value must be exactly this value.
*
* Example: `["a", "b"]`
*/
const?: unknown;
/**
* An array of example values for the array.
* These are for documentation purposes only.
*
* Example: `[["a", "b"], ["c", "d"]]`
*/
examples?: unknown[];
/**
* An array of example values for the array.
* These are for documentation purposes only.
*
* Example: `[["a", "b"], ["c", "d"]]`
*/
examples?: unknown[];
/**
* The default value for the array.
* This value will be used if no value is provided.
*
* Example: `[]`
*/
default?: unknown[];
/**
* The default value for the array.
* This value will be used if no value is provided.
*
* Example: `[]`
*/
default?: unknown[];
/**
* A short title for the schema.
* This is for documentation purposes only.
*
* Example: `"User Tags"`
*/
title?: string;
/**
* A short title for the schema.
* This is for documentation purposes only.
*
* Example: `"User Tags"`
*/
title?: string;
/**
* A description of the schema.
* CommonMark syntax MAY be used for rich text representation.
*
* Example: `"Array of user tags"`
*/
description?: string;
/**
* A description of the schema.
* CommonMark syntax MAY be used for rich text representation.
*
* Example: `"Array of user tags"`
*/
description?: string;
/**
* XML representation metadata for the schema.
* Allows for fine-tuned XML model definitions using the modernized
* nodeType approach in OpenAPI 3.2.0.
*
* Example: `{ nodeType: "element", name: "users" }`
*/
xml?: XML;
}

View File

@@ -1,4 +1,5 @@
import type { Extension } from "../extensions";
import type { XML } from "../xml";
/**
* -----
@@ -23,6 +24,7 @@ import type { Extension } from "../extensions";
* @property `default` - Optional Default value
* @property `title` - Optional Short title for the schema
* @property `description` - Optional Description of the schema
* @property `xml` - Optional XML representation metadata
* @property `x-${string}` - Specification Extensions
*
* @note
@@ -64,57 +66,66 @@ import type { Extension } from "../extensions";
* ```
*/
export interface BooleanSchema extends Extension {
/**
* The type identifier for boolean schemas.
* Must be "boolean".
*/
type: "boolean";
/**
* The type identifier for boolean schemas.
* Must be "boolean".
*/
type: "boolean";
/**
* An array of allowed values for the boolean.
* The value must be one of the values in this array.
*
* Example: `[true, false]`
*/
enum?: boolean[];
/**
* An array of allowed values for the boolean.
* The value must be one of the values in this array.
*
* Example: `[true, false]`
*/
enum?: boolean[];
/**
* A single allowed value for the boolean.
* The value must be exactly this value.
*
* Example: `true`
*/
const?: boolean;
/**
* A single allowed value for the boolean.
* The value must be exactly this value.
*
* Example: `true`
*/
const?: boolean;
/**
* An array of example values for the boolean.
* These are for documentation purposes only.
*
* Example: `[true, false]`
*/
examples?: boolean[];
/**
* An array of example values for the boolean.
* These are for documentation purposes only.
*
* Example: `[true, false]`
*/
examples?: boolean[];
/**
* The default value for the boolean.
* This value will be used if no value is provided.
*
* Example: `false`
*/
default?: boolean;
/**
* The default value for the boolean.
* This value will be used if no value is provided.
*
* Example: `false`
*/
default?: boolean;
/**
* A short title for the schema.
* This is for documentation purposes only.
*
* Example: `"Is Active"`
*/
title?: string;
/**
* A short title for the schema.
* This is for documentation purposes only.
*
* Example: `"Is Active"`
*/
title?: string;
/**
* A description of the schema.
* CommonMark syntax MAY be used for rich text representation.
*
* Example: `"Whether the user is active"`
*/
description?: string;
/**
* A description of the schema.
* CommonMark syntax MAY be used for rich text representation.
*
* Example: `"Whether the user is active"`
*/
description?: string;
/**
* XML representation metadata for the schema.
* Allows for fine-tuned XML model definitions using the modernized
* nodeType approach in OpenAPI 3.2.0.
*
* Example: `{ nodeType: "element", name: "isActive" }`
*/
xml?: XML;
}

View File

@@ -1,5 +1,6 @@
import type { Extension } from "../extensions";
import type { Schema } from "../schema";
import type { XML } from "../xml";
/**
* -----
@@ -32,6 +33,7 @@ import type { Schema } from "../schema";
* @property `default` - Optional Default value
* @property `title` - Optional Short title for the schema
* @property `description` - Optional Description of the schema
* @property `xml` - Optional XML representation metadata
* @property `x-${string}` - Specification Extensions
*
* @note
@@ -83,107 +85,116 @@ import type { Schema } from "../schema";
* ```
*/
export interface CompositionSchema extends Extension {
/**
* An array of schemas that must all be satisfied.
* The value must conform to all schemas in the array.
*
* Example: `[{ type: "object" }, { properties: { name: { type: "string" } } }]`
*/
allOf?: Schema[];
/**
* An array of schemas that must all be satisfied.
* The value must conform to all schemas in the array.
*
* Example: `[{ type: "object" }, { properties: { name: { type: "string" } } }]`
*/
allOf?: Schema[];
/**
* An array of schemas where at least one must be satisfied.
* The value must conform to at least one schema in the array.
*
* Example: `[{ type: "string" }, { type: "number" }]`
*/
anyOf?: Schema[];
/**
* An array of schemas where at least one must be satisfied.
* The value must conform to at least one schema in the array.
*
* Example: `[{ type: "string" }, { type: "number" }]`
*/
anyOf?: Schema[];
/**
* An array of schemas where exactly one must be satisfied.
* The value must conform to exactly one schema in the array.
*
* Example: `[{ type: "string" }, { type: "number" }]`
*/
oneOf?: Schema[];
/**
* An array of schemas where exactly one must be satisfied.
* The value must conform to exactly one schema in the array.
*
* Example: `[{ type: "string" }, { type: "number" }]`
*/
oneOf?: Schema[];
/**
* A schema that must not be satisfied.
* The value must not conform to this schema.
*
* Example: `{ type: "string" }`
*/
not?: Schema;
/**
* A schema that must not be satisfied.
* The value must not conform to this schema.
*
* Example: `{ type: "string" }`
*/
not?: Schema;
/**
* A schema for conditional validation.
* Used with `then` and `else` for conditional logic.
*
* Example: `{ type: "object", properties: { type: { const: "user" } } }`
*/
if?: Schema;
/**
* A schema for conditional validation.
* Used with `then` and `else` for conditional logic.
*
* Example: `{ type: "object", properties: { type: { const: "user" } } }`
*/
if?: Schema;
/**
* A schema to apply if the `if` condition is met.
* The value must conform to this schema if the `if` schema is satisfied.
*
* Example: `{ type: "object", properties: { name: { type: "string" } } }`
*/
then?: Schema;
/**
* A schema to apply if the `if` condition is met.
* The value must conform to this schema if the `if` schema is satisfied.
*
* Example: `{ type: "object", properties: { name: { type: "string" } } }`
*/
then?: Schema;
/**
* A schema to apply if the `if` condition is not met.
* The value must conform to this schema if the `if` schema is not satisfied.
*
* Example: `{ type: "object", properties: { id: { type: "string" } } }`
*/
else?: Schema;
/**
* A schema to apply if the `if` condition is not met.
* The value must conform to this schema if the `if` schema is not satisfied.
*
* Example: `{ type: "object", properties: { id: { type: "string" } } }`
*/
else?: Schema;
/**
* An array of allowed values.
* The value must be one of the values in this array.
*
* Example: `["active", "inactive"]`
*/
enum?: unknown[];
/**
* An array of allowed values.
* The value must be one of the values in this array.
*
* Example: `["active", "inactive"]`
*/
enum?: unknown[];
/**
* A single allowed value.
* The value must be exactly this value.
*
* Example: `"active"`
*/
const?: unknown;
/**
* A single allowed value.
* The value must be exactly this value.
*
* Example: `"active"`
*/
const?: unknown;
/**
* An array of example values.
* These are for documentation purposes only.
*
* Example: `["example1", "example2"]`
*/
examples?: unknown[];
/**
* An array of example values.
* These are for documentation purposes only.
*
* Example: `["example1", "example2"]`
*/
examples?: unknown[];
/**
* The default value.
* This value will be used if no value is provided.
*
* Example: `"default"`
*/
default?: unknown;
/**
* The default value.
* This value will be used if no value is provided.
*
* Example: `"default"`
*/
default?: unknown;
/**
* A short title for the schema.
* This is for documentation purposes only.
*
* Example: `"Composed Schema"`
*/
title?: string;
/**
* A short title for the schema.
* This is for documentation purposes only.
*
* Example: `"Composed Schema"`
*/
title?: string;
/**
* A description of the schema.
* CommonMark syntax MAY be used for rich text representation.
*
* Example: `"A schema composed of multiple schemas"`
*/
description?: string;
/**
* A description of the schema.
* CommonMark syntax MAY be used for rich text representation.
*
* Example: `"A schema composed of multiple schemas"`
*/
description?: string;
/**
* XML representation metadata for the schema.
* Allows for fine-tuned XML model definitions using the modernized
* nodeType approach in OpenAPI 3.2.0.
*
* Example: `{ nodeType: "element", name: "composedSchema" }`
*/
xml?: XML;
}

View File

@@ -1,4 +1,5 @@
import type { Extension } from "../extensions";
import type { XML } from "../xml";
/**
* -----
@@ -29,6 +30,7 @@ import type { Extension } from "../extensions";
* @property `default` - Optional Default value
* @property `title` - Optional Short title for the schema
* @property `description` - Optional Description of the schema
* @property `xml` - Optional XML representation metadata
* @property `x-${string}` - Specification Extensions
*
* @note
@@ -73,105 +75,114 @@ import type { Extension } from "../extensions";
* ```
*/
export interface IntegerSchema extends Extension {
/**
* The type identifier for integer schemas.
* Must be "integer".
*/
type: "integer";
/**
* The type identifier for integer schemas.
* Must be "integer".
*/
type: "integer";
/**
* The format of the integer.
* See OpenAPI 3.2.0 Data Type Formats for further details.
*
* Example: `"int32"`, `"int64"`
*/
format?: string;
/**
* The format of the integer.
* See OpenAPI 3.2.0 Data Type Formats for further details.
*
* Example: `"int32"`, `"int64"`
*/
format?: string;
/**
* The integer must be a multiple of this value.
* Must be a positive integer.
*
* Example: `5`
*/
multipleOf?: number;
/**
* The integer must be a multiple of this value.
* Must be a positive integer.
*
* Example: `5`
*/
multipleOf?: number;
/**
* The maximum value of the integer (inclusive).
* The integer must be less than or equal to this value.
*
* Example: `100`
*/
maximum?: number;
/**
* The maximum value of the integer (inclusive).
* The integer must be less than or equal to this value.
*
* Example: `100`
*/
maximum?: number;
/**
* The minimum value of the integer (inclusive).
* The integer must be greater than or equal to this value.
*
* Example: `0`
*/
minimum?: number;
/**
* The minimum value of the integer (inclusive).
* The integer must be greater than or equal to this value.
*
* Example: `0`
*/
minimum?: number;
/**
* The maximum value of the integer (exclusive).
* The integer must be less than this value.
*
* Example: `100`
*/
exclusiveMaximum?: number;
/**
* The maximum value of the integer (exclusive).
* The integer must be less than this value.
*
* Example: `100`
*/
exclusiveMaximum?: number;
/**
* The minimum value of the integer (exclusive).
* The integer must be greater than this value.
*
* Example: `0`
*/
exclusiveMinimum?: number;
/**
* The minimum value of the integer (exclusive).
* The integer must be greater than this value.
*
* Example: `0`
*/
exclusiveMinimum?: number;
/**
* An array of allowed values for the integer.
* The value must be one of the values in this array.
*
* Example: `[1, 2, 3, 4, 5]`
*/
enum?: number[];
/**
* An array of allowed values for the integer.
* The value must be one of the values in this array.
*
* Example: `[1, 2, 3, 4, 5]`
*/
enum?: number[];
/**
* A single allowed value for the integer.
* The value must be exactly this value.
*
* Example: `42`
*/
const?: number;
/**
* A single allowed value for the integer.
* The value must be exactly this value.
*
* Example: `42`
*/
const?: number;
/**
* An array of example values for the integer.
* These are for documentation purposes only.
*
* Example: `[1, 2, 3]`
*/
examples?: number[];
/**
* An array of example values for the integer.
* These are for documentation purposes only.
*
* Example: `[1, 2, 3]`
*/
examples?: number[];
/**
* The default value for the integer.
* This value will be used if no value is provided.
*
* Example: `0`
*/
default?: number;
/**
* The default value for the integer.
* This value will be used if no value is provided.
*
* Example: `0`
*/
default?: number;
/**
* A short title for the schema.
* This is for documentation purposes only.
*
* Example: `"User ID"`
*/
title?: string;
/**
* A short title for the schema.
* This is for documentation purposes only.
*
* Example: `"User ID"`
*/
title?: string;
/**
* A description of the schema.
* CommonMark syntax MAY be used for rich text representation.
*
* Example: `"The unique identifier of the user"`
*/
description?: string;
/**
* A description of the schema.
* CommonMark syntax MAY be used for rich text representation.
*
* Example: `"The unique identifier of the user"`
*/
description?: string;
/**
* XML representation metadata for the schema.
* Allows for fine-tuned XML model definitions using the modernized
* nodeType approach in OpenAPI 3.2.0.
*
* Example: `{ nodeType: "element", name: "userId" }`
*/
xml?: XML;
}

View File

@@ -1,4 +1,5 @@
import type { Extension } from "../extensions";
import type { XML } from "../xml";
/**
* -----
@@ -29,6 +30,7 @@ import type { Extension } from "../extensions";
* @property `default` - Optional Default value
* @property `title` - Optional Short title for the schema
* @property `description` - Optional Description of the schema
* @property `xml` - Optional XML representation metadata
* @property `x-${string}` - Specification Extensions
*
* @note
@@ -73,105 +75,114 @@ import type { Extension } from "../extensions";
* ```
*/
export interface NumberSchema extends Extension {
/**
* The type identifier for number schemas.
* Must be "number".
*/
type: "number";
/**
* The type identifier for number schemas.
* Must be "number".
*/
type: "number";
/**
* The format of the number.
* See OpenAPI 3.2.0 Data Type Formats for further details.
*
* Example: `"float"`, `"double"`
*/
format?: string;
/**
* The format of the number.
* See OpenAPI 3.2.0 Data Type Formats for further details.
*
* Example: `"float"`, `"double"`
*/
format?: string;
/**
* The number must be a multiple of this value.
* Must be a positive number.
*
* Example: `0.5`
*/
multipleOf?: number;
/**
* The number must be a multiple of this value.
* Must be a positive number.
*
* Example: `0.5`
*/
multipleOf?: number;
/**
* The maximum value of the number (inclusive).
* The number must be less than or equal to this value.
*
* Example: `100`
*/
maximum?: number;
/**
* The maximum value of the number (inclusive).
* The number must be less than or equal to this value.
*
* Example: `100`
*/
maximum?: number;
/**
* The minimum value of the number (inclusive).
* The number must be greater than or equal to this value.
*
* Example: `0`
*/
minimum?: number;
/**
* The minimum value of the number (inclusive).
* The number must be greater than or equal to this value.
*
* Example: `0`
*/
minimum?: number;
/**
* The maximum value of the number (exclusive).
* The number must be less than this value.
*
* Example: `100`
*/
exclusiveMaximum?: number;
/**
* The maximum value of the number (exclusive).
* The number must be less than this value.
*
* Example: `100`
*/
exclusiveMaximum?: number;
/**
* The minimum value of the number (exclusive).
* The number must be greater than this value.
*
* Example: `0`
*/
exclusiveMinimum?: number;
/**
* The minimum value of the number (exclusive).
* The number must be greater than this value.
*
* Example: `0`
*/
exclusiveMinimum?: number;
/**
* An array of allowed values for the number.
* The value must be one of the values in this array.
*
* Example: `[1, 2, 3, 4, 5]`
*/
enum?: number[];
/**
* An array of allowed values for the number.
* The value must be one of the values in this array.
*
* Example: `[1, 2, 3, 4, 5]`
*/
enum?: number[];
/**
* A single allowed value for the number.
* The value must be exactly this value.
*
* Example: `42`
*/
const?: number;
/**
* A single allowed value for the number.
* The value must be exactly this value.
*
* Example: `42`
*/
const?: number;
/**
* An array of example values for the number.
* These are for documentation purposes only.
*
* Example: `[1.5, 2.7, 3.14]`
*/
examples?: number[];
/**
* An array of example values for the number.
* These are for documentation purposes only.
*
* Example: `[1.5, 2.7, 3.14]`
*/
examples?: number[];
/**
* The default value for the number.
* This value will be used if no value is provided.
*
* Example: `0`
*/
default?: number;
/**
* The default value for the number.
* This value will be used if no value is provided.
*
* Example: `0`
*/
default?: number;
/**
* A short title for the schema.
* This is for documentation purposes only.
*
* Example: `"Price"`
*/
title?: string;
/**
* A short title for the schema.
* This is for documentation purposes only.
*
* Example: `"Price"`
*/
title?: string;
/**
* A description of the schema.
* CommonMark syntax MAY be used for rich text representation.
*
* Example: `"The price of the item"`
*/
description?: string;
/**
* A description of the schema.
* CommonMark syntax MAY be used for rich text representation.
*
* Example: `"The price of the item"`
*/
description?: string;
/**
* XML representation metadata for the schema.
* Allows for fine-tuned XML model definitions using the modernized
* nodeType approach in OpenAPI 3.2.0.
*
* Example: `{ nodeType: "element", name: "price" }`
*/
xml?: XML;
}

View File

@@ -1,5 +1,6 @@
import type { Extension } from "../extensions";
import type { Schema } from "../schema";
import type { XML } from "../xml";
/**
* -----
@@ -33,6 +34,7 @@ import type { Schema } from "../schema";
* @property `default` - Optional Default value
* @property `title` - Optional Short title for the schema
* @property `description` - Optional Description of the schema
* @property `xml` - Optional XML representation metadata
* @property `x-${string}` - Specification Extensions
*
* @note
@@ -87,131 +89,140 @@ import type { Schema } from "../schema";
* ```
*/
export interface ObjectSchema extends Extension {
/**
* The type identifier for object schemas.
* Must be "object".
*/
type: "object";
/**
* The type identifier for object schemas.
* Must be "object".
*/
type: "object";
/**
* A map of property names to their schemas.
* Each property in the object must conform to its corresponding schema.
*
* Example: `{ name: { type: "string" }, age: { type: "number" } }`
*/
properties?: Record<string, Schema>;
/**
* A map of property names to their schemas.
* Each property in the object must conform to its corresponding schema.
*
* Example: `{ name: { type: "string" }, age: { type: "number" } }`
*/
properties?: Record<string, Schema>;
/**
* An array of required property names.
* These properties must be present in the object.
*
* Example: `["name", "email"]`
*/
required?: string[];
/**
* An array of required property names.
* These properties must be present in the object.
*
* Example: `["name", "email"]`
*/
required?: string[];
/**
* The schema for additional properties not defined in properties.
* If false, no additional properties are allowed.
* If true, any additional properties are allowed.
* If a schema, additional properties must conform to this schema.
*
* Example: `{ type: "string" }` or `false` or `true`
*/
additionalProperties?: Schema | boolean;
/**
* The schema for additional properties not defined in properties.
* If false, no additional properties are allowed.
* If true, any additional properties are allowed.
* If a schema, additional properties must conform to this schema.
*
* Example: `{ type: "string" }` or `false` or `true`
*/
additionalProperties?: Schema | boolean;
/**
* A map of regex patterns to schemas.
* Properties whose names match a pattern must conform to the corresponding schema.
*
* Example: `{ "^S_": { type: "string" } }`
*/
patternProperties?: Record<string, Schema>;
/**
* A map of regex patterns to schemas.
* Properties whose names match a pattern must conform to the corresponding schema.
*
* Example: `{ "^S_": { type: "string" } }`
*/
patternProperties?: Record<string, Schema>;
/**
* The schema for property names.
* All property names in the object must conform to this schema.
*
* Example: `{ type: "string", pattern: "^[A-Za-z][A-Za-z0-9]*$" }`
*/
propertyNames?: Schema;
/**
* The schema for property names.
* All property names in the object must conform to this schema.
*
* Example: `{ type: "string", pattern: "^[A-Za-z][A-Za-z0-9]*$" }`
*/
propertyNames?: Schema;
/**
* The minimum number of properties in the object.
* Must be a non-negative integer.
*
* Example: `1`
*/
minProperties?: number;
/**
* The minimum number of properties in the object.
* Must be a non-negative integer.
*
* Example: `1`
*/
minProperties?: number;
/**
* The maximum number of properties in the object.
* Must be a non-negative integer.
*
* Example: `10`
*/
maxProperties?: number;
/**
* The maximum number of properties in the object.
* Must be a non-negative integer.
*
* Example: `10`
*/
maxProperties?: number;
/**
* A map of property names to arrays of required properties.
* If a property is present, the properties in its array must also be present.
*
* Example: `{ credit_card: ["billing_address"] }`
*/
dependentRequired?: Record<string, string[]>;
/**
* A map of property names to arrays of required properties.
* If a property is present, the properties in its array must also be present.
*
* Example: `{ credit_card: ["billing_address"] }`
*/
dependentRequired?: Record<string, string[]>;
/**
* A map of property names to schemas.
* If a property is present, the object must conform to the corresponding schema.
*
* Example: `{ credit_card: { type: "object", properties: { number: { type: "string" } } } }`
*/
dependentSchemas?: Record<string, Schema>;
/**
* A map of property names to schemas.
* If a property is present, the object must conform to the corresponding schema.
*
* Example: `{ credit_card: { type: "object", properties: { number: { type: "string" } } } }`
*/
dependentSchemas?: Record<string, Schema>;
/**
* An array of allowed values for the object.
* The value must be one of the values in this array.
*
* Example: `[{ name: "John" }, { name: "Jane" }]`
*/
enum?: Record<string, unknown>[];
/**
* An array of allowed values for the object.
* The value must be one of the values in this array.
*
* Example: `[{ name: "John" }, { name: "Jane" }]`
*/
enum?: Record<string, unknown>[];
/**
* A single allowed value for the object.
* The value must be exactly this value.
*
* Example: `{ name: "John" }`
*/
const?: Record<string, unknown>;
/**
* A single allowed value for the object.
* The value must be exactly this value.
*
* Example: `{ name: "John" }`
*/
const?: Record<string, unknown>;
/**
* An array of example values for the object.
* These are for documentation purposes only.
*
* Example: `[{ name: "John", age: 30 }]`
*/
examples?: Record<string, unknown>[];
/**
* An array of example values for the object.
* These are for documentation purposes only.
*
* Example: `[{ name: "John", age: 30 }]`
*/
examples?: Record<string, unknown>[];
/**
* The default value for the object.
* This value will be used if no value is provided.
*
* Example: `{}`
*/
default?: Record<string, unknown>;
/**
* The default value for the object.
* This value will be used if no value is provided.
*
* Example: `{}`
*/
default?: Record<string, unknown>;
/**
* A short title for the schema.
* This is for documentation purposes only.
*
* Example: `"User"`
*/
title?: string;
/**
* A short title for the schema.
* This is for documentation purposes only.
*
* Example: `"User"`
*/
title?: string;
/**
* A description of the schema.
* CommonMark syntax MAY be used for rich text representation.
*
* Example: `"A user object"`
*/
description?: string;
/**
* A description of the schema.
* CommonMark syntax MAY be used for rich text representation.
*
* Example: `"A user object"`
*/
description?: string;
/**
* XML representation metadata for the schema.
* Allows for fine-tuned XML model definitions using the modernized
* nodeType approach in OpenAPI 3.2.0.
*
* Example: `{ nodeType: "element", name: "user" }`
*/
xml?: XML;
}

View File

@@ -1,4 +1,5 @@
import type { Extension } from "../extensions";
import type { XML } from "../xml";
/**
* -----
@@ -27,6 +28,7 @@ import type { Extension } from "../extensions";
* @property `default` - Optional Default value
* @property `title` - Optional Short title for the schema
* @property `description` - Optional Description of the schema
* @property `xml` - Optional XML representation metadata
* @property `x-${string}` - Specification Extensions
*
* @note
@@ -70,89 +72,98 @@ import type { Extension } from "../extensions";
* ```
*/
export interface StringSchema extends Extension {
/**
* The type identifier for string schemas.
* Must be "string".
*/
type: "string";
/**
* The type identifier for string schemas.
* Must be "string".
*/
type: "string";
/**
* The format of the string.
* See OpenAPI 3.2.0 Data Type Formats for further details.
*
* Example: `"email"`, `"date-time"`, `"uuid"`
*/
format?: string;
/**
* The format of the string.
* See OpenAPI 3.2.0 Data Type Formats for further details.
*
* Example: `"email"`, `"date-time"`, `"uuid"`
*/
format?: string;
/**
* The maximum length of the string.
* Must be a non-negative integer.
*
* Example: `255`
*/
maxLength?: number;
/**
* The maximum length of the string.
* Must be a non-negative integer.
*
* Example: `255`
*/
maxLength?: number;
/**
* The minimum length of the string.
* Must be a non-negative integer.
*
* Example: `1`
*/
minLength?: number;
/**
* The minimum length of the string.
* Must be a non-negative integer.
*
* Example: `1`
*/
minLength?: number;
/**
* A regular expression pattern that the string must match.
* Should be a valid ECMA 262 regular expression.
*
* Example: `"^[A-Za-z0-9]+$"`
*/
pattern?: string;
/**
* A regular expression pattern that the string must match.
* Should be a valid ECMA 262 regular expression.
*
* Example: `"^[A-Za-z0-9]+$"`
*/
pattern?: string;
/**
* An array of allowed values for the string.
* The value must be one of the values in this array.
*
* Example: `["active", "inactive", "pending"]`
*/
enum?: string[];
/**
* An array of allowed values for the string.
* The value must be one of the values in this array.
*
* Example: `["active", "inactive", "pending"]`
*/
enum?: string[];
/**
* A single allowed value for the string.
* The value must be exactly this value.
*
* Example: `"active"`
*/
const?: string;
/**
* A single allowed value for the string.
* The value must be exactly this value.
*
* Example: `"active"`
*/
const?: string;
/**
* An array of example values for the string.
* These are for documentation purposes only.
*
* Example: `["example@email.com", "test@domain.com"]`
*/
examples?: string[];
/**
* An array of example values for the string.
* These are for documentation purposes only.
*
* Example: `["example@email.com", "test@domain.com"]`
*/
examples?: string[];
/**
* The default value for the string.
* This value will be used if no value is provided.
*
* Example: `"default"`
*/
default?: string;
/**
* The default value for the string.
* This value will be used if no value is provided.
*
* Example: `"default"`
*/
default?: string;
/**
* A short title for the schema.
* This is for documentation purposes only.
*
* Example: `"User Email"`
*/
title?: string;
/**
* A short title for the schema.
* This is for documentation purposes only.
*
* Example: `"User Email"`
*/
title?: string;
/**
* A description of the schema.
* CommonMark syntax MAY be used for rich text representation.
*
* Example: `"The email address of the user"`
*/
description?: string;
/**
* A description of the schema.
* CommonMark syntax MAY be used for rich text representation.
*
* Example: `"The email address of the user"`
*/
description?: string;
/**
* XML representation metadata for the schema.
* Allows for fine-tuned XML model definitions using the modernized
* nodeType approach in OpenAPI 3.2.0.
*
* Example: `{ nodeType: "element", name: "userName" }`
*/
xml?: XML;
}

View File

@@ -15,14 +15,14 @@
export type { Components } from "./components";
// Re-export data-types for convenience
export type {
ArraySchema as DataTypeArraySchema,
BooleanSchema as DataTypeBooleanSchema,
CompositionSchema as DataTypeCompositionSchema,
IntegerSchema as DataTypeIntegerSchema,
NumberSchema as DataTypeNumberSchema,
ObjectSchema as DataTypeObjectSchema,
ReferenceSchema as DataTypeReferenceSchema,
StringSchema as DataTypeStringSchema,
ArraySchema,
BooleanSchema,
CompositionSchema,
IntegerSchema,
NumberSchema,
ObjectSchema,
ReferenceSchema,
StringSchema,
} from "./data-types";
// Core OpenAPI types
export type { Extension } from "./extensions";
@@ -32,21 +32,10 @@ export type { ExternalDocumentation } from "./externalDocs";
export type { Contact, Info, License } from "./info";
export type { OAuthFlow, OAuthFlows } from "./oauth";
// Path types
export type { PathItemObject, Paths } from "./paths";
export type { PathItem, Paths } from "./paths";
export type { Reference } from "./references";
// Schema types
export type {
ArraySchema,
BooleanSchema,
CompositionSchema,
Discriminator,
IntegerSchema,
NumberSchema,
ObjectSchema,
ReferenceSchema,
Schema,
StringSchema,
} from "./schema";
// Schema type
export type { Discriminator, Schema } from "./schema";
// Security types
export type { SecurityRequirement } from "./security";
// Server types

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
import type { Extension } from "./extensions";
import type { PathItemObject } from "./paths";
import type { PathItem } from "./paths";
import type { Reference } from "./references";
/**
@@ -25,7 +25,7 @@ import type { Reference } from "./references";
* -----
*
* @property `{webhookName}` - A unique string to refer to each webhook
* @property `PathItemObject` - The Path Item Object describing the webhook request
* @property `PathItem` - The Path Item Object describing the webhook request
* @property `Reference` - A reference to a Path Item Object
* @property `x-${string}` - Specification Extensions
*
@@ -127,4 +127,4 @@ import type { Reference } from "./references";
* };
* ```
*/
export type Webhooks = Record<string, PathItemObject | Reference> & Extension;
export type Webhooks = Record<string, PathItem | Reference> & Extension;

View File

@@ -6,6 +6,8 @@ import type { Extension } from "./extensions";
* -----
*
* A metadata object that allows for more fine-tuned XML model definitions.
* OpenAPI 3.2.0 introduces a modernized XML modeling approach using `nodeType`
* to replace the deprecated `attribute` and `wrapped` fields from earlier versions.
*
* When using arrays, XML element names are not inferred (for singular/plural forms)
* and the `name` property SHOULD be used to add that information.
@@ -18,99 +20,161 @@ import type { Extension } from "./extensions";
* Fields
* -----
*
* @property `nodeType` - Optional The type of XML node this schema produces
* @property `name` - Optional Replaces the name of the element/attribute used for the described schema property
* @property `namespace` - Optional The URI of the namespace definition
* @property `prefix` - Optional The prefix to be used for the name
* @property `attribute` - Optional Declares whether the property definition translates to an attribute instead of an element
* @property `wrapped` - Optional MAY be used only for an array definition. Signifies whether the array is wrapped
* @property `x-${string}` - Specification Extensions
*
* @note
* All fields are optional.
* All fields are optional. The `name`, `namespace`, and `prefix` fields are only
* effective when `nodeType` is "element" or "attribute". For "text", "cdata", and "none"
* node types, these fields are ignored.
*
* -----
* Examples
* -----
*
* @example (simple XML):
* @example (XML element):
* ```ts
* const xml: XML = {
* nodeType: "element",
* name: "user"
* };
* ```
*
* @example (XML with namespace):
* ```ts
* const xml: XML = {
* name: "user",
* namespace: "http://example.com/schema/user",
* prefix: "user"
* };
* ```
*
* @example (XML attribute):
* ```ts
* const xml: XML = {
* name: "id",
* attribute: true
* nodeType: "attribute",
* name: "id"
* };
* ```
*
* @example (wrapped array):
* @example (namespaced element):
* ```ts
* const xml: XML = {
* nodeType: "element",
* name: "user",
* namespace: "http://example.com/schema/user",
* prefix: "user"
* };
* ```
*
* @example (array with wrapper element):
* ```ts
* const xml: XML = {
* nodeType: "element",
* name: "users"
* };
* ```
*
* @example (array without wrapper - only items):
* ```ts
* const xml: XML = {
* nodeType: "none"
* };
* ```
*
* @example (text content):
* ```ts
* const xml: XML = {
* nodeType: "text"
* };
* ```
*
* @example (CDATA section):
* ```ts
* const xml: XML = {
* nodeType: "cdata"
* };
* ```
*
* -----
* Migration from OpenAPI 3.0/3.1
* -----
*
* @example (attribute migration):
* ```ts
* // OpenAPI 3.0/3.1:
* const oldXml: XML = {
* name: "id",
* attribute: true
* };
*
* // OpenAPI 3.2:
* const newXml: XML = {
* name: "id",
* nodeType: "attribute"
* };
* ```
*
* @example (wrapped array migration):
* ```ts
* // OpenAPI 3.0/3.1:
* const oldArrayXml: XML = {
* name: "users",
* wrapped: true
* };
*
* // OpenAPI 3.2 (array with wrapper):
* const newArrayXml: XML = {
* nodeType: "element",
* name: "users"
* };
*
* // OpenAPI 3.2 (array without wrapper):
* const newArrayXmlNoWrapper: XML = {
* nodeType: "none"
* };
* ```
*/
export interface XML extends Extension {
/**
* Replaces the name of the element/attribute used for the described schema property.
* When defined within the Items Object (items), it will affect the name of the individual
* XML elements within the list. When defined alongside type being array (outside the items),
* it will affect the wrapping element and only if wrapped is true. If wrapped is false,
* it will be ignored.
*
* @example "user"
* @example "id"
* @example "users"
*/
name?: string;
/**
* The type of XML node this schema produces. Determines how the schema
* is serialized to XML.
*
* - `"element"`: Produces an XML element node (may contain attributes, child elements, or text)
* - `"attribute"`: Produces an XML attribute node on the containing element (value-only)
* - `"text"`: Contributes character data of the containing element (PCDATA)
* - `"cdata"`: Contributes a CDATA section of the containing element
* - `"none"`: Does not directly produce a node (used for structural control, e.g., array wrappers)
*
* @example "element"
* @example "attribute"
* @example "text"
* @example "cdata"
* @example "none"
*/
nodeType?: "element" | "attribute" | "text" | "cdata" | "none";
/**
* The URI of the namespace definition. This MUST be in the form of an absolute URI.
*
* @example "http://example.com/schema/user"
* @example "http://www.w3.org/XML/1998/namespace"
*/
namespace?: string;
/**
* Replaces the name of the element/attribute used for the described schema property.
* Only effective when `nodeType` is "element" or "attribute". When defined within
* the Items Object (items), it will affect the name of the individual XML elements
* within the list. When defined alongside type being array (outside the items),
* it will affect the wrapping element name.
*
* @example "user"
* @example "id"
* @example "users"
*/
name?: string;
/**
* The prefix to be used for the name.
*
* @example "user"
* @example "xml"
*/
prefix?: string;
/**
* The URI of the namespace definition. This MUST be in the form of an absolute URI.
* Only effective when `nodeType` is "element" or "attribute".
*
* @example "http://example.com/schema/user"
* @example "http://www.w3.org/XML/1998/namespace"
*/
namespace?: string;
/**
* Declares whether the property definition translates to an attribute instead of an element.
* Default value is false.
*
* @example true
* @example false
*/
attribute?: boolean;
/**
* MAY be used only for an array definition. Signifies whether the array is wrapped
* (for example, `<books><book/><book/></books>`) or unwrapped
* (for example, `<book/><book/>`). Default value is false. The definition takes effect
* only when defined alongside type being array (outside the items).
*
* @example true
* @example false
*/
wrapped?: boolean;
/**
* The prefix to be used for the name. Only effective when `nodeType` is "element" or "attribute".
*
* @example "user"
* @example "xml"
*/
prefix?: string;
}

View File

@@ -22,6 +22,45 @@ yarn add oas-types
bun add oas-types
```
## 🏗️ Build Process
This package includes a comprehensive build system that generates JSON schemas from the TypeScript definitions:
### Quick Start
```bash
# Generate all schemas
bun run build
# Clean and rebuild
bun run schemas:clean && bun run build
```
### Generated Schemas
The build process creates JSON schemas for:
- **Main specifications** - Complete OpenAPI document validation
- **Component schemas** - Individual component validation
- **TypeScript exports** - Easy importing and type safety
### Usage
```typescript
// Import schemas for a specific version
import { schemas } from 'oas-types/schemas/3.0';
// Import all schemas
import { allSchemas, getSchemasForVersion } from 'oas-types/schemas';
// Use with JSON Schema validators
import Ajv from 'ajv';
const ajv = new Ajv();
const validator = ajv.compile(schemas.specification);
```
For detailed build information, see [BUILD.md](./BUILD.md).
## 🚀 Usage
### Import Version-Specific Types

369
build.ts Executable file
View File

@@ -0,0 +1,369 @@
#!/usr/bin/env bun
/**
* OpenAPI Types Build Script
*
* This script generates JSON schemas for all OpenAPI specification versions
* and performs the complete build process for the package.
*/
import { resolve } from "path";
import { createGenerator } from "ts-json-schema-generator";
import { writeFileSync, mkdirSync, existsSync, readdirSync } from "fs";
import { rimrafSync } from "rimraf";
// Configuration for schema generation
const generatorConfig = {
path: "",
tsconfig: "./tsconfig.json",
expose: "export" as const,
jsDoc: "extended" as const,
markdownDescription: true,
fullDescription: true,
additionalProperties: false,
strictTuples: false,
topRef: true,
sortProps: true,
skipTypeCheck: false,
encodeRefs: true,
minify: false,
};
// OpenAPI versions to process
const versions = ["2.0", "3.0", "3.1", "3.2"] as const;
interface BuildResult {
version: string;
type: string;
success: boolean;
error?: string;
outputPath?: string;
}
interface SchemaInfo {
name: string;
path: string;
schema: any;
}
const schemasToGenerate = {
"2.0": ["Schema", "Parameter", "Response", "PathItem"],
"3.0": [
"Schema",
"Response",
"Parameter",
"Example",
"RequestBody",
"Header",
"SecurityScheme",
"Link",
"Callback",
],
"3.1": [
"Schema",
"Response",
"Parameter",
"Example",
"RequestBody",
"Header",
"SecurityScheme",
"Link",
"Callback",
"PathItem",
],
"3.2": [
"Schema",
"Response",
"Parameter",
"Example",
"RequestBody",
"Header",
"SecurityScheme",
"Link",
"Callback",
"PathItem",
"MediaType",
],
};
async function generateAllSchemasForVersion(
version: string
): Promise<BuildResult[]> {
const results: BuildResult[] = [];
const outputDir = resolve(`./schemas/${version}`);
rimrafSync(outputDir);
// Ensure output directory exists
mkdirSync(`${outputDir}/main`, { recursive: true });
mkdirSync(`${outputDir}/components`, { recursive: true });
console.log(`📦 Processing OpenAPI ${version}...`);
try {
// Get the main spec file
const specFile = resolve(`./${version}/spec.ts`);
if (!existsSync(specFile)) {
console.warn(`⚠️ Spec file not found: ${specFile}`);
return results;
}
// Create generator with version-specific config
const config = {
...generatorConfig,
path: specFile,
};
const generator = createGenerator(config);
// Generate schema for ALL exported types at once
try {
console.log(
`🔍 Generating schemas for all exported types in ${version}...`
);
const schema = generator.createSchema(); // No type parameter = all types
if (schema && schema.definitions) {
const definitions = schema.definitions;
const definitionNames = Object.keys(definitions);
console.log(
`📋 Found ${
definitionNames.length
} exported types: ${definitionNames.join(", ")}`
);
// Generate main specification schema (if it exists)
if (definitions.Specification) {
const specSchema = {
$schema: "http://json-schema.org/draft-07/schema#",
...(definitions.Specification as any),
definitions: definitions,
};
const outputPath = `${outputDir}/main/specification.json`;
writeFileSync(outputPath, JSON.stringify(specSchema, null, 2));
results.push({
version,
type: "Specification",
success: true,
outputPath,
});
console.log(`✅ Generated main schema for ${version}/Specification`);
}
// Generate individual component schemas
for (const [typeName, typeSchema] of Object.entries(definitions)) {
if (typeName === "Specification") continue; // Skip main spec, already handled
if (
!schemasToGenerate[
version as keyof typeof schemasToGenerate
].includes(typeName)
)
continue; // Skip types that are not in the schemasToGenerate object
try {
const componentSchema = {
$schema: "http://json-schema.org/draft-07/schema#",
...(typeSchema as any),
definitions: definitions, // Include all definitions for references
};
const outputPath = `${outputDir}/components/${typeName.toLowerCase()}.json`;
writeFileSync(outputPath, JSON.stringify(componentSchema, null, 2));
results.push({
version,
type: typeName,
success: true,
outputPath,
});
console.log(
`✅ Generated component schema for ${version}/${typeName}`
);
} catch (error) {
results.push({
version,
type: typeName,
success: false,
error: error instanceof Error ? error.message : String(error),
});
console.error(
`❌ Failed to generate schema for ${version}/${typeName}:`,
error
);
}
}
} else {
results.push({
version,
type: "all",
success: false,
error: "No definitions found in generated schema",
});
console.error(`❌ No definitions found for ${version}`);
}
} catch (error) {
results.push({
version,
type: "all",
success: false,
error: error instanceof Error ? error.message : String(error),
});
console.error(`❌ Failed to generate schemas for ${version}:`, error);
}
} catch (error) {
console.error(`❌ Failed to process version ${version}:`, error);
// @ts-ignore
console.log(error.diagnostic);
results.push({
version,
type: "all",
success: false,
error: error instanceof Error ? error.message : String(error),
});
}
return results;
}
async function generateIndexFiles(): Promise<void> {
console.log("📝 Generating index.ts files...");
// Generate index.ts for each version
for (const version of versions) {
const outputDir = resolve(`./schemas/${version}`);
const indexPath = `${outputDir}/index.ts`;
// Check if main specification exists
const hasMainSpec = existsSync(`${outputDir}/main/specification.json`);
let indexContent = `/**
* OpenAPI ${version} JSON Schemas
*
* This file exports all available JSON schemas for OpenAPI ${version} specification.
* These schemas can be used to validate OpenAPI ${version} documents and components.
*/
`;
// Add main specification export if it exists
if (hasMainSpec) {
indexContent += `export { default as specification } from "./main/specification.json";\n\n`;
}
// Add component exports - dynamically discover all component files
indexContent += `// Component schemas\n`;
const componentsDir = `${outputDir}/components`;
let componentFiles: string[] = [];
if (existsSync(componentsDir)) {
componentFiles = readdirSync(componentsDir)
.filter((file) => file.endsWith(".json"))
.map((file) => file.replace(".json", ""));
for (const component of componentFiles) {
const componentName =
component.charAt(0).toUpperCase() + component.slice(1);
indexContent += `export { default as ${component} } from "./components/${component}.json";\n`;
}
}
// Add imports and schemas object
indexContent += `\n// Import all schemas for internal use\n`;
if (hasMainSpec) {
indexContent += `import specification from "./main/specification.json";\n`;
}
for (const component of componentFiles) {
indexContent += `import ${component} from "./components/${component}.json";\n`;
}
indexContent += `\n// Re-export all schemas as a single object for convenience\nexport const schemas = {\n`;
if (hasMainSpec) {
indexContent += ` specification,\n`;
}
for (const component of componentFiles) {
indexContent += ` ${component},\n`;
}
indexContent += `} as const;\n\n// Type definitions for better TypeScript support\nexport type SchemaName = keyof typeof schemas;\n`;
writeFileSync(indexPath, indexContent);
console.log(`✅ Generated index.ts for ${version}`);
}
// Generate main schemas index.ts
const mainIndexPath = resolve(`./schemas/index.ts`);
const mainIndexContent = `/**
* OpenAPI JSON Schemas
*
* This file exports all available JSON schemas for all OpenAPI specification versions.
* These schemas can be used to validate OpenAPI documents and components.
*/
// Export schemas for each version
export * as schemas2_0 from "./2.0";
export * as schemas3_0 from "./3.0";
export * as schemas3_1 from "./3.1";
export * as schemas3_2 from "./3.2";
import { schemas as schemas2_0 } from "./2.0";
import { schemas as schemas3_0 } from "./3.0";
import { schemas as schemas3_1 } from "./3.1";
import { schemas as schemas3_2 } from "./3.2";
// Export all schemas in a single object organized by version
export const allSchemas = {
"2.0": schemas2_0,
"3.0": schemas3_0,
"3.1": schemas3_1,
"3.2": schemas3_2,
} as const;
`;
writeFileSync(mainIndexPath, mainIndexContent);
console.log("✅ Generated main schemas index.ts");
}
async function main() {
console.log("🚀 Starting OpenAPI Types build process...\n");
const allResults: BuildResult[] = [];
// Generate schemas for each version
for (const version of versions) {
const results = await generateAllSchemasForVersion(version);
allResults.push(...results);
console.log(`✅ Completed OpenAPI ${version}\n`);
}
// Generate index files
await generateIndexFiles();
// Summary
const successful = allResults.filter((r) => r.success);
const failed = allResults.filter((r) => !r.success);
console.log("📊 Build Summary:");
console.log(`✅ Successful: ${successful.length}`);
console.log(`❌ Failed: ${failed.length}`);
if (failed.length > 0) {
console.log("\n❌ Failed generations:");
failed.forEach((result) => {
console.log(` - ${result.version}/${result.type}: ${result.error}`);
});
}
console.log("\n🎉 Build complete!");
console.log("📁 Generated schemas are available in the 'schemas/' directory");
console.log("📖 See schemas/README.md for usage instructions");
}
// Run the build script
main().catch(console.error);

341
bun.lock
View File

@@ -4,10 +4,15 @@
"": {
"name": "openapi-types",
"dependencies": {
"rimraf": "^6.0.1",
"spdx-license-list": "^6.10.0",
},
"devDependencies": {
"@types/bun": "latest",
"@biomejs/biome": "^2.2.4",
"@types/bun": "^1.2.23",
"ts-json-schema-generator": "^2.4.0",
"tsd": "^0.33.0",
"typescript": "^5.9.2",
},
"peerDependencies": {
"typescript": "^5.0.0",
@@ -15,20 +20,350 @@
},
},
"packages": {
"@types/bun": ["@types/bun@1.2.22", "", { "dependencies": { "bun-types": "1.2.22" } }, "sha512-5A/KrKos2ZcN0c6ljRSOa1fYIyCKhZfIVYeuyb4snnvomnpFqC0tTsEkdqNxbAgExV384OETQ//WAjl3XbYqQA=="],
"@babel/code-frame": ["@babel/code-frame@7.27.1", "", { "dependencies": { "@babel/helper-validator-identifier": "^7.27.1", "js-tokens": "^4.0.0", "picocolors": "^1.1.1" } }, "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg=="],
"@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.27.1", "", {}, "sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow=="],
"@biomejs/biome": ["@biomejs/biome@2.2.4", "", { "optionalDependencies": { "@biomejs/cli-darwin-arm64": "2.2.4", "@biomejs/cli-darwin-x64": "2.2.4", "@biomejs/cli-linux-arm64": "2.2.4", "@biomejs/cli-linux-arm64-musl": "2.2.4", "@biomejs/cli-linux-x64": "2.2.4", "@biomejs/cli-linux-x64-musl": "2.2.4", "@biomejs/cli-win32-arm64": "2.2.4", "@biomejs/cli-win32-x64": "2.2.4" }, "bin": { "biome": "bin/biome" } }, "sha512-TBHU5bUy/Ok6m8c0y3pZiuO/BZoY/OcGxoLlrfQof5s8ISVwbVBdFINPQZyFfKwil8XibYWb7JMwnT8wT4WVPg=="],
"@biomejs/cli-darwin-arm64": ["@biomejs/cli-darwin-arm64@2.2.4", "", { "os": "darwin", "cpu": "arm64" }, "sha512-RJe2uiyaloN4hne4d2+qVj3d3gFJFbmrr5PYtkkjei1O9c+BjGXgpUPVbi8Pl8syumhzJjFsSIYkcLt2VlVLMA=="],
"@biomejs/cli-darwin-x64": ["@biomejs/cli-darwin-x64@2.2.4", "", { "os": "darwin", "cpu": "x64" }, "sha512-cFsdB4ePanVWfTnPVaUX+yr8qV8ifxjBKMkZwN7gKb20qXPxd/PmwqUH8mY5wnM9+U0QwM76CxFyBRJhC9tQwg=="],
"@biomejs/cli-linux-arm64": ["@biomejs/cli-linux-arm64@2.2.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-M/Iz48p4NAzMXOuH+tsn5BvG/Jb07KOMTdSVwJpicmhN309BeEyRyQX+n1XDF0JVSlu28+hiTQ2L4rZPvu7nMw=="],
"@biomejs/cli-linux-arm64-musl": ["@biomejs/cli-linux-arm64-musl@2.2.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-7TNPkMQEWfjvJDaZRSkDCPT/2r5ESFPKx+TEev+I2BXDGIjfCZk2+b88FOhnJNHtksbOZv8ZWnxrA5gyTYhSsQ=="],
"@biomejs/cli-linux-x64": ["@biomejs/cli-linux-x64@2.2.4", "", { "os": "linux", "cpu": "x64" }, "sha512-orr3nnf2Dpb2ssl6aihQtvcKtLySLta4E2UcXdp7+RTa7mfJjBgIsbS0B9GC8gVu0hjOu021aU8b3/I1tn+pVQ=="],
"@biomejs/cli-linux-x64-musl": ["@biomejs/cli-linux-x64-musl@2.2.4", "", { "os": "linux", "cpu": "x64" }, "sha512-m41nFDS0ksXK2gwXL6W6yZTYPMH0LughqbsxInSKetoH6morVj43szqKx79Iudkp8WRT5SxSh7qVb8KCUiewGg=="],
"@biomejs/cli-win32-arm64": ["@biomejs/cli-win32-arm64@2.2.4", "", { "os": "win32", "cpu": "arm64" }, "sha512-NXnfTeKHDFUWfxAefa57DiGmu9VyKi0cDqFpdI+1hJWQjGJhJutHPX0b5m+eXvTKOaf+brU+P0JrQAZMb5yYaQ=="],
"@biomejs/cli-win32-x64": ["@biomejs/cli-win32-x64@2.2.4", "", { "os": "win32", "cpu": "x64" }, "sha512-3Y4V4zVRarVh/B/eSHczR4LYoSVyv3Dfuvm3cWs5w/HScccS0+Wt/lHOcDTRYeHjQmMYVC3rIRWqyN2EI52+zg=="],
"@isaacs/balanced-match": ["@isaacs/balanced-match@4.0.1", "", {}, "sha512-yzMTt9lEb8Gv7zRioUilSglI0c0smZ9k5D65677DLWLtWJaXIS3CqcGyUFByYKlnUj6TkjLVs54fBl6+TiGQDQ=="],
"@isaacs/brace-expansion": ["@isaacs/brace-expansion@5.0.0", "", { "dependencies": { "@isaacs/balanced-match": "^4.0.1" } }, "sha512-ZT55BDLV0yv0RBm2czMiZ+SqCGO7AvmOM3G/w2xhVPH+te0aKgFjmBvGlL1dH+ql2tgGO3MVrbb3jCKyvpgnxA=="],
"@isaacs/cliui": ["@isaacs/cliui@8.0.2", "", { "dependencies": { "string-width": "^5.1.2", "string-width-cjs": "npm:string-width@^4.2.0", "strip-ansi": "^7.0.1", "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", "wrap-ansi": "^8.1.0", "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" } }, "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA=="],
"@jest/schemas": ["@jest/schemas@29.6.3", "", { "dependencies": { "@sinclair/typebox": "^0.27.8" } }, "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA=="],
"@nodelib/fs.scandir": ["@nodelib/fs.scandir@2.1.5", "", { "dependencies": { "@nodelib/fs.stat": "2.0.5", "run-parallel": "^1.1.9" } }, "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g=="],
"@nodelib/fs.stat": ["@nodelib/fs.stat@2.0.5", "", {}, "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A=="],
"@nodelib/fs.walk": ["@nodelib/fs.walk@1.2.8", "", { "dependencies": { "@nodelib/fs.scandir": "2.1.5", "fastq": "^1.6.0" } }, "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg=="],
"@sinclair/typebox": ["@sinclair/typebox@0.27.8", "", {}, "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA=="],
"@tsd/typescript": ["@tsd/typescript@5.9.2", "", {}, "sha512-mSMM0QtEPdMd+rdMDd17yCUYD4yI3pKHap89+jEZrZ3KIO5PhDofBjER0OtgHdvOXF74KMLO3fyD6k3Hz0v03A=="],
"@types/bun": ["@types/bun@1.2.23", "", { "dependencies": { "bun-types": "1.2.23" } }, "sha512-le8ueOY5b6VKYf19xT3McVbXqLqmxzPXHsQT/q9JHgikJ2X22wyTW3g3ohz2ZMnp7dod6aduIiq8A14Xyimm0A=="],
"@types/eslint": ["@types/eslint@7.29.0", "", { "dependencies": { "@types/estree": "*", "@types/json-schema": "*" } }, "sha512-VNcvioYDH8/FxaeTKkM4/TiTwt6pBV9E3OfGmvaw8tPl0rrHCJ4Ll15HRT+pMiFAf/MLQvAzC+6RzUMEL9Ceng=="],
"@types/estree": ["@types/estree@1.0.8", "", {}, "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w=="],
"@types/json-schema": ["@types/json-schema@7.0.15", "", {}, "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA=="],
"@types/minimist": ["@types/minimist@1.2.5", "", {}, "sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag=="],
"@types/node": ["@types/node@24.4.0", "", { "dependencies": { "undici-types": "~7.11.0" } }, "sha512-gUuVEAK4/u6F9wRLznPUU4WGUacSEBDPoC2TrBkw3GAnOLHBL45QdfHOXp1kJ4ypBGLxTOB+t7NJLpKoC3gznQ=="],
"@types/normalize-package-data": ["@types/normalize-package-data@2.4.4", "", {}, "sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA=="],
"@types/react": ["@types/react@19.1.13", "", { "dependencies": { "csstype": "^3.0.2" } }, "sha512-hHkbU/eoO3EG5/MZkuFSKmYqPbSVk5byPFa3e7y/8TybHiLMACgI8seVYlicwk7H5K/rI2px9xrQp/C+AUDTiQ=="],
"bun-types": ["bun-types@1.2.22", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-hwaAu8tct/Zn6Zft4U9BsZcXkYomzpHJX28ofvx7k0Zz2HNz54n1n+tDgxoWFGB4PcFvJXJQloPhaV2eP3Q6EA=="],
"ansi-escapes": ["ansi-escapes@4.3.2", "", { "dependencies": { "type-fest": "^0.21.3" } }, "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ=="],
"ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],
"ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="],
"array-union": ["array-union@2.1.0", "", {}, "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw=="],
"arrify": ["arrify@1.0.1", "", {}, "sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA=="],
"braces": ["braces@3.0.3", "", { "dependencies": { "fill-range": "^7.1.1" } }, "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA=="],
"bun-types": ["bun-types@1.2.23", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-R9f0hKAZXgFU3mlrA0YpE/fiDvwV0FT9rORApt2aQVWSuJDzZOyB5QLc0N/4HF57CS8IXJ6+L5E4W1bW6NS2Aw=="],
"camelcase": ["camelcase@5.3.1", "", {}, "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg=="],
"camelcase-keys": ["camelcase-keys@6.2.2", "", { "dependencies": { "camelcase": "^5.3.1", "map-obj": "^4.0.0", "quick-lru": "^4.0.1" } }, "sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg=="],
"chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="],
"color-convert": ["color-convert@2.0.1", "", { "dependencies": { "color-name": "~1.1.4" } }, "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="],
"color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="],
"commander": ["commander@13.1.0", "", {}, "sha512-/rFeCpNJQbhSZjGVwO9RFV3xPqbnERS8MmIQzCtD/zl6gpJuV/bMLuN92oG3F7d8oDEHHRrujSXNUr8fpjntKw=="],
"cross-spawn": ["cross-spawn@7.0.6", "", { "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", "which": "^2.0.1" } }, "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA=="],
"csstype": ["csstype@3.1.3", "", {}, "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw=="],
"decamelize": ["decamelize@1.2.0", "", {}, "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA=="],
"decamelize-keys": ["decamelize-keys@1.1.1", "", { "dependencies": { "decamelize": "^1.1.0", "map-obj": "^1.0.0" } }, "sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg=="],
"diff-sequences": ["diff-sequences@29.6.3", "", {}, "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q=="],
"dir-glob": ["dir-glob@3.0.1", "", { "dependencies": { "path-type": "^4.0.0" } }, "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA=="],
"eastasianwidth": ["eastasianwidth@0.2.0", "", {}, "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA=="],
"emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="],
"error-ex": ["error-ex@1.3.4", "", { "dependencies": { "is-arrayish": "^0.2.1" } }, "sha512-sqQamAnR14VgCr1A618A3sGrygcpK+HEbenA/HiEAkkUwcZIIB/tgWqHFxWgOyDh4nB4JCRimh79dR5Ywc9MDQ=="],
"eslint-formatter-pretty": ["eslint-formatter-pretty@4.1.0", "", { "dependencies": { "@types/eslint": "^7.2.13", "ansi-escapes": "^4.2.1", "chalk": "^4.1.0", "eslint-rule-docs": "^1.1.5", "log-symbols": "^4.0.0", "plur": "^4.0.0", "string-width": "^4.2.0", "supports-hyperlinks": "^2.0.0" } }, "sha512-IsUTtGxF1hrH6lMWiSl1WbGaiP01eT6kzywdY1U+zLc0MP+nwEnUiS9UI8IaOTUhTeQJLlCEWIbXINBH4YJbBQ=="],
"eslint-rule-docs": ["eslint-rule-docs@1.1.235", "", {}, "sha512-+TQ+x4JdTnDoFEXXb3fDvfGOwnyNV7duH8fXWTPD1ieaBmB8omj7Gw/pMBBu4uI2uJCCU8APDaQJzWuXnTsH4A=="],
"fast-glob": ["fast-glob@3.3.3", "", { "dependencies": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", "glob-parent": "^5.1.2", "merge2": "^1.3.0", "micromatch": "^4.0.8" } }, "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg=="],
"fastq": ["fastq@1.19.1", "", { "dependencies": { "reusify": "^1.0.4" } }, "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ=="],
"fill-range": ["fill-range@7.1.1", "", { "dependencies": { "to-regex-range": "^5.0.1" } }, "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg=="],
"find-up": ["find-up@4.1.0", "", { "dependencies": { "locate-path": "^5.0.0", "path-exists": "^4.0.0" } }, "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw=="],
"foreground-child": ["foreground-child@3.3.1", "", { "dependencies": { "cross-spawn": "^7.0.6", "signal-exit": "^4.0.1" } }, "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw=="],
"function-bind": ["function-bind@1.1.2", "", {}, "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA=="],
"glob": ["glob@11.0.3", "", { "dependencies": { "foreground-child": "^3.3.1", "jackspeak": "^4.1.1", "minimatch": "^10.0.3", "minipass": "^7.1.2", "package-json-from-dist": "^1.0.0", "path-scurry": "^2.0.0" }, "bin": { "glob": "dist/esm/bin.mjs" } }, "sha512-2Nim7dha1KVkaiF4q6Dj+ngPPMdfvLJEOpZk/jKiUAkqKebpGAWQXAq9z1xu9HKu5lWfqw/FASuccEjyznjPaA=="],
"glob-parent": ["glob-parent@5.1.2", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="],
"globby": ["globby@11.1.0", "", { "dependencies": { "array-union": "^2.1.0", "dir-glob": "^3.0.1", "fast-glob": "^3.2.9", "ignore": "^5.2.0", "merge2": "^1.4.1", "slash": "^3.0.0" } }, "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g=="],
"hard-rejection": ["hard-rejection@2.1.0", "", {}, "sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA=="],
"has-flag": ["has-flag@4.0.0", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="],
"hasown": ["hasown@2.0.2", "", { "dependencies": { "function-bind": "^1.1.2" } }, "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ=="],
"hosted-git-info": ["hosted-git-info@4.1.0", "", { "dependencies": { "lru-cache": "^6.0.0" } }, "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA=="],
"ignore": ["ignore@5.3.2", "", {}, "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g=="],
"indent-string": ["indent-string@4.0.0", "", {}, "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg=="],
"irregular-plurals": ["irregular-plurals@3.5.0", "", {}, "sha512-1ANGLZ+Nkv1ptFb2pa8oG8Lem4krflKuX/gINiHJHjJUKaJHk/SXk5x6K3J+39/p0h1RQ2saROclJJ+QLvETCQ=="],
"is-arrayish": ["is-arrayish@0.2.1", "", {}, "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg=="],
"is-core-module": ["is-core-module@2.16.1", "", { "dependencies": { "hasown": "^2.0.2" } }, "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w=="],
"is-extglob": ["is-extglob@2.1.1", "", {}, "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ=="],
"is-fullwidth-code-point": ["is-fullwidth-code-point@3.0.0", "", {}, "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg=="],
"is-glob": ["is-glob@4.0.3", "", { "dependencies": { "is-extglob": "^2.1.1" } }, "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg=="],
"is-number": ["is-number@7.0.0", "", {}, "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng=="],
"is-plain-obj": ["is-plain-obj@1.1.0", "", {}, "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg=="],
"is-unicode-supported": ["is-unicode-supported@0.1.0", "", {}, "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw=="],
"isexe": ["isexe@2.0.0", "", {}, "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="],
"jackspeak": ["jackspeak@4.1.1", "", { "dependencies": { "@isaacs/cliui": "^8.0.2" } }, "sha512-zptv57P3GpL+O0I7VdMJNBZCu+BPHVQUk55Ft8/QCJjTVxrnJHuVuX/0Bl2A6/+2oyR/ZMEuFKwmzqqZ/U5nPQ=="],
"jest-diff": ["jest-diff@29.7.0", "", { "dependencies": { "chalk": "^4.0.0", "diff-sequences": "^29.6.3", "jest-get-type": "^29.6.3", "pretty-format": "^29.7.0" } }, "sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw=="],
"jest-get-type": ["jest-get-type@29.6.3", "", {}, "sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw=="],
"js-tokens": ["js-tokens@4.0.0", "", {}, "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="],
"json-parse-even-better-errors": ["json-parse-even-better-errors@2.3.1", "", {}, "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w=="],
"json5": ["json5@2.2.3", "", { "bin": { "json5": "lib/cli.js" } }, "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg=="],
"kind-of": ["kind-of@6.0.3", "", {}, "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw=="],
"lines-and-columns": ["lines-and-columns@1.2.4", "", {}, "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg=="],
"locate-path": ["locate-path@5.0.0", "", { "dependencies": { "p-locate": "^4.1.0" } }, "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g=="],
"log-symbols": ["log-symbols@4.1.0", "", { "dependencies": { "chalk": "^4.1.0", "is-unicode-supported": "^0.1.0" } }, "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg=="],
"lru-cache": ["lru-cache@11.2.2", "", {}, "sha512-F9ODfyqML2coTIsQpSkRHnLSZMtkU8Q+mSfcaIyKwy58u+8k5nvAYeiNhsyMARvzNcXJ9QfWVrcPsC9e9rAxtg=="],
"map-obj": ["map-obj@4.3.0", "", {}, "sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ=="],
"meow": ["meow@9.0.0", "", { "dependencies": { "@types/minimist": "^1.2.0", "camelcase-keys": "^6.2.2", "decamelize": "^1.2.0", "decamelize-keys": "^1.1.0", "hard-rejection": "^2.1.0", "minimist-options": "4.1.0", "normalize-package-data": "^3.0.0", "read-pkg-up": "^7.0.1", "redent": "^3.0.0", "trim-newlines": "^3.0.0", "type-fest": "^0.18.0", "yargs-parser": "^20.2.3" } }, "sha512-+obSblOQmRhcyBt62furQqRAQpNyWXo8BuQ5bN7dG8wmwQ+vwHKp/rCFD4CrTP8CsDQD1sjoZ94K417XEUk8IQ=="],
"merge2": ["merge2@1.4.1", "", {}, "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg=="],
"micromatch": ["micromatch@4.0.8", "", { "dependencies": { "braces": "^3.0.3", "picomatch": "^2.3.1" } }, "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA=="],
"min-indent": ["min-indent@1.0.1", "", {}, "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg=="],
"minimatch": ["minimatch@10.0.3", "", { "dependencies": { "@isaacs/brace-expansion": "^5.0.0" } }, "sha512-IPZ167aShDZZUMdRk66cyQAW3qr0WzbHkPdMYa8bzZhlHhO3jALbKdxcaak7W9FfT2rZNpQuUu4Od7ILEpXSaw=="],
"minimist-options": ["minimist-options@4.1.0", "", { "dependencies": { "arrify": "^1.0.1", "is-plain-obj": "^1.1.0", "kind-of": "^6.0.3" } }, "sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A=="],
"minipass": ["minipass@7.1.2", "", {}, "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw=="],
"normalize-package-data": ["normalize-package-data@3.0.3", "", { "dependencies": { "hosted-git-info": "^4.0.1", "is-core-module": "^2.5.0", "semver": "^7.3.4", "validate-npm-package-license": "^3.0.1" } }, "sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA=="],
"normalize-path": ["normalize-path@3.0.0", "", {}, "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA=="],
"p-limit": ["p-limit@2.3.0", "", { "dependencies": { "p-try": "^2.0.0" } }, "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w=="],
"p-locate": ["p-locate@4.1.0", "", { "dependencies": { "p-limit": "^2.2.0" } }, "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A=="],
"p-try": ["p-try@2.2.0", "", {}, "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ=="],
"package-json-from-dist": ["package-json-from-dist@1.0.1", "", {}, "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw=="],
"parse-json": ["parse-json@5.2.0", "", { "dependencies": { "@babel/code-frame": "^7.0.0", "error-ex": "^1.3.1", "json-parse-even-better-errors": "^2.3.0", "lines-and-columns": "^1.1.6" } }, "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg=="],
"path-exists": ["path-exists@4.0.0", "", {}, "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w=="],
"path-key": ["path-key@3.1.1", "", {}, "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q=="],
"path-parse": ["path-parse@1.0.7", "", {}, "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw=="],
"path-scurry": ["path-scurry@2.0.0", "", { "dependencies": { "lru-cache": "^11.0.0", "minipass": "^7.1.2" } }, "sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg=="],
"path-type": ["path-type@4.0.0", "", {}, "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw=="],
"picocolors": ["picocolors@1.1.1", "", {}, "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="],
"picomatch": ["picomatch@2.3.1", "", {}, "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="],
"plur": ["plur@4.0.0", "", { "dependencies": { "irregular-plurals": "^3.2.0" } }, "sha512-4UGewrYgqDFw9vV6zNV+ADmPAUAfJPKtGvb/VdpQAx25X5f3xXdGdyOEVFwkl8Hl/tl7+xbeHqSEM+D5/TirUg=="],
"pretty-format": ["pretty-format@29.7.0", "", { "dependencies": { "@jest/schemas": "^29.6.3", "ansi-styles": "^5.0.0", "react-is": "^18.0.0" } }, "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ=="],
"queue-microtask": ["queue-microtask@1.2.3", "", {}, "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A=="],
"quick-lru": ["quick-lru@4.0.1", "", {}, "sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g=="],
"react-is": ["react-is@18.3.1", "", {}, "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg=="],
"read-pkg": ["read-pkg@5.2.0", "", { "dependencies": { "@types/normalize-package-data": "^2.4.0", "normalize-package-data": "^2.5.0", "parse-json": "^5.0.0", "type-fest": "^0.6.0" } }, "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg=="],
"read-pkg-up": ["read-pkg-up@7.0.1", "", { "dependencies": { "find-up": "^4.1.0", "read-pkg": "^5.2.0", "type-fest": "^0.8.1" } }, "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg=="],
"redent": ["redent@3.0.0", "", { "dependencies": { "indent-string": "^4.0.0", "strip-indent": "^3.0.0" } }, "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg=="],
"resolve": ["resolve@1.22.10", "", { "dependencies": { "is-core-module": "^2.16.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" } }, "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w=="],
"reusify": ["reusify@1.1.0", "", {}, "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw=="],
"rimraf": ["rimraf@6.0.1", "", { "dependencies": { "glob": "^11.0.0", "package-json-from-dist": "^1.0.0" }, "bin": { "rimraf": "dist/esm/bin.mjs" } }, "sha512-9dkvaxAsk/xNXSJzMgFqqMCuFgt2+KsOFek3TMLfo8NCPfWpBmqwyNn5Y+NX56QUYfCtsyhF3ayiboEoUmJk/A=="],
"run-parallel": ["run-parallel@1.2.0", "", { "dependencies": { "queue-microtask": "^1.2.2" } }, "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA=="],
"safe-stable-stringify": ["safe-stable-stringify@2.5.0", "", {}, "sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA=="],
"semver": ["semver@7.7.2", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA=="],
"shebang-command": ["shebang-command@2.0.0", "", { "dependencies": { "shebang-regex": "^3.0.0" } }, "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA=="],
"shebang-regex": ["shebang-regex@3.0.0", "", {}, "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="],
"signal-exit": ["signal-exit@4.1.0", "", {}, "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw=="],
"slash": ["slash@3.0.0", "", {}, "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q=="],
"spdx-correct": ["spdx-correct@3.2.0", "", { "dependencies": { "spdx-expression-parse": "^3.0.0", "spdx-license-ids": "^3.0.0" } }, "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA=="],
"spdx-exceptions": ["spdx-exceptions@2.5.0", "", {}, "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w=="],
"spdx-expression-parse": ["spdx-expression-parse@3.0.1", "", { "dependencies": { "spdx-exceptions": "^2.1.0", "spdx-license-ids": "^3.0.0" } }, "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q=="],
"spdx-license-ids": ["spdx-license-ids@3.0.22", "", {}, "sha512-4PRT4nh1EImPbt2jASOKHX7PB7I+e4IWNLvkKFDxNhJlfjbYlleYQh285Z/3mPTHSAK/AvdMmw5BNNuYH8ShgQ=="],
"spdx-license-list": ["spdx-license-list@6.10.0", "", {}, "sha512-wF3RhDFoqdu14d1Prv6c8aNU0FSRuSFJpNjWeygIZcNZEwPxp7I5/Hwo8j6lSkBKWAIkSQrKefrC5N0lvOP0Gw=="],
"string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="],
"string-width-cjs": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="],
"strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="],
"strip-ansi-cjs": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="],
"strip-indent": ["strip-indent@3.0.0", "", { "dependencies": { "min-indent": "^1.0.0" } }, "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ=="],
"supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="],
"supports-hyperlinks": ["supports-hyperlinks@2.3.0", "", { "dependencies": { "has-flag": "^4.0.0", "supports-color": "^7.0.0" } }, "sha512-RpsAZlpWcDwOPQA22aCH4J0t7L8JmAvsCxfOSEwm7cQs3LshN36QaTkwd70DnBOXDWGssw2eUoc8CaRWT0XunA=="],
"supports-preserve-symlinks-flag": ["supports-preserve-symlinks-flag@1.0.0", "", {}, "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w=="],
"to-regex-range": ["to-regex-range@5.0.1", "", { "dependencies": { "is-number": "^7.0.0" } }, "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ=="],
"trim-newlines": ["trim-newlines@3.0.1", "", {}, "sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw=="],
"ts-json-schema-generator": ["ts-json-schema-generator@2.4.0", "", { "dependencies": { "@types/json-schema": "^7.0.15", "commander": "^13.1.0", "glob": "^11.0.1", "json5": "^2.2.3", "normalize-path": "^3.0.0", "safe-stable-stringify": "^2.5.0", "tslib": "^2.8.1", "typescript": "^5.8.2" }, "bin": { "ts-json-schema-generator": "bin/ts-json-schema-generator.js" } }, "sha512-HbmNsgs58CfdJq0gpteRTxPXG26zumezOs+SB9tgky6MpqiFgQwieCn2MW70+sxpHouZ/w9LW0V6L4ZQO4y1Ug=="],
"tsd": ["tsd@0.33.0", "", { "dependencies": { "@tsd/typescript": "^5.9.2", "eslint-formatter-pretty": "^4.1.0", "globby": "^11.0.1", "jest-diff": "^29.0.3", "meow": "^9.0.0", "path-exists": "^4.0.0", "read-pkg-up": "^7.0.0" }, "bin": { "tsd": "dist/cli.js" } }, "sha512-/PQtykJFVw90QICG7zyPDMIyueOXKL7jOJVoX5pILnb3Ux+7QqynOxfVvarE+K+yi7BZyOSY4r+OZNWSWRiEwQ=="],
"tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
"type-fest": ["type-fest@0.18.1", "", {}, "sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw=="],
"typescript": ["typescript@5.9.2", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A=="],
"undici-types": ["undici-types@7.11.0", "", {}, "sha512-kt1ZriHTi7MU+Z/r9DOdAI3ONdaR3M3csEaRc6ewa4f4dTvX4cQCbJ4NkEn0ohE4hHtq85+PhPSTY+pO/1PwgA=="],
"validate-npm-package-license": ["validate-npm-package-license@3.0.4", "", { "dependencies": { "spdx-correct": "^3.0.0", "spdx-expression-parse": "^3.0.0" } }, "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew=="],
"which": ["which@2.0.2", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "./bin/node-which" } }, "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="],
"wrap-ansi": ["wrap-ansi@8.1.0", "", { "dependencies": { "ansi-styles": "^6.1.0", "string-width": "^5.0.1", "strip-ansi": "^7.0.1" } }, "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ=="],
"wrap-ansi-cjs": ["wrap-ansi@7.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="],
"yallist": ["yallist@4.0.0", "", {}, "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="],
"yargs-parser": ["yargs-parser@20.2.9", "", {}, "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w=="],
"@isaacs/cliui/string-width": ["string-width@5.1.2", "", { "dependencies": { "eastasianwidth": "^0.2.0", "emoji-regex": "^9.2.2", "strip-ansi": "^7.0.1" } }, "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA=="],
"@isaacs/cliui/strip-ansi": ["strip-ansi@7.1.2", "", { "dependencies": { "ansi-regex": "^6.0.1" } }, "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA=="],
"ansi-escapes/type-fest": ["type-fest@0.21.3", "", {}, "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w=="],
"decamelize-keys/map-obj": ["map-obj@1.0.1", "", {}, "sha512-7N/q3lyZ+LVCp7PzuxrJr4KMbBE2hW7BT7YNia330OFxIf4d3r5zVpicP2650l7CPN6RM9zOJRl3NGpqSiw3Eg=="],
"hosted-git-info/lru-cache": ["lru-cache@6.0.0", "", { "dependencies": { "yallist": "^4.0.0" } }, "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA=="],
"pretty-format/ansi-styles": ["ansi-styles@5.2.0", "", {}, "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA=="],
"read-pkg/normalize-package-data": ["normalize-package-data@2.5.0", "", { "dependencies": { "hosted-git-info": "^2.1.4", "resolve": "^1.10.0", "semver": "2 || 3 || 4 || 5", "validate-npm-package-license": "^3.0.1" } }, "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA=="],
"read-pkg/type-fest": ["type-fest@0.6.0", "", {}, "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg=="],
"read-pkg-up/type-fest": ["type-fest@0.8.1", "", {}, "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA=="],
"wrap-ansi/ansi-styles": ["ansi-styles@6.2.3", "", {}, "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg=="],
"wrap-ansi/string-width": ["string-width@5.1.2", "", { "dependencies": { "eastasianwidth": "^0.2.0", "emoji-regex": "^9.2.2", "strip-ansi": "^7.0.1" } }, "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA=="],
"wrap-ansi/strip-ansi": ["strip-ansi@7.1.2", "", { "dependencies": { "ansi-regex": "^6.0.1" } }, "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA=="],
"@isaacs/cliui/string-width/emoji-regex": ["emoji-regex@9.2.2", "", {}, "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg=="],
"@isaacs/cliui/strip-ansi/ansi-regex": ["ansi-regex@6.2.2", "", {}, "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg=="],
"read-pkg/normalize-package-data/hosted-git-info": ["hosted-git-info@2.8.9", "", {}, "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw=="],
"read-pkg/normalize-package-data/semver": ["semver@5.7.2", "", { "bin": { "semver": "bin/semver" } }, "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g=="],
"wrap-ansi/string-width/emoji-regex": ["emoji-regex@9.2.2", "", {}, "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg=="],
"wrap-ansi/strip-ansi/ansi-regex": ["ansi-regex@6.2.2", "", {}, "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg=="],
}
}

View File

@@ -1,100 +1,127 @@
{
"name": "oas-types",
"version": "1.0.0",
"description": "Comprehensive TypeScript definitions for all OpenAPI specification versions (Swagger 2.0, OpenAPI 3.0.x, 3.1.x, 3.2.0)",
"main": "index.ts",
"module": "index.ts",
"type": "module",
"types": "index.ts",
"author": {
"name": "Luke Hagar",
"email": "lukeslakemail@gmail.com",
"url": "https://lukehagar.com/"
},
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/lukehagar/openapi-types.git"
},
"bugs": {
"url": "https://github.com/lukehagar/openapi-types/issues"
},
"homepage": "https://github.com/lukehagar/openapi-types#readme",
"scripts": {
"test": "bun test",
"test:watch": "bun test --watch",
"test:coverage": "bun test --coverage",
"test:common": "bun test tests/common.test.ts",
"test:open-enums": "bun test tests/open-enums.test.ts",
"test:swagger-2.0": "bun test tests/swagger-2.0.test.ts",
"test:openapi-3.0.0": "bun test tests/openapi-3.0.0.test.ts",
"test:integration": "bun test tests/integration.test.ts",
"type-check": "tsc --noEmit",
"build": "tsc",
"dev": "bun run --watch index.ts",
"lint": "biome check .",
"lint:fix": "biome check --write ."
},
"dependencies": {
"spdx-license-list": "^6.10.0"
},
"devDependencies": {
"@biomejs/biome": "^2.2.4",
"@types/bun": "latest",
"tsd": "^0.33.0",
"typescript": "^5.9.2"
},
"peerDependencies": {
"typescript": "^5.0.0"
},
"exports": {
".": {
"types": "./index.ts",
"import": "./index.ts"
},
"./2.0": {
"types": "./2.0/index.ts",
"import": "./2.0/index.ts"
},
"./3.0": {
"types": "./3.0/index.ts",
"import": "./3.0/index.ts"
},
"./3.1": {
"types": "./3.1/index.ts",
"import": "./3.1/index.ts"
},
"./3.2": {
"types": "./3.2/index.ts",
"import": "./3.2/index.ts"
}
},
"files": [
"2.0/",
"3.0/",
"3.1/",
"3.2/",
"License.ts",
"SPDXLicenseList.ts",
"MIGRATION.md",
"index.ts",
"README.md",
"LICENSE"
],
"keywords": [
"openapi",
"swagger",
"typescript",
"types",
"definitions",
"api",
"specification",
"swagger-2.0",
"openapi-3.0",
"openapi-3.1",
"openapi-3.2",
"json-schema",
"rest",
"api-documentation"
]
"name": "oas-types",
"version": "1.0.1",
"description": "Comprehensive TypeScript definitions for all OpenAPI specification versions (Swagger 2.0, OpenAPI 3.0, 3.1, 3.2)",
"main": "index.ts",
"module": "index.ts",
"type": "module",
"types": "index.ts",
"author": {
"name": "Luke Hagar",
"email": "lukeslakemail@gmail.com",
"url": "https://lukehagar.com/"
},
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/lukehagar/openapi-types.git"
},
"bugs": {
"url": "https://github.com/lukehagar/openapi-types/issues"
},
"homepage": "https://github.com/lukehagar/openapi-types#readme",
"scripts": {
"test": "bun test",
"test:watch": "bun test --watch",
"test:coverage": "bun test --coverage",
"test:common": "bun test tests/common.test.ts",
"test:open-enums": "bun test tests/open-enums.test.ts",
"test:swagger-2.0": "bun test tests/swagger-2.0.test.ts",
"test:openapi-3.0.0": "bun test tests/openapi-3.0.0.test.ts",
"test:integration": "bun test tests/integration.test.ts",
"type-check": "tsc --noEmit",
"build": "bun run build.ts",
"build:schemas": "bun run build.ts",
"dev": "bun run --watch index.ts",
"lint": "biome check .",
"lint:fix": "biome check --write .",
"test:version": "node scripts/test-version-comparison.js",
"schemas:clean": "rm -rf schemas/",
"schemas:validate": "echo 'Schema validation not yet implemented'"
},
"dependencies": {
"rimraf": "^6.0.1",
"spdx-license-list": "^6.10.0"
},
"devDependencies": {
"@biomejs/biome": "^2.2.4",
"@types/bun": "^1.2.23",
"ts-json-schema-generator": "^2.4.0",
"tsd": "^0.33.0",
"typescript": "^5.9.2"
},
"peerDependencies": {
"typescript": "^5.0.0"
},
"exports": {
".": {
"types": "./index.ts",
"import": "./index.ts"
},
"./2.0": {
"types": "./2.0/index.ts",
"import": "./2.0/index.ts"
},
"./3.0": {
"types": "./3.0/index.ts",
"import": "./3.0/index.ts"
},
"./3.1": {
"types": "./3.1/index.ts",
"import": "./3.1/index.ts"
},
"./3.2": {
"types": "./3.2/index.ts",
"import": "./3.2/index.ts"
},
"./schemas": {
"types": "./schemas/index.ts",
"import": "./schemas/index.ts"
},
"./schemas/2.0": {
"types": "./schemas/2.0/index.ts",
"import": "./schemas/2.0/index.ts"
},
"./schemas/3.0": {
"types": "./schemas/3.0/index.ts",
"import": "./schemas/3.0/index.ts"
},
"./schemas/3.1": {
"types": "./schemas/3.1/index.ts",
"import": "./schemas/3.1/index.ts"
},
"./schemas/3.2": {
"types": "./schemas/3.2/index.ts",
"import": "./schemas/3.2/index.ts"
}
},
"files": [
"2.0/",
"3.0/",
"3.1/",
"3.2/",
"schemas/",
"License.ts",
"SPDXLicenseList.ts",
"MIGRATION.md",
"index.ts",
"README.md",
"LICENSE"
],
"keywords": [
"openapi",
"swagger",
"typescript",
"types",
"definitions",
"api",
"specification",
"swagger-2.0",
"openapi-3.0",
"openapi-3.1",
"openapi-3.2",
"json-schema",
"rest",
"api-documentation"
]
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

33
schemas/2.0/index.ts Normal file
View File

@@ -0,0 +1,33 @@
/**
* OpenAPI 2.0 JSON Schemas
*
* This file exports all available JSON schemas for OpenAPI 2.0 specification.
* These schemas can be used to validate OpenAPI 2.0 documents and components.
*/
export { default as specification } from "./main/specification.json";
// Component schemas
export { default as response } from "./components/response.json";
export { default as parameter } from "./components/parameter.json";
export { default as schema } from "./components/schema.json";
export { default as pathitem } from "./components/pathitem.json";
// Import all schemas for internal use
import specification from "./main/specification.json";
import response from "./components/response.json";
import parameter from "./components/parameter.json";
import schema from "./components/schema.json";
import pathitem from "./components/pathitem.json";
// Re-export all schemas as a single object for convenience
export const schemas = {
specification,
response,
parameter,
schema,
pathitem,
} as const;
// Type definitions for better TypeScript support
export type SchemaName = keyof typeof schemas;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

48
schemas/3.0/index.ts Normal file
View File

@@ -0,0 +1,48 @@
/**
* OpenAPI 3.0 JSON Schemas
*
* This file exports all available JSON schemas for OpenAPI 3.0 specification.
* These schemas can be used to validate OpenAPI 3.0 documents and components.
*/
export { default as specification } from "./main/specification.json";
// Component schemas
export { default as response } from "./components/response.json";
export { default as link } from "./components/link.json";
export { default as requestbody } from "./components/requestbody.json";
export { default as example } from "./components/example.json";
export { default as parameter } from "./components/parameter.json";
export { default as schema } from "./components/schema.json";
export { default as securityscheme } from "./components/securityscheme.json";
export { default as header } from "./components/header.json";
export { default as callback } from "./components/callback.json";
// Import all schemas for internal use
import specification from "./main/specification.json";
import response from "./components/response.json";
import link from "./components/link.json";
import requestbody from "./components/requestbody.json";
import example from "./components/example.json";
import parameter from "./components/parameter.json";
import schema from "./components/schema.json";
import securityscheme from "./components/securityscheme.json";
import header from "./components/header.json";
import callback from "./components/callback.json";
// Re-export all schemas as a single object for convenience
export const schemas = {
specification,
response,
link,
requestbody,
example,
parameter,
schema,
securityscheme,
header,
callback,
} as const;
// Type definitions for better TypeScript support
export type SchemaName = keyof typeof schemas;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

51
schemas/3.1/index.ts Normal file
View File

@@ -0,0 +1,51 @@
/**
* OpenAPI 3.1 JSON Schemas
*
* This file exports all available JSON schemas for OpenAPI 3.1 specification.
* These schemas can be used to validate OpenAPI 3.1 documents and components.
*/
export { default as specification } from "./main/specification.json";
// Component schemas
export { default as response } from "./components/response.json";
export { default as link } from "./components/link.json";
export { default as requestbody } from "./components/requestbody.json";
export { default as example } from "./components/example.json";
export { default as parameter } from "./components/parameter.json";
export { default as schema } from "./components/schema.json";
export { default as securityscheme } from "./components/securityscheme.json";
export { default as header } from "./components/header.json";
export { default as callback } from "./components/callback.json";
export { default as pathitem } from "./components/pathitem.json";
// Import all schemas for internal use
import specification from "./main/specification.json";
import response from "./components/response.json";
import link from "./components/link.json";
import requestbody from "./components/requestbody.json";
import example from "./components/example.json";
import parameter from "./components/parameter.json";
import schema from "./components/schema.json";
import securityscheme from "./components/securityscheme.json";
import header from "./components/header.json";
import callback from "./components/callback.json";
import pathitem from "./components/pathitem.json";
// Re-export all schemas as a single object for convenience
export const schemas = {
specification,
response,
link,
requestbody,
example,
parameter,
schema,
securityscheme,
header,
callback,
pathitem,
} as const;
// Type definitions for better TypeScript support
export type SchemaName = keyof typeof schemas;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

54
schemas/3.2/index.ts Normal file
View File

@@ -0,0 +1,54 @@
/**
* OpenAPI 3.2 JSON Schemas
*
* This file exports all available JSON schemas for OpenAPI 3.2 specification.
* These schemas can be used to validate OpenAPI 3.2 documents and components.
*/
export { default as specification } from "./main/specification.json";
// Component schemas
export { default as response } from "./components/response.json";
export { default as link } from "./components/link.json";
export { default as requestbody } from "./components/requestbody.json";
export { default as example } from "./components/example.json";
export { default as parameter } from "./components/parameter.json";
export { default as schema } from "./components/schema.json";
export { default as mediatype } from "./components/mediatype.json";
export { default as securityscheme } from "./components/securityscheme.json";
export { default as header } from "./components/header.json";
export { default as callback } from "./components/callback.json";
export { default as pathitem } from "./components/pathitem.json";
// Import all schemas for internal use
import specification from "./main/specification.json";
import response from "./components/response.json";
import link from "./components/link.json";
import requestbody from "./components/requestbody.json";
import example from "./components/example.json";
import parameter from "./components/parameter.json";
import schema from "./components/schema.json";
import mediatype from "./components/mediatype.json";
import securityscheme from "./components/securityscheme.json";
import header from "./components/header.json";
import callback from "./components/callback.json";
import pathitem from "./components/pathitem.json";
// Re-export all schemas as a single object for convenience
export const schemas = {
specification,
response,
link,
requestbody,
example,
parameter,
schema,
mediatype,
securityscheme,
header,
callback,
pathitem,
} as const;
// Type definitions for better TypeScript support
export type SchemaName = keyof typeof schemas;

File diff suppressed because it is too large Load Diff

25
schemas/index.ts Normal file
View File

@@ -0,0 +1,25 @@
/**
* OpenAPI JSON Schemas
*
* This file exports all available JSON schemas for all OpenAPI specification versions.
* These schemas can be used to validate OpenAPI documents and components.
*/
// Export schemas for each version
export * as schemas2_0 from "./2.0";
export * as schemas3_0 from "./3.0";
export * as schemas3_1 from "./3.1";
export * as schemas3_2 from "./3.2";
import { schemas as schemas2_0 } from "./2.0";
import { schemas as schemas3_0 } from "./3.0";
import { schemas as schemas3_1 } from "./3.1";
import { schemas as schemas3_2 } from "./3.2";
// Export all schemas in a single object organized by version
export const allSchemas = {
"2.0": schemas2_0,
"3.0": schemas3_0,
"3.1": schemas3_1,
"3.2": schemas3_2,
} as const;

92
tests/validate-schema.ts Executable file
View File

@@ -0,0 +1,92 @@
#!/usr/bin/env bun
import { readFileSync } from "fs";
import { resolve } from "path";
// Simple JSON Schema validation function
function validateAgainstSchema(
data: any,
schema: any
): { valid: boolean; errors: string[] } {
const errors: string[] = [];
// Basic validation logic (simplified)
if (schema.required) {
for (const field of schema.required) {
if (!(field in data)) {
errors.push(`Missing required field: ${field}`);
}
}
}
if (schema.type) {
if (schema.type === "object" && typeof data !== "object") {
errors.push(`Expected object, got ${typeof data}`);
} else if (schema.type === "string" && typeof data !== "string") {
errors.push(`Expected string, got ${typeof data}`);
} else if (schema.type === "array" && !Array.isArray(data)) {
errors.push(`Expected array, got ${typeof data}`);
}
}
return {
valid: errors.length === 0,
errors,
};
}
async function validateOpenAPIDocument(
filePath: string,
version: string = "3.0"
): Promise<void> {
try {
console.log(`🔍 Validating OpenAPI document: ${filePath}`);
console.log(`📋 Using OpenAPI ${version} schema`);
// Load the document
const document = JSON.parse(readFileSync(filePath, "utf-8"));
// Load the appropriate schema
const schemaPath = resolve(`./schemas/${version}/main/specification.json`);
const schema = JSON.parse(readFileSync(schemaPath, "utf-8"));
// Validate
const result = validateAgainstSchema(document, schema);
if (result.valid) {
console.log("✅ Document is valid!");
} else {
console.log("❌ Document has validation errors:");
result.errors.forEach((error) => console.log(` - ${error}`));
}
} catch (error) {
console.error("❌ Validation failed:", error);
}
}
async function main() {
const args = process.argv.slice(2);
if (args.length === 0) {
console.log(
"Usage: bun run scripts/validate-schema.ts <openapi-file> [version]"
);
console.log(
"Example: bun run scripts/validate-schema.ts ./my-api.json 3.0"
);
return;
}
const filePath = args[0];
const version = args[1] || "3.0";
if (!filePath) {
console.error("❌ Error: File path is required");
return;
}
await validateOpenAPIDocument(filePath, version);
}
// Run the script
main().catch(console.error);