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 { 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;
}