@tsed/schema 8.19.2 → 8.19.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/lib/esm/components/open-spec/nullableMapper.js +6 -2
  2. package/lib/esm/constants/OperationVerbs.js +35 -0
  3. package/lib/esm/constants/VendorKeys.js +29 -0
  4. package/lib/esm/constants/httpStatusMessages.js +59 -0
  5. package/lib/esm/constants/jsonSchemaProperties.js +55 -0
  6. package/lib/esm/decorators/class/children.js +93 -5
  7. package/lib/esm/decorators/class/discriminatorValue.js +124 -20
  8. package/lib/esm/decorators/collections/collectionContains.js +91 -10
  9. package/lib/esm/decorators/collections/maxItems.js +97 -27
  10. package/lib/esm/decorators/collections/maxProperties.js +96 -30
  11. package/lib/esm/decorators/collections/minItems.js +122 -27
  12. package/lib/esm/decorators/collections/minProperties.js +132 -31
  13. package/lib/esm/decorators/common/additionalProperties.js +59 -4
  14. package/lib/esm/decorators/common/allOf.js +61 -6
  15. package/lib/esm/decorators/common/allow.js +56 -12
  16. package/lib/esm/decorators/common/any.js +58 -18
  17. package/lib/esm/decorators/common/anyOf.js +65 -9
  18. package/lib/esm/decorators/common/const.js +72 -30
  19. package/lib/esm/decorators/common/customKey.js +132 -12
  20. package/lib/esm/decorators/common/default.js +85 -19
  21. package/lib/esm/decorators/common/discriminatorKey.js +123 -0
  22. package/lib/esm/decorators/common/errorMsg.js +48 -2
  23. package/lib/esm/decorators/common/example.js +68 -6
  24. package/lib/esm/decorators/common/examples.js +99 -6
  25. package/lib/esm/decorators/common/format.js +86 -52
  26. package/lib/esm/decorators/common/nullable.js +77 -11
  27. package/lib/esm/decorators/common/oneOf.js +93 -9
  28. package/lib/esm/decorators/common/optional.js +93 -4
  29. package/lib/esm/decorators/common/property.js +42 -6
  30. package/lib/esm/decorators/common/readOnly.js +106 -5
  31. package/lib/esm/decorators/common/required.js +57 -20
  32. package/lib/esm/decorators/common/writeOnly.js +117 -5
  33. package/lib/esm/domain/JsonClassStore.js +75 -0
  34. package/lib/esm/domain/JsonDiscriminator.js +57 -0
  35. package/lib/esm/domain/JsonEntityStore.js +46 -0
  36. package/lib/esm/domain/JsonFormatTypes.js +39 -0
  37. package/lib/esm/domain/JsonLazyRef.js +33 -0
  38. package/lib/esm/domain/JsonMap.js +32 -0
  39. package/lib/esm/domain/JsonMedia.js +28 -0
  40. package/lib/esm/domain/JsonMethodStore.js +56 -0
  41. package/lib/esm/domain/JsonOperation.js +43 -0
  42. package/lib/esm/domain/JsonOperationPathsMap.js +38 -0
  43. package/lib/esm/domain/JsonOperationRoute.js +54 -0
  44. package/lib/esm/domain/JsonParameter.js +35 -0
  45. package/lib/esm/domain/JsonParameterStore.js +71 -0
  46. package/lib/esm/domain/JsonParameterTypes.js +26 -0
  47. package/lib/esm/domain/JsonPropertyStore.js +44 -0
  48. package/lib/esm/domain/JsonRequestBody.js +26 -0
  49. package/lib/esm/domain/JsonResponse.js +29 -0
  50. package/lib/esm/domain/JsonSchema.js +365 -16
  51. package/lib/esm/domain/SpecTypes.js +26 -0
  52. package/lib/esm/fn/boolean.js +39 -3
  53. package/lib/esm/fn/number.js +45 -3
  54. package/lib/esm/fn/string.js +43 -3
  55. package/lib/types/constants/OperationVerbs.d.ts +35 -0
  56. package/lib/types/constants/VendorKeys.d.ts +29 -0
  57. package/lib/types/constants/httpStatusMessages.d.ts +59 -0
  58. package/lib/types/constants/jsonSchemaProperties.d.ts +55 -0
  59. package/lib/types/decorators/class/children.d.ts +93 -5
  60. package/lib/types/decorators/class/discriminatorValue.d.ts +124 -20
  61. package/lib/types/decorators/collections/collectionContains.d.ts +91 -10
  62. package/lib/types/decorators/collections/maxItems.d.ts +97 -27
  63. package/lib/types/decorators/collections/maxProperties.d.ts +96 -30
  64. package/lib/types/decorators/collections/minItems.d.ts +122 -27
  65. package/lib/types/decorators/collections/minProperties.d.ts +132 -31
  66. package/lib/types/decorators/common/additionalProperties.d.ts +59 -4
  67. package/lib/types/decorators/common/allOf.d.ts +61 -6
  68. package/lib/types/decorators/common/allow.d.ts +56 -12
  69. package/lib/types/decorators/common/any.d.ts +58 -18
  70. package/lib/types/decorators/common/anyOf.d.ts +65 -9
  71. package/lib/types/decorators/common/const.d.ts +72 -30
  72. package/lib/types/decorators/common/customKey.d.ts +132 -12
  73. package/lib/types/decorators/common/default.d.ts +85 -19
  74. package/lib/types/decorators/common/discriminatorKey.d.ts +123 -0
  75. package/lib/types/decorators/common/errorMsg.d.ts +48 -2
  76. package/lib/types/decorators/common/example.d.ts +68 -6
  77. package/lib/types/decorators/common/examples.d.ts +99 -6
  78. package/lib/types/decorators/common/format.d.ts +86 -52
  79. package/lib/types/decorators/common/nullable.d.ts +77 -11
  80. package/lib/types/decorators/common/oneOf.d.ts +93 -9
  81. package/lib/types/decorators/common/optional.d.ts +93 -4
  82. package/lib/types/decorators/common/property.d.ts +42 -6
  83. package/lib/types/decorators/common/readOnly.d.ts +106 -5
  84. package/lib/types/decorators/common/required.d.ts +57 -20
  85. package/lib/types/decorators/common/writeOnly.d.ts +117 -5
  86. package/lib/types/domain/JsonClassStore.d.ts +75 -0
  87. package/lib/types/domain/JsonDiscriminator.d.ts +57 -0
  88. package/lib/types/domain/JsonEntityStore.d.ts +51 -0
  89. package/lib/types/domain/JsonFormatTypes.d.ts +39 -0
  90. package/lib/types/domain/JsonLazyRef.d.ts +33 -0
  91. package/lib/types/domain/JsonMap.d.ts +32 -0
  92. package/lib/types/domain/JsonMedia.d.ts +28 -0
  93. package/lib/types/domain/JsonMethodStore.d.ts +66 -0
  94. package/lib/types/domain/JsonOperation.d.ts +51 -0
  95. package/lib/types/domain/JsonOperationPathsMap.d.ts +38 -0
  96. package/lib/types/domain/JsonOperationRoute.d.ts +54 -0
  97. package/lib/types/domain/JsonParameter.d.ts +35 -0
  98. package/lib/types/domain/JsonParameterStore.d.ts +97 -0
  99. package/lib/types/domain/JsonParameterTypes.d.ts +26 -0
  100. package/lib/types/domain/JsonPropertyStore.d.ts +44 -0
  101. package/lib/types/domain/JsonRequestBody.d.ts +31 -0
  102. package/lib/types/domain/JsonResponse.d.ts +34 -0
  103. package/lib/types/domain/JsonSchema.d.ts +422 -19
  104. package/lib/types/domain/SpecTypes.d.ts +26 -0
  105. package/lib/types/domain/types.d.ts +90 -0
  106. package/lib/types/fn/boolean.d.ts +39 -3
  107. package/lib/types/fn/number.d.ts +45 -3
  108. package/lib/types/fn/string.d.ts +43 -3
  109. package/lib/types/interfaces/IgnoreCallback.d.ts +24 -0
  110. package/lib/types/interfaces/JsonHookContext.d.ts +31 -0
  111. package/lib/types/interfaces/JsonOpenSpec.d.ts +33 -0
  112. package/lib/types/interfaces/JsonSchemaOptions.d.ts +26 -0
  113. package/package.json +7 -7
