@@ -6,11 +6,11 @@ use smallvec::SmallVec;
6
6
use std:: borrow:: Cow ;
7
7
8
8
use crate :: build_tools:: py_schema_err;
9
- use crate :: common:: discriminator :: Discriminator ;
9
+ use crate :: common:: union :: { Discriminator , SMALL_UNION_THRESHOLD } ;
10
10
use crate :: definitions:: DefinitionsBuilder ;
11
11
use crate :: lookup_key:: LookupKey ;
12
12
use crate :: serializers:: type_serializers:: py_err_se_err;
13
- use crate :: tools:: { SchemaDict , UNION_ERR_SMALLVEC_CAPACITY } ;
13
+ use crate :: tools:: SchemaDict ;
14
14
use crate :: PydanticSerializationUnexpectedValue ;
15
15
16
16
use super :: {
@@ -83,7 +83,7 @@ impl TypeSerializer for UnionSerializer {
83
83
// try the serializers in left to right order with error_on fallback=true
84
84
let mut new_extra = extra. clone ( ) ;
85
85
new_extra. check = SerCheck :: Strict ;
86
- let mut errors: SmallVec < [ PyErr ; UNION_ERR_SMALLVEC_CAPACITY ] > = SmallVec :: new ( ) ;
86
+ let mut errors: SmallVec < [ PyErr ; SMALL_UNION_THRESHOLD ] > = SmallVec :: new ( ) ;
87
87
88
88
for comb_serializer in & self . choices {
89
89
match comb_serializer. to_python ( value, include, exclude, & new_extra) {
@@ -118,7 +118,7 @@ impl TypeSerializer for UnionSerializer {
118
118
fn json_key < ' a > ( & self , key : & ' a Bound < ' _ , PyAny > , extra : & Extra ) -> PyResult < Cow < ' a , str > > {
119
119
let mut new_extra = extra. clone ( ) ;
120
120
new_extra. check = SerCheck :: Strict ;
121
- let mut errors: SmallVec < [ PyErr ; UNION_ERR_SMALLVEC_CAPACITY ] > = SmallVec :: new ( ) ;
121
+ let mut errors: SmallVec < [ PyErr ; SMALL_UNION_THRESHOLD ] > = SmallVec :: new ( ) ;
122
122
123
123
for comb_serializer in & self . choices {
124
124
match comb_serializer. json_key ( key, & new_extra) {
@@ -161,7 +161,7 @@ impl TypeSerializer for UnionSerializer {
161
161
let py = value. py ( ) ;
162
162
let mut new_extra = extra. clone ( ) ;
163
163
new_extra. check = SerCheck :: Strict ;
164
- let mut errors: SmallVec < [ PyErr ; UNION_ERR_SMALLVEC_CAPACITY ] > = SmallVec :: new ( ) ;
164
+ let mut errors: SmallVec < [ PyErr ; SMALL_UNION_THRESHOLD ] > = SmallVec :: new ( ) ;
165
165
166
166
for comb_serializer in & self . choices {
167
167
match comb_serializer. to_python ( value, include, exclude, & new_extra) {
0 commit comments