@@ -6,11 +6,11 @@ use smallvec::SmallVec;
66use std:: borrow:: Cow ;
77
88use crate :: build_tools:: py_schema_err;
9- use crate :: common:: discriminator :: Discriminator ;
9+ use crate :: common:: union :: { Discriminator , SMALL_UNION_THRESHOLD } ;
1010use crate :: definitions:: DefinitionsBuilder ;
1111use crate :: lookup_key:: LookupKey ;
1212use crate :: serializers:: type_serializers:: py_err_se_err;
13- use crate :: tools:: { SchemaDict , UNION_ERR_SMALLVEC_CAPACITY } ;
13+ use crate :: tools:: SchemaDict ;
1414use crate :: PydanticSerializationUnexpectedValue ;
1515
1616use super :: {
@@ -83,7 +83,7 @@ impl TypeSerializer for UnionSerializer {
8383 // try the serializers in left to right order with error_on fallback=true
8484 let mut new_extra = extra. clone ( ) ;
8585 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 ( ) ;
8787
8888 for comb_serializer in & self . choices {
8989 match comb_serializer. to_python ( value, include, exclude, & new_extra) {
@@ -118,7 +118,7 @@ impl TypeSerializer for UnionSerializer {
118118 fn json_key < ' a > ( & self , key : & ' a Bound < ' _ , PyAny > , extra : & Extra ) -> PyResult < Cow < ' a , str > > {
119119 let mut new_extra = extra. clone ( ) ;
120120 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 ( ) ;
122122
123123 for comb_serializer in & self . choices {
124124 match comb_serializer. json_key ( key, & new_extra) {
@@ -161,7 +161,7 @@ impl TypeSerializer for UnionSerializer {
161161 let py = value. py ( ) ;
162162 let mut new_extra = extra. clone ( ) ;
163163 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 ( ) ;
165165
166166 for comb_serializer in & self . choices {
167167 match comb_serializer. to_python ( value, include, exclude, & new_extra) {
0 commit comments