@@ -1,44 +1,81 @@
1
1
  /**
2
- * Add required annotation on Property or Parameter.
2
+ * Mark a property or parameter as required.
3
3
  *
4
- * The @@Required@@ decorator can be used on two cases.
4
+ * The `@Required()` decorator enforces that a property must have a value during
5
+ * validation. It works on both model properties and method parameters, and triggers
6
+ * validation errors when values are `null`, `undefined`, or empty strings.
5
7
  *
6
- * To decorate a parameters:
8
+ * ### Usage on Properties
7
9
  *
8
10
  * ```typescript
9
- * @Post("/")
10
- * async method(@Required() @BodyParams("field") field: string) {}
11
+ * class User {
12
+ * @Required()
13
+ * @Property()
14
+ * email: string;
15
+ *
16
+ * @Required()
17
+ * @Property()
18
+ * name: string;
19
+ * }
11
20
  * ```
12
21
  *
13
- * To decorate a model:
22
+ * ### Usage on Parameters
23
+ *
24
+ * ```typescript
25
+ * @Controller("/users")
26
+ * class UserController {
27
+ * @Post("/")
28
+ * async create(@Required() @BodyParams() user: User) {
29
+ * // user is required in request body
30
+ * }
31
+ *
32
+ * @Get("/:id")
33
+ * async get(@Required() @PathParams("id") id: string) {
34
+ * // id is required in path
35
+ * }
36
+ * }
37
+ * ```
38
+ *
39
+ * ### Validation Behavior
40
+ *
41
+ * By default, `@Required()` rejects:
42
+ * - `null` values
43
+ * - `undefined` values
44
+ * - Empty strings (`""`)
45
+ *
46
+ * ### Allowing Specific Values
47
+ *
48
+ * Use `@Allow()` to permit specific values that would normally be rejected:
14
49
  *
15
50
  * ```typescript
16
51
  * class Model {
52
+ * // Allow empty string but still mark as required
17
53
  * @Required()
18
- * field: string;
54
+ * @Allow("")
55
+ * optionalText: string;
56
+ *
57
+ * // Allow null
58
+ * @Required()
59
+ * @Allow(null)
60
+ * nullableField: string | null;
19
61
  * }
20
62
  * ```
21
63
  *
22
- * ::: tip
23
- * Required will throw a BadRequest when the given value is `null`, an empty string or `undefined`.
24
- * :::
64
+ * ### Making Optional
25
65
  *
26
- * ### Allow values
27
- *
28
- * In some case, you didn't want trigger a BadRequest when the value is an empty string for example.
29
- * The decorator `@Allow()`, allow you to configure a value list for which there will be no exception.
66
+ * To explicitly mark a property as optional:
30
67
  *
31
68
  * ```typescript
32
69
  * class Model {
33
- * @Allow("") // add automatically required flag
34
- * field: string;
70
+ * @Required(false) // or use @Optional()
71
+ * optionalField: string;
35
72
  * }
36
73
  * ```
37
74
  *
75
+ * @param required - Whether the property/parameter is required (default: true)
76
+ * @param allowedRequiredValues - Values to allow even when marked as required
77
+ *
38
78
  * @decorator
39
- * @validation
40
- * @swagger
41
- * @schema
42
- * @input
79
+ * @public
43
80
  */
