0
# Schema Building
1
2
Comprehensive set of functions for building validation schemas for all Python data types. These functions create schema objects that define validation rules, constraints, and transformations for data validation.
3
4
## Capabilities
5
6
### Basic Type Schemas
7
8
Core validation schemas for fundamental Python data types.
9
10
```python { .api }
11
def any_schema(*, serialization=None, ref=None) -> AnySchema:
12
"""
13
Schema that accepts any value without validation.
14
15
Args:
16
serialization: Custom serialization schema
17
ref: Reference name for schema reuse
18
"""
19
20
def none_schema(*, serialization=None, ref=None) -> NoneSchema:
21
"""
22
Schema that only accepts None values.
23
24
Args:
25
serialization: Custom serialization schema
26
ref: Reference name for schema reuse
27
"""
28
29
def bool_schema(*, strict=None, serialization=None, ref=None) -> BoolSchema:
30
"""
31
Boolean validation schema.
32
33
Args:
34
strict: Whether to use strict validation (rejects string 'true'/'false')
35
serialization: Custom serialization schema
36
ref: Reference name for schema reuse
37
"""
38
39
def int_schema(*, strict=None, gt=None, ge=None, lt=None, le=None, multiple_of=None, serialization=None, ref=None) -> IntSchema:
40
"""
41
Integer validation schema with optional constraints.
42
43
Args:
44
strict: Whether to reject non-integer types
45
gt: Value must be greater than this
46
ge: Value must be greater than or equal to this
47
lt: Value must be less than this
48
le: Value must be less than or equal to this
49
multiple_of: Value must be a multiple of this
50
serialization: Custom serialization schema
51
ref: Reference name for schema reuse
52
"""
53
54
def float_schema(*, strict=None, gt=None, ge=None, lt=None, le=None, multiple_of=None, allow_inf_nan=None, serialization=None, ref=None) -> FloatSchema:
55
"""
56
Float validation schema with optional constraints.
57
58
Args:
59
strict: Whether to reject non-float types
60
gt: Value must be greater than this
61
ge: Value must be greater than or equal to this
62
lt: Value must be less than this
63
le: Value must be less than or equal to this
64
multiple_of: Value must be a multiple of this
65
allow_inf_nan: Whether to allow infinity and NaN values
66
serialization: Custom serialization schema
67
ref: Reference name for schema reuse
68
"""
69
70
def str_schema(*, min_length=None, max_length=None, pattern=None, strict=None, strip_whitespace=None, to_lower=None, to_upper=None, regex_engine=None, coerce_numbers_to_str=None, metadata=None, serialization=None, ref=None) -> StrSchema:
71
"""
72
String validation schema with length and format constraints.
73
74
Args:
75
min_length: Minimum string length
76
max_length: Maximum string length
77
pattern: Regular expression pattern to match (str or Pattern)
78
strict: Whether to reject non-string types
79
strip_whitespace: Whether to strip leading/trailing whitespace
80
to_lower: Whether to convert to lowercase
81
to_upper: Whether to convert to uppercase
82
regex_engine: Regex engine to use ('rust-regex' or 'python-re')
83
coerce_numbers_to_str: Whether to coerce numbers to strings
84
metadata: Additional metadata for the schema
85
serialization: Custom serialization schema
86
ref: Reference name for schema reuse
87
"""
88
89
def complex_schema(*, strict=None, metadata=None, serialization=None, ref=None) -> ComplexSchema:
90
"""
91
Complex number validation schema.
92
93
Args:
94
strict: Whether to reject non-complex types
95
metadata: Additional metadata for the schema
96
serialization: Custom serialization schema
97
ref: Reference name for schema reuse
98
"""
99
100
def decimal_schema(*, allow_inf_nan=None, multiple_of=None, le=None, ge=None, lt=None, gt=None, max_digits=None, decimal_places=None, strict=None, metadata=None, serialization=None, ref=None) -> DecimalSchema:
101
"""
102
Decimal validation schema with precision control.
103
104
Args:
105
allow_inf_nan: Whether to allow infinity and NaN values
106
multiple_of: Value must be a multiple of this decimal
107
le: Value must be less than or equal to this
108
ge: Value must be greater than or equal to this
109
lt: Value must be less than this
110
gt: Value must be greater than this
111
max_digits: Maximum number of digits
112
decimal_places: Maximum number of decimal places
113
strict: Whether to reject non-decimal types
114
metadata: Additional metadata for the schema
115
serialization: Custom serialization schema
116
ref: Reference name for schema reuse
117
"""
118
119
def bytes_schema(*, min_length=None, max_length=None, strict=None, metadata=None, serialization=None, ref=None) -> BytesSchema:
120
"""
121
Bytes validation schema with length constraints.
122
123
Args:
124
min_length: Minimum bytes length
125
max_length: Maximum bytes length
126
strict: Whether to reject non-bytes types
127
metadata: Additional metadata for the schema
128
serialization: Custom serialization schema
129
ref: Reference name for schema reuse
130
"""
131
```
132
133
### Date and Time Schemas
134
135
Validation schemas for date, time, and datetime objects.
136
137
```python { .api }
138
def date_schema(*, strict=None, gt=None, ge=None, lt=None, le=None, serialization=None, ref=None) -> DateSchema:
139
"""
140
Date validation schema.
141
142
Args:
143
strict: Whether to reject non-date types
144
gt: Date must be greater than this
145
ge: Date must be greater than or equal to this
146
lt: Date must be less than this
147
le: Date must be less than or equal to this
148
serialization: Custom serialization schema
149
ref: Reference name for schema reuse
150
"""
151
152
def time_schema(*, strict=None, gt=None, ge=None, lt=None, le=None, serialization=None, ref=None) -> TimeSchema:
153
"""
154
Time validation schema.
155
156
Args:
157
strict: Whether to reject non-time types
158
gt: Time must be greater than this
159
ge: Time must be greater than or equal to this
160
lt: Time must be less than this
161
le: Time must be less than or equal to this
162
serialization: Custom serialization schema
163
ref: Reference name for schema reuse
164
"""
165
166
def datetime_schema(*, strict=None, gt=None, ge=None, lt=None, le=None, tz_constraint=None, serialization=None, ref=None) -> DatetimeSchema:
167
"""
168
Datetime validation schema.
169
170
Args:
171
strict: Whether to reject non-datetime types
172
gt: Datetime must be greater than this
173
ge: Datetime must be greater than or equal to this
174
lt: Datetime must be less than this
175
le: Datetime must be less than or equal to this
176
tz_constraint: Timezone constraint ('aware', 'naive', or None)
177
serialization: Custom serialization schema
178
ref: Reference name for schema reuse
179
"""
180
181
def timedelta_schema(*, strict=None, gt=None, ge=None, lt=None, le=None, serialization=None, ref=None) -> TimedeltaSchema:
182
"""
183
Timedelta validation schema.
184
185
Args:
186
strict: Whether to reject non-timedelta types
187
gt: Timedelta must be greater than this
188
ge: Timedelta must be greater than or equal to this
189
lt: Timedelta must be less than this
190
le: Timedelta must be less than or equal to this
191
serialization: Custom serialization schema
192
ref: Reference name for schema reuse
193
"""
194
```
195
196
### Collection Schemas
197
198
Validation schemas for lists, sets, tuples, and dictionaries.
199
200
```python { .api }
201
def list_schema(items_schema, *, min_length=None, max_length=None, strict=None, serialization=None, ref=None) -> ListSchema:
202
"""
203
List validation schema with item validation.
204
205
Args:
206
items_schema: Schema for validating each list item
207
min_length: Minimum list length
208
max_length: Maximum list length
209
strict: Whether to reject non-list types
210
serialization: Custom serialization schema
211
ref: Reference name for schema reuse
212
"""
213
214
def set_schema(items_schema=None, *, min_length=None, max_length=None, strict=None, serialization=None, ref=None) -> SetSchema:
215
"""
216
Set validation schema with item validation.
217
218
Args:
219
items_schema: Schema for validating each set item
220
min_length: Minimum set size
221
max_length: Maximum set size
222
strict: Whether to reject non-set types
223
serialization: Custom serialization schema
224
ref: Reference name for schema reuse
225
"""
226
227
def frozenset_schema(items_schema=None, *, min_length=None, max_length=None, strict=None, serialization=None, ref=None) -> FrozensetSchema:
228
"""
229
Frozenset validation schema with item validation.
230
231
Args:
232
items_schema: Schema for validating each frozenset item
233
min_length: Minimum frozenset size
234
max_length: Maximum frozenset size
235
strict: Whether to reject non-frozenset types
236
serialization: Custom serialization schema
237
ref: Reference name for schema reuse
238
"""
239
240
def tuple_schema(*items_schemas, extra_schema=None, min_length=None, max_length=None, strict=None, serialization=None, ref=None) -> TupleSchema:
241
"""
242
Tuple validation schema with per-position or variable item validation.
243
244
Args:
245
items_schemas: Schemas for each tuple position (fixed-length tuples)
246
extra_schema: Schema for extra items in variable-length tuples
247
min_length: Minimum tuple length
248
max_length: Maximum tuple length
249
strict: Whether to reject non-tuple types
250
serialization: Custom serialization schema
251
ref: Reference name for schema reuse
252
"""
253
254
def dict_schema(keys_schema=None, values_schema=None, *, min_length=None, max_length=None, strict=None, serialization=None, ref=None) -> DictSchema:
255
"""
256
Dictionary validation schema with key and value validation.
257
258
Args:
259
keys_schema: Schema for validating dictionary keys
260
values_schema: Schema for validating dictionary values
261
min_length: Minimum dictionary size
262
max_length: Maximum dictionary size
263
strict: Whether to reject non-dict types
264
serialization: Custom serialization schema
265
ref: Reference name for schema reuse
266
"""
267
```
268
269
### Specialized Type Schemas
270
271
Schemas for more complex or specialized data types.
272
273
```python { .api }
274
def literal_schema(*expected, serialization=None, ref=None) -> LiteralSchema:
275
"""
276
Schema that only accepts specific literal values.
277
278
Args:
279
expected: The exact values that are acceptable
280
serialization: Custom serialization schema
281
ref: Reference name for schema reuse
282
"""
283
284
def enum_schema(members, *, strict=None, serialization=None, ref=None) -> EnumSchema:
285
"""
286
Enum validation schema.
287
288
Args:
289
members: Enum class or list of enum members
290
strict: Whether to reject non-enum types
291
serialization: Custom serialization schema
292
ref: Reference name for schema reuse
293
"""
294
295
def union_schema(*choices, strict=None, custom_error_type=None, custom_error_message=None, custom_error_context=None, serialization=None, ref=None) -> UnionSchema:
296
"""
297
Union validation schema that tries multiple schemas.
298
299
Args:
300
choices: Schema choices to try in order
301
strict: Whether to use strict validation
302
custom_error_type: Custom error type for union failures
303
custom_error_message: Custom error message template
304
custom_error_context: Custom error context
305
serialization: Custom serialization schema
306
ref: Reference name for schema reuse
307
"""
308
309
def tagged_union_schema(choices, discriminator, *, custom_error_type=None, custom_error_message=None, custom_error_context=None, strict=None, from_attributes=None, serialization=None, ref=None) -> TaggedUnionSchema:
310
"""
311
Tagged union schema with discriminator field.
312
313
Args:
314
choices: Mapping of discriminator values to schemas
315
discriminator: Field name or function to extract discriminator
316
custom_error_type: Custom error type for failures
317
custom_error_message: Custom error message template
318
custom_error_context: Custom error context
319
strict: Whether to use strict validation
320
from_attributes: Whether to extract from attributes
321
serialization: Custom serialization schema
322
ref: Reference name for schema reuse
323
"""
324
325
def url_schema(*, max_length=None, allowed_schemes=None, host_required=None, default_host=None, default_port=None, default_path=None, strict=None, serialization=None, ref=None) -> UrlSchema:
326
"""
327
URL validation schema.
328
329
Args:
330
max_length: Maximum URL length
331
allowed_schemes: List of allowed URL schemes
332
host_required: Whether host is required
333
default_host: Default host if not provided
334
default_port: Default port if not provided
335
default_path: Default path if not provided
336
strict: Whether to use strict validation
337
serialization: Custom serialization schema
338
ref: Reference name for schema reuse
339
"""
340
341
def uuid_schema(*, version=None, strict=None, serialization=None, ref=None) -> UuidSchema:
342
"""
343
UUID validation schema.
344
345
Args:
346
version: Required UUID version (1, 3, 4, or 5)
347
strict: Whether to reject non-UUID types
348
serialization: Custom serialization schema
349
ref: Reference name for schema reuse
350
"""
351
352
def decimal_schema(*, max_digits=None, decimal_places=None, multiple_of=None, gt=None, ge=None, lt=None, le=None, strict=None, allow_inf_nan=None, serialization=None, ref=None) -> DecimalSchema:
353
"""
354
Decimal validation schema.
355
356
Args:
357
max_digits: Maximum number of digits
358
decimal_places: Maximum decimal places
359
multiple_of: Value must be multiple of this
360
gt: Value must be greater than this
361
ge: Value must be greater than or equal to this
362
lt: Value must be less than this
363
le: Value must be less than or equal to this
364
strict: Whether to reject non-decimal types
365
allow_inf_nan: Whether to allow infinity and NaN
366
serialization: Custom serialization schema
367
ref: Reference name for schema reuse
368
"""
369
```
370
371
### Model and Structured Data Schemas
372
373
Schemas for complex structured data like models, dataclasses, and typed dictionaries.
374
375
```python { .api }
376
def model_schema(cls_name: str, schema: dict, *, model_name=None, config=None, custom_init=None, root_model=False, post_init=None, serialization=None, extra_validator=None, ref=None) -> ModelSchema:
377
"""
378
Schema for Pydantic models.
379
380
Args:
381
cls_name: Name of the model class
382
schema: Dictionary defining model fields
383
model_name: Display name for the model
384
config: Model configuration
385
custom_init: Custom initialization function
386
root_model: Whether this is a root model
387
post_init: Post-initialization function
388
serialization: Custom serialization schema
389
extra_validator: Additional validation function
390
ref: Reference name for schema reuse
391
"""
392
393
def model_fields_schema(fields, *, model_name=None, extra_validator=None, serialization=None, ref=None) -> ModelFieldsSchema:
394
"""
395
Schema for model fields without a specific model class.
396
397
Args:
398
fields: Dictionary of field names to field schemas
399
model_name: Display name for the model
400
extra_validator: Additional validation function
401
serialization: Custom serialization schema
402
ref: Reference name for schema reuse
403
"""
404
405
def dataclass_schema(cls_name: str, schema: dict, *, config=None, serialization=None, ref=None) -> DataclassSchema:
406
"""
407
Schema for dataclass validation.
408
409
Args:
410
cls_name: Name of the dataclass
411
schema: Dictionary defining dataclass fields
412
config: Validation configuration
413
serialization: Custom serialization schema
414
ref: Reference name for schema reuse
415
"""
416
417
def typed_dict_schema(fields, *, strict=None, extra_behavior=None, total=None, serialization=None, ref=None) -> TypedDictSchema:
418
"""
419
Schema for TypedDict validation.
420
421
Args:
422
fields: Dictionary of field names to field schemas
423
strict: Whether to use strict validation
424
extra_behavior: How to handle extra fields ('allow', 'forbid', 'ignore')
425
total: Whether all fields are required by default
426
serialization: Custom serialization schema
427
ref: Reference name for schema reuse
428
"""
429
```
430
431
### Advanced Schema Functions
432
433
Additional schema functions for complex validation scenarios.
434
435
```python { .api }
436
def literal_schema(expected, *, metadata=None, serialization=None, ref=None) -> LiteralSchema:
437
"""
438
Schema for literal value validation.
439
440
Args:
441
expected: List of expected literal values
442
metadata: Additional metadata for the schema
443
serialization: Custom serialization schema
444
ref: Reference name for schema reuse
445
"""
446
447
def enum_schema(cls, members, *, sub_type=None, missing=None, strict=None, metadata=None, serialization=None, ref=None) -> EnumSchema:
448
"""
449
Schema for enum validation.
450
451
Args:
452
cls: The enum class
453
members: List of enum members
454
sub_type: Underlying type ('str', 'int', 'float')
455
missing: Function to handle missing values
456
strict: Whether to use strict validation
457
metadata: Additional metadata for the schema
458
serialization: Custom serialization schema
459
ref: Reference name for schema reuse
460
"""
461
462
def union_schema(choices, *, auto_collapse=None, custom_error_type=None, custom_error_message=None, custom_error_context=None, mode=None, metadata=None, serialization=None, ref=None) -> UnionSchema:
463
"""
464
Schema for union (multiple choice) validation.
465
466
Args:
467
choices: List of schema choices or tuples of (schema, label)
468
auto_collapse: Whether to automatically collapse single-choice unions
469
custom_error_type: Custom error type for validation failures
470
custom_error_message: Custom error message template
471
custom_error_context: Custom error context
472
mode: Union mode ('smart' or 'left_to_right')
473
metadata: Additional metadata for the schema
474
serialization: Custom serialization schema
475
ref: Reference name for schema reuse
476
"""
477
478
def chain_schema(steps, *, metadata=None, serialization=None, ref=None) -> ChainSchema:
479
"""
480
Schema for chaining multiple validation steps.
481
482
Args:
483
steps: List of schemas to apply in sequence
484
metadata: Additional metadata for the schema
485
serialization: Custom serialization schema
486
ref: Reference name for schema reuse
487
"""
488
489
def lax_or_strict_schema(lax_schema, strict_schema, *, strict=None, metadata=None, serialization=None, ref=None) -> LaxOrStrictSchema:
490
"""
491
Schema that chooses between lax and strict validation.
492
493
Args:
494
lax_schema: Schema to use in lax mode
495
strict_schema: Schema to use in strict mode
496
strict: Whether to use strict mode by default
497
metadata: Additional metadata for the schema
498
serialization: Custom serialization schema
499
ref: Reference name for schema reuse
500
"""
501
502
def json_or_python_schema(json_schema, python_schema, *, metadata=None, serialization=None, ref=None) -> JsonOrPythonSchema:
503
"""
504
Schema that chooses based on input type (JSON vs Python).
505
506
Args:
507
json_schema: Schema to use for JSON input
508
python_schema: Schema to use for Python input
509
metadata: Additional metadata for the schema
510
serialization: Custom serialization schema
511
ref: Reference name for schema reuse
512
"""
513
514
def with_default_schema(schema, *, default=None, default_factory=None, validate_default=None, metadata=None, serialization=None, ref=None) -> WithDefaultSchema:
515
"""
516
Schema that provides default values.
517
518
Args:
519
schema: Base schema to apply after setting defaults
520
default: Default value to use
521
default_factory: Function to generate default values
522
validate_default: Whether to validate the default value
523
metadata: Additional metadata for the schema
524
serialization: Custom serialization schema
525
ref: Reference name for schema reuse
526
"""
527
528
def nullable_schema(schema, *, strict=None, metadata=None, serialization=None, ref=None) -> NullableSchema:
529
"""
530
Schema that allows None values in addition to the base schema.
531
532
Args:
533
schema: Base schema to apply for non-None values
534
strict: Whether to use strict validation
535
metadata: Additional metadata for the schema
536
serialization: Custom serialization schema
537
ref: Reference name for schema reuse
538
"""
539
540
def uuid_schema(*, version=None, strict=None, metadata=None, serialization=None, ref=None) -> UuidSchema:
541
"""
542
UUID validation schema.
543
544
Args:
545
version: UUID version to validate (1, 3, 4, 5, 6, 7, 8)
546
strict: Whether to reject non-UUID types
547
metadata: Additional metadata for the schema
548
serialization: Custom serialization schema
549
ref: Reference name for schema reuse
550
"""
551
552
def is_instance_schema(cls, *, cls_repr=None, metadata=None, serialization=None, ref=None) -> IsInstanceSchema:
553
"""
554
Schema for isinstance validation.
555
556
Args:
557
cls: Class or classes to check against
558
cls_repr: String representation of the class
559
metadata: Additional metadata for the schema
560
serialization: Custom serialization schema
561
ref: Reference name for schema reuse
562
"""
563
564
def callable_schema(*, metadata=None, serialization=None, ref=None) -> CallableSchema:
565
"""
566
Schema for callable validation.
567
568
Args:
569
metadata: Additional metadata for the schema
570
serialization: Custom serialization schema
571
ref: Reference name for schema reuse
572
"""
573
```
574
575
## Usage Examples
576
577
### Basic Type Validation
578
579
```python
580
from pydantic_core import SchemaValidator
581
from pydantic_core.core_schema import str_schema, int_schema, bool_schema
582
583
# String with constraints
584
name_schema = str_schema(min_length=1, max_length=50, strip_whitespace=True)
585
validator = SchemaValidator(name_schema)
586
result = validator.validate_python(" Alice ") # "Alice"
587
588
# Integer with range
589
age_schema = int_schema(ge=0, le=120)
590
validator = SchemaValidator(age_schema)
591
result = validator.validate_python(25) # 25
592
593
# Boolean validation
594
active_schema = bool_schema(strict=True)
595
validator = SchemaValidator(active_schema)
596
result = validator.validate_python(True) # True
597
```
598
599
### Collection Validation
600
601
```python
602
from pydantic_core import SchemaValidator
603
from pydantic_core.core_schema import list_schema, dict_schema, str_schema, int_schema
604
605
# List of strings
606
names_schema = list_schema(str_schema(min_length=1), min_length=1)
607
validator = SchemaValidator(names_schema)
608
result = validator.validate_python(["Alice", "Bob", "Charlie"])
609
610
# Dictionary with typed keys and values
611
scores_schema = dict_schema(
612
keys_schema=str_schema(min_length=1),
613
values_schema=int_schema(ge=0, le=100),
614
min_length=1
615
)
616
validator = SchemaValidator(scores_schema)
617
result = validator.validate_python({"Alice": 95, "Bob": 87, "Charlie": 92})
618
```
619
620
### Complex Schema Composition
621
622
```python
623
from pydantic_core import SchemaValidator
624
from pydantic_core.core_schema import (
625
dict_schema, str_schema, int_schema, list_schema,
626
union_schema, literal_schema, optional_schema
627
)
628
629
# User profile schema
630
user_schema = dict_schema({
631
'id': int_schema(gt=0),
632
'name': str_schema(min_length=1, max_length=100),
633
'email': str_schema(pattern=r'^[^@]+@[^@]+\.[^@]+$'),
634
'age': union_schema(int_schema(ge=0, le=120), none_schema()),
635
'status': literal_schema('active', 'inactive', 'pending'),
636
'tags': list_schema(str_schema(min_length=1))
637
})
638
639
validator = SchemaValidator(user_schema)
640
641
# Valid user data
642
user_data = {
643
'id': 123,
644
'name': 'Alice Johnson',
645
'email': 'alice@example.com',
646
'age': 30,
647
'status': 'active',
648
'tags': ['developer', 'python', 'ai']
649
}
650
651
result = validator.validate_python(user_data)
652
print(result)
653
```
654
655
### Model Schema Example
656
657
```python
658
from pydantic_core import SchemaValidator
659
from pydantic_core.core_schema import model_schema, str_schema, int_schema
660
661
# Define a model schema
662
person_model = model_schema(
663
cls_name='Person',
664
schema={
665
'name': str_schema(min_length=1),
666
'age': int_schema(ge=0),
667
'email': str_schema()
668
}
669
)
670
671
validator = SchemaValidator(person_model)
672
673
# Validate model data
674
person_data = {'name': 'John', 'age': 25, 'email': 'john@example.com'}
675
result = validator.validate_python(person_data)
676
print(result) # Validated person data
677
```
678
679
### Additional Schema Functions
680
681
Additional schema functions for advanced validation scenarios.
682
683
```python { .api }
684
def chain_schema(*steps, serialization=None, ref=None) -> ChainSchema:
685
"""
686
Chain multiple validation steps together.
687
688
Args:
689
steps: Sequence of validation schemas to apply in order
690
serialization: Custom serialization schema
691
ref: Reference name for schema reuse
692
"""
693
694
def lax_or_strict_schema(lax_schema, strict_schema, *, serialization=None, ref=None) -> LaxOrStrictSchema:
695
"""
696
Schema that uses different validation based on strict/lax mode.
697
698
Args:
699
lax_schema: Schema to use in lax mode
700
strict_schema: Schema to use in strict mode
701
serialization: Custom serialization schema
702
ref: Reference name for schema reuse
703
"""
704
705
def json_or_python_schema(json_schema, python_schema, *, serialization=None, ref=None) -> JsonOrPythonSchema:
706
"""
707
Schema that uses different validation for JSON vs Python input.
708
709
Args:
710
json_schema: Schema for JSON input
711
python_schema: Schema for Python object input
712
serialization: Custom serialization schema
713
ref: Reference name for schema reuse
714
"""
715
716
def definitions_schema(schema, definitions, *, serialization=None, ref=None) -> DefinitionsSchema:
717
"""
718
Schema with reusable definitions.
719
720
Args:
721
schema: Main validation schema
722
definitions: Dictionary of reusable schema definitions
723
serialization: Custom serialization schema
724
ref: Reference name for schema reuse
725
"""
726
727
def definition_reference_schema(schema_ref, *, serialization=None, ref=None) -> DefinitionReferenceSchema:
728
"""
729
Reference to a schema definition.
730
731
Args:
732
schema_ref: Reference name of the schema definition
733
serialization: Custom serialization schema
734
ref: Reference name for schema reuse
735
"""
736
```