|
68 | 68 | Schema(type="null"), |
69 | 69 | TypeConversion(original_type="null", converted_type="Any"), |
70 | 70 | ), |
| 71 | + ( |
| 72 | + Schema(type="string", schema_format="uuid"), |
| 73 | + TypeConversion(original_type="string", converted_type="str"), |
| 74 | + ), |
| 75 | + ( |
| 76 | + Schema(type="string", schema_format="uuid1"), |
| 77 | + TypeConversion(original_type="string", converted_type="str"), |
| 78 | + ), |
| 79 | + ( |
| 80 | + Schema(type="string", schema_format="uuid3"), |
| 81 | + TypeConversion(original_type="string", converted_type="str"), |
| 82 | + ), |
| 83 | + ( |
| 84 | + Schema(type="string", schema_format="uuid4"), |
| 85 | + TypeConversion(original_type="string", converted_type="str"), |
| 86 | + ), |
| 87 | + ( |
| 88 | + Schema(type="string", schema_format="uuid5"), |
| 89 | + TypeConversion(original_type="string", converted_type="str"), |
| 90 | + ), |
71 | 91 | ], |
72 | 92 | ) |
73 | 93 | def test_type_converter_simple(test_openapi_types, expected_python_types): |
@@ -138,6 +158,42 @@ def test_type_converter_simple(test_openapi_types, expected_python_types): |
138 | 158 | Schema(type="null"), |
139 | 159 | TypeConversion(original_type="null", converted_type="Any"), |
140 | 160 | ), |
| 161 | + ( |
| 162 | + Schema(type="string", schema_format="uuid"), |
| 163 | + TypeConversion(original_type="string", converted_type="UUID", import_types=['from uuid import UUID']), |
| 164 | + ), |
| 165 | + ( |
| 166 | + Schema(type="string", schema_format="uuid1"), |
| 167 | + TypeConversion( |
| 168 | + original_type="string", |
| 169 | + converted_type="UUID1", |
| 170 | + import_types=['from pydantic import UUID1'] |
| 171 | + ), |
| 172 | + ), |
| 173 | + ( |
| 174 | + Schema(type="string", schema_format="uuid3"), |
| 175 | + TypeConversion( |
| 176 | + original_type="string", |
| 177 | + converted_type="UUID3", |
| 178 | + import_types=['from pydantic import UUID3'] |
| 179 | + ), |
| 180 | + ), |
| 181 | + ( |
| 182 | + Schema(type="string", schema_format="uuid4"), |
| 183 | + TypeConversion( |
| 184 | + original_type="string", |
| 185 | + converted_type="UUID4", |
| 186 | + import_types=['from pydantic import UUID4'] |
| 187 | + ), |
| 188 | + ), |
| 189 | + ( |
| 190 | + Schema(type="string", schema_format="uuid5"), |
| 191 | + TypeConversion( |
| 192 | + original_type="string", |
| 193 | + converted_type="UUID5", |
| 194 | + import_types=['from pydantic import UUID5'] |
| 195 | + ), |
| 196 | + ) |
141 | 197 | ], |
142 | 198 | ) |
143 | 199 | def test_type_converter_simple_orjson(test_openapi_types, expected_python_types): |
|
0 commit comments