@@ -79,6 +79,22 @@ def fill_with_random_values(
7979 elif field .examples :
8080 value = random .choice (field .examples )
8181
82+ # RFC7643 §4.1.2 provides the following indications, however
83+ # there is no way to guess the existence of such requirements
84+ # just by looking at the object schema.
85+ # The value SHOULD be specified according to [RFC5321].
86+ elif field_name == "value" and "email" in obj .__class__ .__name__ .lower ():
87+ value = f"{ uuid .uuid4 ()} @{ uuid .uuid4 ()} .com"
88+
89+ # RFC7643 §4.1.2 provides the following indications, however
90+ # there is no way to guess the existence of such requirements
91+ # just by looking at the object schema.
92+ # The value SHOULD be specified
93+ # according to the format defined in [RFC3966], e.g.,
94+ # 'tel:+1-201-555-0123'.
95+ elif field_name == "value" and "phone" in obj .__class__ .__name__ .lower ():
96+ value = "" .join (str (random .choice (range (10 ))) for _ in range (10 ))
97+
8298 elif field_type is int :
8399 value = uuid .uuid4 ().int
84100
@@ -114,7 +130,7 @@ def fill_with_random_values(
114130
115131 else :
116132 # Put emails so this will be accepted by EmailStr too
117- value = f" { uuid . uuid4 () } @ { uuid .uuid4 ()} .com"
133+ value = str ( uuid .uuid4 ())
118134
119135 if is_multiple :
120136 setattr (obj , field_name , [value ])
0 commit comments