44
81
  export declare const Required: import("../../utils/withErrorMsg.js").ErrorChainedDecorator<(required?: boolean, ...allowedRequiredValues: any[]) => any>;
@@ -1,11 +1,123 @@
1
1
  /**
2
- * Set the property as WriteOnly.
2
+ * Marks a property as write-only, indicating it should not be included in responses.
3
+ *
4
+ * The `@WriteOnly()` decorator sets the `writeOnly` flag in the JSON Schema, which signals
5
+ * that this property should only appear in request payloads and be excluded from response
6
+ * data. This is commonly used for sensitive data like passwords that should be accepted
7
+ * as input but never returned to clients.
8
+ *
9
+ * ### Basic Usage - Passwords
10
+ *
11
+ * ```typescript
12
+ * class UserModel {
13
+ * @Property()
14
+ * username: string;
15
+ * // Readable and writable
16
+ *
17
+ * @WriteOnly()
18
+ * password: string;
19
+ * // Can be sent in requests but never returned in responses
20
+ * }
21
+ * ```
22
+ *
23
+ * ### Registration/Update Models
24
+ *
25
+ * ```typescript
26
+ * class UserRegistration {
27
+ * @Property()
28
+ * email: string;
29
+ *
30
+ * @WriteOnly()
31
+ * @MinLength(8)
32
+ * password: string;
33
+ *
34
+ * @WriteOnly()
35
+ * passwordConfirmation: string;
36
+ * // Only needed for validation, never stored or returned
37
+ * }
38
+ * ```
39
+ *
40
+ * ### Sensitive Configuration
41
+ *
42
+ * ```typescript
43
+ * class ApiKeyConfig {
44
+ * @Property()
45
+ * name: string;
46
+ *
47
+ * @WriteOnly()
48
+ * apiKey: string;
49
+ * // Accept key in requests, but don't expose it in responses
50
+ *
51
+ * @ReadOnly()
52
+ * createdAt: Date;
53
+ * // Only in responses
54
+ * }
55
+ * ```
56
+ *
57
+ * ### Toggle Write-Only
58
+ *
59
+ * ```typescript
60
+ * class SecureModel {
61
+ * @WriteOnly(true)
62
+ * secret: string;
63
+ * // Write-only
64
+ *
65
+ * @WriteOnly(false)
66
+ * publicField: string;
67
+ * // Explicitly not write-only (default behavior)
68
+ * }
69
+ * ```
70
+ *
71
+ * ### OpenAPI Behavior
72
+ *
73
+ * In OpenAPI/Swagger documentation:
74
+ * - Write-only properties appear in **request** schemas
75
+ * - Write-only properties are **excluded** from **response** schemas
76
+ * - Helps document sensitive fields that shouldn't be returned
77
+ *
78
+ * ### vs ReadOnly
79
+ *
80
+ * - `@WriteOnly()`: Property can be written but not read (requests only)
81
+ * - `@ReadOnly()`: Property can be read but not written (responses only)
82
+ * - Neither: Property can be both read and written
83
+ *
84
+ * ### Common Use Cases
85
+ *
86
+ * - **Passwords**: Authentication credentials that should never be exposed
87
+ * - **Secret Keys**: API keys, tokens, or other sensitive credentials
88
+ * - **Confirmation Fields**: Password confirmation, email confirmation
89
+ * - **Temporary Inputs**: Fields used only for processing, not storage
90
+ * - **Security Tokens**: CSRF tokens or one-time codes
91
+ *
92
+ * ### Security Best Practices
93
+ *
94
+ * ```typescript
95
+ * class ChangePassword {
96
+ * @WriteOnly()
97
+ * @MinLength(8)
98
+ * currentPassword: string;
99
+ *
100
+ * @WriteOnly()
101
+ * @MinLength(8)
102
+ * newPassword: string;
103
+ *
104
+ * @WriteOnly()
105
+ * newPasswordConfirmation: string;
106
+ * // All password fields are write-only
107
+ * }
108
+ * ```
109
+ *
110
+ * ### Important Notes
111
+ *
112
+ * - `@WriteOnly()` is a schema hint for documentation and client validation
113
+ * - Server-side code must still explicitly exclude these fields from responses
114
+ * - Use serialization groups or DTOs to ensure write-only fields aren't leaked
115
+ * - Always hash/encrypt sensitive data before storage
116
+ *
117
+ * @param writeOnly - Whether the property is write-only (default: true)
3
118
  *
4
- * @returns {Function}
5
119
  * @decorator
6
120
  * @validation
7
- * @property
8
- * @parameter
9
- * @schema
121
+ * @public
10
122
  */
11
123
  export declare function WriteOnly(writeOnly?: boolean): (...args: any[]) => any;
@@ -1,6 +1,81 @@
1
1
  import { JsonEntityStore } from "./JsonEntityStore.js";
2
2
  import type { JsonMethodStore } from "./JsonMethodStore.js";
3
3
  import type { JsonPropertyStore } from "./JsonPropertyStore.js";
4
+ /**
5
+ * Store for class-level metadata and schema information.
6
+ *
7
+ * JsonClassStore manages metadata for classes decorated with schema decorators like
8
+ * `@Model()`, `@Generics()`, `@DiscriminatorKey()`, etc. It serves as the root container
9
+ * for all class-level schema information and coordinates child stores for properties
10
+ * and methods.
11
+ *
12
+ * ### Responsibilities
13
+ *
14
+ * - **Schema Generation**: Creates and maintains the JsonSchema for the class
15
+ * - **Children Coordination**: Manages child PropertyStore and MethodStore instances
16
+ * - **Route Configuration**: Stores base path for controller classes
17
+ * - **Inheritance**: Handles schema inheritance from parent classes
18
+ * - **OpenAPI Integration**: Generates component schemas for OpenAPI specifications
19
+ *
20
+ * ### Usage
21
+ *
22
+ * ```typescript
23
+ * // Get class store
24
+ * const classStore = JsonEntityStore.from(MyClass);
25
+ *
26
+ * // Access class schema
27
+ * const schema = classStore.schema;
28
+ *
29
+ * // Get all properties
30
+ * const properties = classStore.children;
31
+ *
32
+ * // Check if it's a controller with a path
33
+ * const path = classStore.path;
34
+ * ```
35
+ *
36
+ * ### Class Store Hierarchy
37
+ *
38
+ * The class store acts as the root of the store hierarchy:
39
+ * ```
40
+ * JsonClassStore (User class)
41
+ * ├─ JsonPropertyStore (name property)
42
+ * ├─ JsonPropertyStore (email property)
43
+ * └─ JsonMethodStore (validate method)
44
+ * ├─ JsonParameterStore (param 0)
45
+ * └─ JsonParameterStore (param 1)
46
+ * ```
47
+ *
48
+ * ### Schema Structure
49
+ *
50
+ * For a class like:
51
+ * ```typescript
52
+ * class User {
53
+ * @Property()
54
+ * name: string;
55
+ *
56
+ * @Property()
57
+ * email: string;
58
+ * }
59
+ * ```
60
+ *
61
+ * The class store generates:
62
+ * ```json
63
+ * {
64
+ * "type": "object",
65
+ * "properties": {
66
+ * "name": {"type": "string"},
67
+ * "email": {"type": "string"}
68
+ * }
69
+ * }
70
+ * ```
71
+ *
72
+ * ### Controller Path
73
+ *
74
+ * For controller classes decorated with `@Controller("/users")`, the store
75
+ * maintains the base path which is used for route generation.
76
+ *
77
+ * @public
78
+ */
4
79
  export declare class JsonClassStore extends JsonEntityStore {
5
80
  /**
6
81
  * List of children JsonEntityStore (properties or methods or params)
@@ -1,4 +1,61 @@
1
1
  import { Type } from "@tsed/core";
2
+ /**
3
+ * Manages discriminator mappings for polymorphic type resolution.
4
+ *
5
+ * A discriminator enables polymorphism in schemas by using a specific property
6
+ * value to determine which subtype schema to apply. This is essential for
7
+ * inheritance hierarchies and union types in OpenAPI specifications.
8
+ *
9
+ * ### Concept
10
+ *
11
+ * When a base class has multiple derived classes, the discriminator property
12
+ * (e.g., "type", "kind") indicates which concrete class an object represents.
13
+ *
14
+ * ### Usage
15
+ *
16
+ * ```typescript
17
+ * // Base class
18
+ * @DiscriminatorKey("type")
19
+ * abstract class Animal {
20
+ * type: string;
21
+ * }
22
+ *
23
+ * // Derived classes
24
+ * @DiscriminatorValue("dog")
25
+ * class Dog extends Animal {
26
+ * breed: string;
27
+ * }
28
+ *
29
+ * @DiscriminatorValue("cat")
30
+ * class Cat extends Animal {
31
+ * indoor: boolean;
32
+ * }
33
+ * ```
34
+ *
35
+ * ### OpenAPI Mapping
36
+ *
37
+ * Generates OpenAPI discriminator objects:
38
+ * ```json
39
+ * {
40
+ * "discriminator": {
41
+ * "propertyName": "type",
42
+ * "mapping": {
43
+ * "dog": "#/components/schemas/Dog",
44
+ * "cat": "#/components/schemas/Cat"
45
+ * }
46
+ * }
47
+ * }
48
+ * ```
49
+ *
50
+ * ### Key Features
51
+ *
52
+ * - **Type Mapping**: Maps discriminator values to TypeScript classes
53
+ * - **Bidirectional Lookup**: Find type by value or values by type
54
+ * - **Default Values**: Get the default discriminator value for a type
55
+ * - **Children Discovery**: List all derived types
56
+ *
57
+ * @public
58
+ */
2
59
  export declare class Discriminator {
3
60
  propertyName: string;
4
61
  base: Type<any>;
@@ -8,6 +8,11 @@ import type { JsonSchema } from "./JsonSchema.js";
8
8
  * @ignore
9
9
  */
10
10
  export declare const JsonEntitiesContainer: Map<DecoratorTypes, Type<JsonEntityStore>>;
11
+ /**
12
+ * Configuration options for creating a JsonEntityStore.
13
+ *
14
+ * @public
15
+ */
11
16
  export interface JsonEntityStoreOptions {
12
17
  decoratorType: DecoratorTypes;
13
18
  target: Type<any>;
@@ -21,6 +26,52 @@ export interface JsonEntityStoreOptions {
21
26
  afterMiddlewares?: Function[];
22
27
  [key: string]: any;
23
28
  }
29
+ /**
30
+ * Base class for storing metadata about decorated entities (classes, properties, methods, parameters).
31
+ *
32
+ * JsonEntityStore is the foundation of Ts.ED's metadata system, managing schema information
33
+ * and type metadata for decorated entities. It serves as the parent class for specialized
34
+ * stores (JsonClassStore, JsonPropertyStore, JsonMethodStore, JsonParameterStore).
35
+ *
36
+ * ### Entity Types
37
+ *
38
+ * Different decorator types create different store subclasses:
39
+ * - **Class decorators**: Create JsonClassStore instances
40
+ * - **Property decorators**: Create JsonPropertyStore instances
41
+ * - **Method decorators**: Create JsonMethodStore instances
42
+ * - **Parameter decorators**: Create JsonParameterStore instances
43
+ *
44
+ * ### Key Responsibilities
45
+ *
46
+ * - **Schema Management**: Each store maintains a JsonSchema for the decorated entity
47
+ * - **Type Resolution**: Resolves TypeScript types, including collections and generics
48
+ * - **Metadata Storage**: Stores decorator metadata using Ts.ED's Store system
49
+ * - **Inheritance**: Manages parent-child relationships between entities
50
+ *
51
+ * ### Usage
52
+ *
53
+ * Stores are typically accessed via static `from()` methods:
54
+ *
55
+ * ```typescript
56
+ * // Get store for a class
57
+ * const classStore = JsonEntityStore.from(MyClass);
58
+ *
59
+ * // Get store for a property
60
+ * const propStore = JsonEntityStore.from(MyClass, "propertyName");
61
+ *
62
+ * // Get store for a method parameter
63
+ * const paramStore = JsonEntityStore.from(MyClass, "methodName", 0);
64
+ * ```
65
+ *
66
+ * ### Architecture
67
+ *
68
+ * The store system creates a hierarchical structure:
69
+ * - ClassStore contains PropertyStore and MethodStore children
70
+ * - MethodStore contains ParameterStore children
71
+ * - Each store has an associated JsonSchema
72
+ *
73
+ * @public
74
+ */
24
75
  export declare abstract class JsonEntityStore implements JsonEntityStoreOptions {
25
76
  /**
26
77
  * Original property key decorated by the decorator
@@ -1,3 +1,42 @@
1
+ /**
2
+ * Standard JSON Schema format types for string validation.
3
+ *
4
+ * These format types provide semantic validation for string values beyond basic
5
+ * pattern matching. They are part of the JSON Schema specification and widely
6
+ * supported by validation libraries.
7
+ *
8
+ * ### Date and Time Formats
9
+ * - **DATE_TIME**: RFC 3339 date-time (e.g., "2024-01-15T10:30:00Z")
10
+ * - **DATE**: RFC 3339 full-date (e.g., "2024-01-15")
11
+ * - **TIME**: RFC 3339 full-time (e.g., "10:30:00")
12
+ *
13
+ * ### Network Formats
14
+ * - **EMAIL**: Email address (RFC 5322)
15
+ * - **HOSTNAME**: Internet hostname (RFC 1123)
16
+ * - **IPV4**: IPv4 address
17
+ * - **IPV6**: IPv6 address
18
+ * - **URI**: Uniform Resource Identifier (RFC 3986)
19
+ * - **URL**: URL variant of URI
20
+ * - **URI_REF**: URI reference
21
+ * - **URI_TEMPLATE**: URI template (RFC 6570)
22
+ *
23
+ * ### Other Formats
24
+ * - **JSON_POINTER**: JSON Pointer (RFC 6901)
25
+ * - **RELATIVE_JSON_POINTER**: Relative JSON Pointer
26
+ * - **UUID**: Universally Unique Identifier (RFC 4122)
27
+ * - **REGEX**: Regular expression (ECMA-262)
28
+ *
29
+ * ### Usage
30
+ *
31
+ * ```typescript
32
+ * import {JsonFormatTypes} from "@tsed/schema";
33
+ *
34
+ * schema.format(JsonFormatTypes.EMAIL);
35
+ * schema.format(JsonFormatTypes.DATE_TIME);
36
+ * ```
37
+ *
38
+ * @public
39
+ */
1
40
  export declare enum JsonFormatTypes {
2
41
  DATE_TIME = "date-time",
3
42
  DATE = "date",
@@ -1,4 +1,37 @@
1
1
  import { Type } from "@tsed/core";
2
+ /**
3
+ * Lazy reference to a schema type for handling circular dependencies.
4
+ *
5
+ * JsonLazyRef provides a deferred reference mechanism for types that may not be
6
+ * available at decoration time due to circular dependencies or forward references.
7
+ * The actual type is resolved lazily when needed, avoiding initialization order issues.
8
+ *
9
+ * ### Usage
10
+ *
11
+ * ```typescript
12
+ * class User {
13
+ * @Property()
14
+ * name: string;
15
+ *
16
+ * // Circular reference - user has a manager who is also a user
17
+ * @Property()
18
+ * manager: User; // Internally uses lazy ref
19
+ * }
20
+ * ```
21
+ *
22
+ * ### Use Cases
23
+ *
24
+ * - **Circular Dependencies**: Classes that reference themselves or each other
25
+ * - **Forward References**: References to classes defined later in the file
26
+ * - **Conditional Imports**: Types that may not be available immediately
27
+ *
28
+ * ### How It Works
29
+ *
30
+ * The lazy ref wraps a function that returns the type, delaying type resolution
31
+ * until the schema is actually needed during schema generation.
32
+ *
33
+ * @public
34
+ */
2
35
  export declare class JsonLazyRef {
3
36
  readonly getType: () => Type<any>;
4
37
  readonly isLazyRef = true;
@@ -1,4 +1,36 @@
1
1
  import { JsonSchemaOptions } from "../interfaces/JsonSchemaOptions.js";
2
+ /**
3
+ * Base class for JSON document representations using a Map structure.
4
+ *
5
+ * JsonMap provides a Map-based foundation for storing and manipulating JSON-compatible
6
+ * data structures. It extends the native Map with additional features for assignment,
7
+ * serialization, and mapper integration.
8
+ *
9
+ * This class serves as the base for many Ts.ED schema classes including JsonOperation,
10
+ * JsonParameter, JsonResponse, and JsonRequestBody.
11
+ *
12
+ * ### Usage
13
+ *
14
+ * ```typescript
15
+ * class MyJsonDoc extends JsonMap<{name: string; value: number}> {
16
+ * // Custom methods
17
+ * }
18
+ *
19
+ * const doc = new MyJsonDoc({name: "test", value: 42});
20
+ * const json = doc.toJSON();
21
+ * ```
22
+ *
23
+ * ### Key Features
24
+ *
25
+ * - **Map Interface**: Full Map API support for key-value operations
26
+ * - **Fluent Assignment**: Assign multiple properties via object
27
+ * - **Serialization**: Convert to plain JSON via mapper system
28
+ * - **Type Safety**: Generic type parameter for stored values
29
+ *
30
+ * @typeParam T - The shape of the object this map represents
31
+ *
32
+ * @public
33
+ */
2
34
  export declare class JsonMap<T> extends Map<string, any> {
3
35
  [key: string]: any;
4
36
  $kind: string;
@@ -1,6 +1,34 @@
1
1
  import { OS3MediaType } from "@tsed/openspec";
2
2
  import { JsonMap } from "./JsonMap.js";
3
3
  import { JsonSchema } from "./JsonSchema.js";
4
+ /**
5
+ * Represents a media type definition for HTTP request or response bodies.
6
+ *
7
+ * JsonMedia encapsulates the schema and examples for a specific media type
8
+ * (e.g., "application/json", "application/xml") in OpenAPI specifications.
9
+ * It provides methods to configure the schema and examples for the media type.
10
+ *
11
+ * ### Usage
12
+ *
13
+ * ```typescript
14
+ * const media = new JsonMedia();
15
+ * media.type(User);
16
+ * media.examples({
17
+ * user1: {
18
+ * value: {name: "John", email: "john@example.com"}
19
+ * }
20
+ * });
21
+ * ```
22
+ *
23
+ * ### Key Features
24
+ *
25
+ * - **Schema Definition**: Associated JSON schema for validation
26
+ * - **Examples**: Request/response examples for documentation
27
+ * - **Type Handling**: Automatic schema generation from TypeScript types
28
+ * - **Union Types**: Support for oneOf schemas with multiple types
29
+ *
30
+ * @public
31
+ */
4
32
  export declare class JsonMedia extends JsonMap<any> {
5
33
  $kind: string;
6
34
  constructor(obj?: Partial<OS3MediaType<JsonSchema>>);
@@ -4,14 +4,80 @@ import { JsonEntityStore, JsonEntityStoreOptions } from "./JsonEntityStore.js";
4
4
  import { JsonOperation } from "./JsonOperation.js";
5
5
  import { type JsonParameterStore } from "./JsonParameterStore.js";
6
6
  import { JsonSchema } from "./JsonSchema.js";
7
+ /**
8
+ * Configuration options for view rendering.
9
+ *
10
+ * @public
11
+ */
7
12
  export interface JsonViewOptions {
8
13
  path: string;
9
14
  options: any;
10
15
  }
16
+ /**
17
+ * Configuration options for HTTP redirects.
18
+ *
19
+ * @public
20
+ */
11
21
  export interface JsonRedirectOptions {
12
22
  status: number | undefined;
13
23
  url: string;
14
24
  }
25
+ /**
26
+ * Store for method metadata, operations, and parameter information.
27
+ *
28
+ * JsonMethodStore manages metadata for controller methods decorated with operation
29
+ * decorators like `@Get()`, `@Post()`, `@Returns()`, etc. It maintains the JsonOperation
30
+ * for OpenAPI generation and coordinates method parameters.
31
+ *
32
+ * ### Responsibilities
33
+ *
34
+ * - **Operation Management**: Maintains JsonOperation for OpenAPI spec generation
35
+ * - **Parameter Coordination**: Manages child JsonParameterStore instances
36
+ * - **Middleware Configuration**: Handles before/after/use middleware registration
37
+ * - **Response Configuration**: Manages return types and status codes
38
+ * - **Route Information**: Stores HTTP methods, paths, and route metadata
39
+ *
40
+ * ### Usage
41
+ *
42
+ * ```typescript
43
+ * // Get method store
44
+ * const methodStore = JsonEntityStore.from(MyController, "myMethod");
45
+ *
46
+ * // Access operation for OpenAPI
47
+ * const operation = methodStore.operation;
48
+ *
49
+ * // Get parameters
50
+ * const params = methodStore.parameters;
51
+ *
52
+ * // Check response type
53
+ * const returnType = methodStore.type;
54
+ * ```
55
+ *
56
+ * ### Operation Structure
57
+ *
58
+ * Each method store contains a JsonOperation that includes:
59
+ * - HTTP method and path information
60
+ * - Request parameters (path, query, body, headers)
61
+ * - Response definitions by status code
62
+ * - Security requirements
63
+ * - Tags and metadata
64
+ *
65
+ * ### Parameter Management
66
+ *
67
+ * The store maintains parameter metadata:
68
+ * - Parameters stored in `children` map by index
69
+ * - Accessible via `parameters` or `params` getters
70
+ * - Each parameter has its own JsonParameterStore
71
+ *
72
+ * ### Middleware Integration
73
+ *
74
+ * Supports three middleware phases:
75
+ * - **before**: Execute before the method
76
+ * - **use**: Execute as main middleware
77
+ * - **after**: Execute after the method
78
+ *
79
+ * @public
80
+ */
15
81
  export declare class JsonMethodStore extends JsonEntityStore {
16
82
  readonly parent: JsonClassStore;
17
83
  middlewares: any[];