Coverage for tests/test_pydantic_v1_v2_multifile/test_multifile.py: 100%
60 statements
« prev ^ index » next coverage.py v7.6.1, created at 2025-12-04 08:29 +0000
« prev ^ index » next coverage.py v7.6.1, created at 2025-12-04 08:29 +0000
1import sys 1abcdefg
3from tests.utils import pydantic_snapshot, skip_module_if_py_gte_314 1abcdefg
5if sys.version_info >= (3, 14): 1abcdefg
6 skip_module_if_py_gte_314() 1g
8from fastapi.testclient import TestClient 1abcdef
9from inline_snapshot import snapshot 1abcdef
11from .main import app 1abcdef
13client = TestClient(app) 1abcdef
16def test_v1_to_v2_item(): 1abcdef
17 response = client.post( 1hijklm
18 "/v1-to-v2/item",
19 json={"title": "Test", "size": 10, "sub": {"name": "SubTest"}},
20 )
21 assert response.status_code == 200 1hijklm
22 assert response.json() == { 1hijklm
23 "new_title": "Test",
24 "new_size": 10,
25 "new_description": None,
26 "new_sub": {"new_sub_name": "SubTest"},
27 "new_multi": [],
28 }
31def test_v2_to_v1_item(): 1abcdef
32 response = client.post( 1nopqrs
33 "/v2-to-v1/item",
34 json={
35 "new_title": "NewTest",
36 "new_size": 20,
37 "new_sub": {"new_sub_name": "NewSubTest"},
38 },
39 )
40 assert response.status_code == 200 1nopqrs
41 assert response.json() == { 1nopqrs
42 "title": "NewTest",
43 "size": 20,
44 "description": None,
45 "sub": {"name": "NewSubTest"},
46 "multi": [],
47 }
50def test_v1_to_v2_item_to_list(): 1abcdef
51 response = client.post( 1tuvwxy
52 "/v1-to-v2/item-to-list",
53 json={"title": "ListTest", "size": 30, "sub": {"name": "SubListTest"}},
54 )
55 assert response.status_code == 200 1tuvwxy
56 assert response.json() == [ 1tuvwxy
57 {
58 "new_title": "ListTest",
59 "new_size": 30,
60 "new_description": None,
61 "new_sub": {"new_sub_name": "SubListTest"},
62 "new_multi": [],
63 },
64 {
65 "new_title": "ListTest",
66 "new_size": 30,
67 "new_description": None,
68 "new_sub": {"new_sub_name": "SubListTest"},
69 "new_multi": [],
70 },
71 ]
74def test_v1_to_v2_list_to_list(): 1abcdef
75 response = client.post( 1zABCDE
76 "/v1-to-v2/list-to-list",
77 json=[
78 {"title": "Item1", "size": 40, "sub": {"name": "Sub1"}},
79 {"title": "Item2", "size": 50, "sub": {"name": "Sub2"}},
80 ],
81 )
82 assert response.status_code == 200 1zABCDE
83 assert response.json() == [ 1zABCDE
84 {
85 "new_title": "Item1",
86 "new_size": 40,
87 "new_description": None,
88 "new_sub": {"new_sub_name": "Sub1"},
89 "new_multi": [],
90 },
91 {
92 "new_title": "Item2",
93 "new_size": 50,
94 "new_description": None,
95 "new_sub": {"new_sub_name": "Sub2"},
96 "new_multi": [],
97 },
98 ]
101def test_v1_to_v2_list_to_item(): 1abcdef
102 response = client.post( 1FGHIJK
103 "/v1-to-v2/list-to-item",
104 json=[
105 {"title": "FirstItem", "size": 60, "sub": {"name": "FirstSub"}},
106 {"title": "SecondItem", "size": 70, "sub": {"name": "SecondSub"}},
107 ],
108 )
109 assert response.status_code == 200 1FGHIJK
110 assert response.json() == { 1FGHIJK
111 "new_title": "FirstItem",
112 "new_size": 60,
113 "new_description": None,
114 "new_sub": {"new_sub_name": "FirstSub"},
115 "new_multi": [],
116 }
119def test_v2_to_v1_item_to_list(): 1abcdef
120 response = client.post( 1LMNOPQ
121 "/v2-to-v1/item-to-list",
122 json={
123 "new_title": "ListNew",
124 "new_size": 80,
125 "new_sub": {"new_sub_name": "SubListNew"},
126 },
127 )
128 assert response.status_code == 200 1LMNOPQ
129 assert response.json() == [ 1LMNOPQ
130 {
131 "title": "ListNew",
132 "size": 80,
133 "description": None,
134 "sub": {"name": "SubListNew"},
135 "multi": [],
136 },
137 {
138 "title": "ListNew",
139 "size": 80,
140 "description": None,
141 "sub": {"name": "SubListNew"},
142 "multi": [],
143 },
144 ]
147def test_v2_to_v1_list_to_list(): 1abcdef
148 response = client.post( 1RSTUVW
149 "/v2-to-v1/list-to-list",
150 json=[
151 {
152 "new_title": "New1",
153 "new_size": 90,
154 "new_sub": {"new_sub_name": "NewSub1"},
155 },
156 {
157 "new_title": "New2",
158 "new_size": 100,
159 "new_sub": {"new_sub_name": "NewSub2"},
160 },
161 ],
162 )
163 assert response.status_code == 200 1RSTUVW
164 assert response.json() == [ 1RSTUVW
165 {
166 "title": "New1",
167 "size": 90,
168 "description": None,
169 "sub": {"name": "NewSub1"},
170 "multi": [],
171 },
172 {
173 "title": "New2",
174 "size": 100,
175 "description": None,
176 "sub": {"name": "NewSub2"},
177 "multi": [],
178 },
179 ]
182def test_v2_to_v1_list_to_item(): 1abcdef
183 response = client.post( 1XYZ012
184 "/v2-to-v1/list-to-item",
185 json=[
186 {
187 "new_title": "FirstNew",
188 "new_size": 110,
189 "new_sub": {"new_sub_name": "FirstNewSub"},
190 },
191 {
192 "new_title": "SecondNew",
193 "new_size": 120,
194 "new_sub": {"new_sub_name": "SecondNewSub"},
195 },
196 ],
197 )
198 assert response.status_code == 200 1XYZ012
199 assert response.json() == { 1XYZ012
200 "title": "FirstNew",
201 "size": 110,
202 "description": None,
203 "sub": {"name": "FirstNewSub"},
204 "multi": [],
205 }
208def test_v1_to_v2_list_to_item_empty(): 1abcdef
209 response = client.post("/v1-to-v2/list-to-item", json=[]) 1345678
210 assert response.status_code == 200 1345678
211 assert response.json() == { 1345678
212 "new_title": "",
213 "new_size": 0,
214 "new_description": None,
215 "new_sub": {"new_sub_name": ""},
216 "new_multi": [],
217 }
220def test_v2_to_v1_list_to_item_empty(): 1abcdef
221 response = client.post("/v2-to-v1/list-to-item", json=[]) 19!#$%'
222 assert response.status_code == 200 19!#$%'
223 assert response.json() == { 19!#$%'
224 "title": "",
225 "size": 0,
226 "description": None,
227 "sub": {"name": ""},
228 "multi": [],
229 }
232def test_v2_same_name_to_v1(): 1abcdef
233 response = client.post( 1()*+,-
234 "/v2-to-v1/same-name",
235 json={
236 "item1": {
237 "new_title": "Title1",
238 "new_size": 100,
239 "new_description": "Description1",
240 "new_sub": {"new_sub_name": "Sub1"},
241 "new_multi": [{"new_sub_name": "Multi1"}],
242 },
243 "item2": {
244 "dup_title": "Title2",
245 "dup_size": 200,
246 "dup_description": "Description2",
247 "dup_sub": {"dup_sub_name": "Sub2"},
248 "dup_multi": [
249 {"dup_sub_name": "Multi2a"},
250 {"dup_sub_name": "Multi2b"},
251 ],
252 },
253 },
254 )
255 assert response.status_code == 200 1()*+,-
256 assert response.json() == { 1()*+,-
257 "title": "Title1",
258 "size": 200,
259 "description": "Description1",
260 "sub": {"name": "Sub1"},
261 "multi": [{"name": "Multi2a"}, {"name": "Multi2b"}],
262 }
265def test_v2_items_in_list_to_v1_item_in_list(): 1abcdef
266 response = client.post( 1./:;=?
267 "/v2-to-v1/list-of-items-to-list-of-items",
268 json={
269 "data1": [{"name2": "Item1"}, {"name2": "Item2"}],
270 "data2": [{"dup_name2": "Item3"}, {"dup_name2": "Item4"}],
271 },
272 )
273 assert response.status_code == 200, response.text 1./:;=?
274 assert response.json() == [ 1./:;=?
275 {"name1": "Item1"},
276 {"name1": "Item3"},
277 ]
280def test_openapi_schema(): 1abcdef
281 response = client.get("/openapi.json") 1@[]^_`
282 assert response.status_code == 200 1@[]^_`
283 assert response.json() == snapshot( 1@[]^_`
284 {
285 "openapi": "3.1.0",
286 "info": {"title": "FastAPI", "version": "0.1.0"},
287 "paths": {
288 "/v1-to-v2/item": {
289 "post": {
290 "summary": "Handle V1 Item To V2",
291 "operationId": "handle_v1_item_to_v2_v1_to_v2_item_post",
292 "requestBody": {
293 "content": {
294 "application/json": {
295 "schema": pydantic_snapshot(
296 v2=snapshot(
297 {
298 "allOf": [
299 {
300 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv1__Item"
301 }
302 ],
303 "title": "Data",
304 }
305 ),
306 v1=snapshot(
307 {
308 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv1__Item"
309 }
310 ),
311 )
312 }
313 },
314 "required": True,
315 },
316 "responses": {
317 "200": {
318 "description": "Successful Response",
319 "content": {
320 "application/json": {
321 "schema": {
322 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv2__Item"
323 }
324 }
325 },
326 },
327 "422": {
328 "description": "Validation Error",
329 "content": {
330 "application/json": {
331 "schema": {
332 "$ref": "#/components/schemas/HTTPValidationError"
333 }
334 }
335 },
336 },
337 },
338 }
339 },
340 "/v2-to-v1/item": {
341 "post": {
342 "summary": "Handle V2 Item To V1",
343 "operationId": "handle_v2_item_to_v1_v2_to_v1_item_post",
344 "requestBody": {
345 "content": {
346 "application/json": {
347 "schema": pydantic_snapshot(
348 v2=snapshot(
349 {
350 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv2__Item-Input"
351 }
352 ),
353 v1=snapshot(
354 {
355 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv2__Item"
356 }
357 ),
358 ),
359 }
360 },
361 "required": True,
362 },
363 "responses": {
364 "200": {
365 "description": "Successful Response",
366 "content": {
367 "application/json": {
368 "schema": {
369 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv1__Item"
370 }
371 }
372 },
373 },
374 "422": {
375 "description": "Validation Error",
376 "content": {
377 "application/json": {
378 "schema": {
379 "$ref": "#/components/schemas/HTTPValidationError"
380 }
381 }
382 },
383 },
384 },
385 }
386 },
387 "/v1-to-v2/item-to-list": {
388 "post": {
389 "summary": "Handle V1 Item To V2 List",
390 "operationId": "handle_v1_item_to_v2_list_v1_to_v2_item_to_list_post",
391 "requestBody": {
392 "content": {
393 "application/json": {
394 "schema": pydantic_snapshot(
395 v2=snapshot(
396 {
397 "allOf": [
398 {
399 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv1__Item"
400 }
401 ],
402 "title": "Data",
403 }
404 ),
405 v1=snapshot(
406 {
407 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv1__Item"
408 }
409 ),
410 )
411 }
412 },
413 "required": True,
414 },
415 "responses": {
416 "200": {
417 "description": "Successful Response",
418 "content": {
419 "application/json": {
420 "schema": {
421 "items": {
422 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv2__Item"
423 },
424 "type": "array",
425 "title": "Response Handle V1 Item To V2 List V1 To V2 Item To List Post",
426 }
427 }
428 },
429 },
430 "422": {
431 "description": "Validation Error",
432 "content": {
433 "application/json": {
434 "schema": {
435 "$ref": "#/components/schemas/HTTPValidationError"
436 }
437 }
438 },
439 },
440 },
441 }
442 },
443 "/v1-to-v2/list-to-list": {
444 "post": {
445 "summary": "Handle V1 List To V2 List",
446 "operationId": "handle_v1_list_to_v2_list_v1_to_v2_list_to_list_post",
447 "requestBody": {
448 "content": {
449 "application/json": {
450 "schema": {
451 "items": {
452 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv1__Item"
453 },
454 "type": "array",
455 "title": "Data",
456 }
457 }
458 },
459 "required": True,
460 },
461 "responses": {
462 "200": {
463 "description": "Successful Response",
464 "content": {
465 "application/json": {
466 "schema": {
467 "items": {
468 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv2__Item"
469 },
470 "type": "array",
471 "title": "Response Handle V1 List To V2 List V1 To V2 List To List Post",
472 }
473 }
474 },
475 },
476 "422": {
477 "description": "Validation Error",
478 "content": {
479 "application/json": {
480 "schema": {
481 "$ref": "#/components/schemas/HTTPValidationError"
482 }
483 }
484 },
485 },
486 },
487 }
488 },
489 "/v1-to-v2/list-to-item": {
490 "post": {
491 "summary": "Handle V1 List To V2 Item",
492 "operationId": "handle_v1_list_to_v2_item_v1_to_v2_list_to_item_post",
493 "requestBody": {
494 "content": {
495 "application/json": {
496 "schema": {
497 "items": {
498 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv1__Item"
499 },
500 "type": "array",
501 "title": "Data",
502 }
503 }
504 },
505 "required": True,
506 },
507 "responses": {
508 "200": {
509 "description": "Successful Response",
510 "content": {
511 "application/json": {
512 "schema": {
513 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv2__Item"
514 }
515 }
516 },
517 },
518 "422": {
519 "description": "Validation Error",
520 "content": {
521 "application/json": {
522 "schema": {
523 "$ref": "#/components/schemas/HTTPValidationError"
524 }
525 }
526 },
527 },
528 },
529 }
530 },
531 "/v2-to-v1/item-to-list": {
532 "post": {
533 "summary": "Handle V2 Item To V1 List",
534 "operationId": "handle_v2_item_to_v1_list_v2_to_v1_item_to_list_post",
535 "requestBody": {
536 "content": {
537 "application/json": {
538 "schema": pydantic_snapshot(
539 v2=snapshot(
540 {
541 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv2__Item-Input"
542 }
543 ),
544 v1=snapshot(
545 {
546 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv2__Item"
547 }
548 ),
549 ),
550 }
551 },
552 "required": True,
553 },
554 "responses": {
555 "200": {
556 "description": "Successful Response",
557 "content": {
558 "application/json": {
559 "schema": {
560 "items": {
561 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv1__Item"
562 },
563 "type": "array",
564 "title": "Response Handle V2 Item To V1 List V2 To V1 Item To List Post",
565 }
566 }
567 },
568 },
569 "422": {
570 "description": "Validation Error",
571 "content": {
572 "application/json": {
573 "schema": {
574 "$ref": "#/components/schemas/HTTPValidationError"
575 }
576 }
577 },
578 },
579 },
580 }
581 },
582 "/v2-to-v1/list-to-list": {
583 "post": {
584 "summary": "Handle V2 List To V1 List",
585 "operationId": "handle_v2_list_to_v1_list_v2_to_v1_list_to_list_post",
586 "requestBody": {
587 "content": {
588 "application/json": {
589 "schema": {
590 "items": pydantic_snapshot(
591 v2=snapshot(
592 {
593 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv2__Item-Input"
594 }
595 ),
596 v1=snapshot(
597 {
598 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv2__Item"
599 }
600 ),
601 ),
602 "type": "array",
603 "title": "Data",
604 }
605 }
606 },
607 "required": True,
608 },
609 "responses": {
610 "200": {
611 "description": "Successful Response",
612 "content": {
613 "application/json": {
614 "schema": {
615 "items": {
616 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv1__Item"
617 },
618 "type": "array",
619 "title": "Response Handle V2 List To V1 List V2 To V1 List To List Post",
620 }
621 }
622 },
623 },
624 "422": {
625 "description": "Validation Error",
626 "content": {
627 "application/json": {
628 "schema": {
629 "$ref": "#/components/schemas/HTTPValidationError"
630 }
631 }
632 },
633 },
634 },
635 }
636 },
637 "/v2-to-v1/list-to-item": {
638 "post": {
639 "summary": "Handle V2 List To V1 Item",
640 "operationId": "handle_v2_list_to_v1_item_v2_to_v1_list_to_item_post",
641 "requestBody": {
642 "content": {
643 "application/json": {
644 "schema": {
645 "items": pydantic_snapshot(
646 v2=snapshot(
647 {
648 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv2__Item-Input"
649 }
650 ),
651 v1=snapshot(
652 {
653 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv2__Item"
654 }
655 ),
656 ),
657 "type": "array",
658 "title": "Data",
659 }
660 }
661 },
662 "required": True,
663 },
664 "responses": {
665 "200": {
666 "description": "Successful Response",
667 "content": {
668 "application/json": {
669 "schema": {
670 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv1__Item"
671 }
672 }
673 },
674 },
675 "422": {
676 "description": "Validation Error",
677 "content": {
678 "application/json": {
679 "schema": {
680 "$ref": "#/components/schemas/HTTPValidationError"
681 }
682 }
683 },
684 },
685 },
686 }
687 },
688 "/v2-to-v1/same-name": {
689 "post": {
690 "summary": "Handle V2 Same Name To V1",
691 "operationId": "handle_v2_same_name_to_v1_v2_to_v1_same_name_post",
692 "requestBody": {
693 "content": {
694 "application/json": {
695 "schema": {
696 "$ref": "#/components/schemas/Body_handle_v2_same_name_to_v1_v2_to_v1_same_name_post"
697 }
698 }
699 },
700 "required": True,
701 },
702 "responses": {
703 "200": {
704 "description": "Successful Response",
705 "content": {
706 "application/json": {
707 "schema": {
708 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv1__Item"
709 }
710 }
711 },
712 },
713 "422": {
714 "description": "Validation Error",
715 "content": {
716 "application/json": {
717 "schema": {
718 "$ref": "#/components/schemas/HTTPValidationError"
719 }
720 }
721 },
722 },
723 },
724 }
725 },
726 "/v2-to-v1/list-of-items-to-list-of-items": {
727 "post": {
728 "summary": "Handle V2 Items In List To V1 Item In List",
729 "operationId": "handle_v2_items_in_list_to_v1_item_in_list_v2_to_v1_list_of_items_to_list_of_items_post",
730 "requestBody": {
731 "content": {
732 "application/json": {
733 "schema": {
734 "$ref": "#/components/schemas/Body_handle_v2_items_in_list_to_v1_item_in_list_v2_to_v1_list_of_items_to_list_of_items_post"
735 }
736 }
737 },
738 "required": True,
739 },
740 "responses": {
741 "200": {
742 "description": "Successful Response",
743 "content": {
744 "application/json": {
745 "schema": {
746 "items": {
747 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv1__ItemInList"
748 },
749 "type": "array",
750 "title": "Response Handle V2 Items In List To V1 Item In List V2 To V1 List Of Items To List Of Items Post",
751 }
752 }
753 },
754 },
755 "422": {
756 "description": "Validation Error",
757 "content": {
758 "application/json": {
759 "schema": {
760 "$ref": "#/components/schemas/HTTPValidationError"
761 }
762 }
763 },
764 },
765 },
766 }
767 },
768 },
769 "components": {
770 "schemas": pydantic_snapshot(
771 v1=snapshot(
772 {
773 "Body_handle_v2_items_in_list_to_v1_item_in_list_v2_to_v1_list_of_items_to_list_of_items_post": {
774 "properties": {
775 "data1": {
776 "items": {
777 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv2__ItemInList"
778 },
779 "type": "array",
780 "title": "Data1",
781 },
782 "data2": {
783 "items": {
784 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv2b__ItemInList"
785 },
786 "type": "array",
787 "title": "Data2",
788 },
789 },
790 "type": "object",
791 "required": ["data1", "data2"],
792 "title": "Body_handle_v2_items_in_list_to_v1_item_in_list_v2_to_v1_list_of_items_to_list_of_items_post",
793 },
794 "Body_handle_v2_same_name_to_v1_v2_to_v1_same_name_post": {
795 "properties": {
796 "item1": {
797 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv2__Item"
798 },
799 "item2": {
800 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv2b__Item"
801 },
802 },
803 "type": "object",
804 "required": ["item1", "item2"],
805 "title": "Body_handle_v2_same_name_to_v1_v2_to_v1_same_name_post",
806 },
807 "HTTPValidationError": {
808 "properties": {
809 "detail": {
810 "items": {
811 "$ref": "#/components/schemas/ValidationError"
812 },
813 "type": "array",
814 "title": "Detail",
815 }
816 },
817 "type": "object",
818 "title": "HTTPValidationError",
819 },
820 "ValidationError": {
821 "properties": {
822 "loc": {
823 "items": {
824 "anyOf": [
825 {"type": "string"},
826 {"type": "integer"},
827 ]
828 },
829 "type": "array",
830 "title": "Location",
831 },
832 "msg": {"type": "string", "title": "Message"},
833 "type": {"type": "string", "title": "Error Type"},
834 },
835 "type": "object",
836 "required": ["loc", "msg", "type"],
837 "title": "ValidationError",
838 },
839 "tests__test_pydantic_v1_v2_multifile__modelsv1__Item": {
840 "properties": {
841 "title": {"type": "string", "title": "Title"},
842 "size": {"type": "integer", "title": "Size"},
843 "description": {
844 "type": "string",
845 "title": "Description",
846 },
847 "sub": {
848 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv1__SubItem"
849 },
850 "multi": {
851 "items": {
852 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv1__SubItem"
853 },
854 "type": "array",
855 "title": "Multi",
856 "default": [],
857 },
858 },
859 "type": "object",
860 "required": ["title", "size", "sub"],
861 "title": "Item",
862 },
863 "tests__test_pydantic_v1_v2_multifile__modelsv1__ItemInList": {
864 "properties": {
865 "name1": {"type": "string", "title": "Name1"}
866 },
867 "type": "object",
868 "required": ["name1"],
869 "title": "ItemInList",
870 },
871 "tests__test_pydantic_v1_v2_multifile__modelsv1__SubItem": {
872 "properties": {
873 "name": {"type": "string", "title": "Name"}
874 },
875 "type": "object",
876 "required": ["name"],
877 "title": "SubItem",
878 },
879 "tests__test_pydantic_v1_v2_multifile__modelsv2__Item": {
880 "properties": {
881 "new_title": {
882 "type": "string",
883 "title": "New Title",
884 },
885 "new_size": {
886 "type": "integer",
887 "title": "New Size",
888 },
889 "new_description": {
890 "type": "string",
891 "title": "New Description",
892 },
893 "new_sub": {
894 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv2__SubItem"
895 },
896 "new_multi": {
897 "items": {
898 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv2__SubItem"
899 },
900 "type": "array",
901 "title": "New Multi",
902 "default": [],
903 },
904 },
905 "type": "object",
906 "required": ["new_title", "new_size", "new_sub"],
907 "title": "Item",
908 },
909 "tests__test_pydantic_v1_v2_multifile__modelsv2__ItemInList": {
910 "properties": {
911 "name2": {"type": "string", "title": "Name2"}
912 },
913 "type": "object",
914 "required": ["name2"],
915 "title": "ItemInList",
916 },
917 "tests__test_pydantic_v1_v2_multifile__modelsv2__SubItem": {
918 "properties": {
919 "new_sub_name": {
920 "type": "string",
921 "title": "New Sub Name",
922 }
923 },
924 "type": "object",
925 "required": ["new_sub_name"],
926 "title": "SubItem",
927 },
928 "tests__test_pydantic_v1_v2_multifile__modelsv2b__Item": {
929 "properties": {
930 "dup_title": {
931 "type": "string",
932 "title": "Dup Title",
933 },
934 "dup_size": {
935 "type": "integer",
936 "title": "Dup Size",
937 },
938 "dup_description": {
939 "type": "string",
940 "title": "Dup Description",
941 },
942 "dup_sub": {
943 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv2b__SubItem"
944 },
945 "dup_multi": {
946 "items": {
947 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv2b__SubItem"
948 },
949 "type": "array",
950 "title": "Dup Multi",
951 "default": [],
952 },
953 },
954 "type": "object",
955 "required": ["dup_title", "dup_size", "dup_sub"],
956 "title": "Item",
957 },
958 "tests__test_pydantic_v1_v2_multifile__modelsv2b__ItemInList": {
959 "properties": {
960 "dup_name2": {
961 "type": "string",
962 "title": "Dup Name2",
963 }
964 },
965 "type": "object",
966 "required": ["dup_name2"],
967 "title": "ItemInList",
968 },
969 "tests__test_pydantic_v1_v2_multifile__modelsv2b__SubItem": {
970 "properties": {
971 "dup_sub_name": {
972 "type": "string",
973 "title": "Dup Sub Name",
974 }
975 },
976 "type": "object",
977 "required": ["dup_sub_name"],
978 "title": "SubItem",
979 },
980 }
981 ),
982 v2=snapshot(
983 {
984 "Body_handle_v2_items_in_list_to_v1_item_in_list_v2_to_v1_list_of_items_to_list_of_items_post": {
985 "properties": {
986 "data1": {
987 "items": {
988 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv2__ItemInList"
989 },
990 "type": "array",
991 "title": "Data1",
992 },
993 "data2": {
994 "items": {
995 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv2b__ItemInList"
996 },
997 "type": "array",
998 "title": "Data2",
999 },
1000 },
1001 "type": "object",
1002 "required": ["data1", "data2"],
1003 "title": "Body_handle_v2_items_in_list_to_v1_item_in_list_v2_to_v1_list_of_items_to_list_of_items_post",
1004 },
1005 "Body_handle_v2_same_name_to_v1_v2_to_v1_same_name_post": {
1006 "properties": {
1007 "item1": {
1008 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv2__Item-Input"
1009 },
1010 "item2": {
1011 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv2b__Item"
1012 },
1013 },
1014 "type": "object",
1015 "required": ["item1", "item2"],
1016 "title": "Body_handle_v2_same_name_to_v1_v2_to_v1_same_name_post",
1017 },
1018 "HTTPValidationError": {
1019 "properties": {
1020 "detail": {
1021 "items": {
1022 "$ref": "#/components/schemas/ValidationError"
1023 },
1024 "type": "array",
1025 "title": "Detail",
1026 }
1027 },
1028 "type": "object",
1029 "title": "HTTPValidationError",
1030 },
1031 "ValidationError": {
1032 "properties": {
1033 "loc": {
1034 "items": {
1035 "anyOf": [
1036 {"type": "string"},
1037 {"type": "integer"},
1038 ]
1039 },
1040 "type": "array",
1041 "title": "Location",
1042 },
1043 "msg": {"type": "string", "title": "Message"},
1044 "type": {"type": "string", "title": "Error Type"},
1045 },
1046 "type": "object",
1047 "required": ["loc", "msg", "type"],
1048 "title": "ValidationError",
1049 },
1050 "tests__test_pydantic_v1_v2_multifile__modelsv1__Item": {
1051 "properties": {
1052 "title": {"type": "string", "title": "Title"},
1053 "size": {"type": "integer", "title": "Size"},
1054 "description": {
1055 "type": "string",
1056 "title": "Description",
1057 },
1058 "sub": {
1059 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv1__SubItem"
1060 },
1061 "multi": {
1062 "items": {
1063 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv1__SubItem"
1064 },
1065 "type": "array",
1066 "title": "Multi",
1067 "default": [],
1068 },
1069 },
1070 "type": "object",
1071 "required": ["title", "size", "sub"],
1072 "title": "Item",
1073 },
1074 "tests__test_pydantic_v1_v2_multifile__modelsv1__ItemInList": {
1075 "properties": {
1076 "name1": {"type": "string", "title": "Name1"}
1077 },
1078 "type": "object",
1079 "required": ["name1"],
1080 "title": "ItemInList",
1081 },
1082 "tests__test_pydantic_v1_v2_multifile__modelsv1__SubItem": {
1083 "properties": {
1084 "name": {"type": "string", "title": "Name"}
1085 },
1086 "type": "object",
1087 "required": ["name"],
1088 "title": "SubItem",
1089 },
1090 "tests__test_pydantic_v1_v2_multifile__modelsv2__Item": {
1091 "properties": {
1092 "new_title": {
1093 "type": "string",
1094 "title": "New Title",
1095 },
1096 "new_size": {
1097 "type": "integer",
1098 "title": "New Size",
1099 },
1100 "new_description": {
1101 "anyOf": [{"type": "string"}, {"type": "null"}],
1102 "title": "New Description",
1103 },
1104 "new_sub": {
1105 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv2__SubItem"
1106 },
1107 "new_multi": {
1108 "items": {
1109 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv2__SubItem"
1110 },
1111 "type": "array",
1112 "title": "New Multi",
1113 "default": [],
1114 },
1115 },
1116 "type": "object",
1117 "required": ["new_title", "new_size", "new_sub"],
1118 "title": "Item",
1119 },
1120 "tests__test_pydantic_v1_v2_multifile__modelsv2__Item-Input": {
1121 "properties": {
1122 "new_title": {
1123 "type": "string",
1124 "title": "New Title",
1125 },
1126 "new_size": {
1127 "type": "integer",
1128 "title": "New Size",
1129 },
1130 "new_description": {
1131 "anyOf": [{"type": "string"}, {"type": "null"}],
1132 "title": "New Description",
1133 },
1134 "new_sub": {
1135 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv2__SubItem"
1136 },
1137 "new_multi": {
1138 "items": {
1139 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv2__SubItem"
1140 },
1141 "type": "array",
1142 "title": "New Multi",
1143 "default": [],
1144 },
1145 },
1146 "type": "object",
1147 "required": ["new_title", "new_size", "new_sub"],
1148 "title": "Item",
1149 },
1150 "tests__test_pydantic_v1_v2_multifile__modelsv2__ItemInList": {
1151 "properties": {
1152 "name2": {"type": "string", "title": "Name2"}
1153 },
1154 "type": "object",
1155 "required": ["name2"],
1156 "title": "ItemInList",
1157 },
1158 "tests__test_pydantic_v1_v2_multifile__modelsv2__SubItem": {
1159 "properties": {
1160 "new_sub_name": {
1161 "type": "string",
1162 "title": "New Sub Name",
1163 }
1164 },
1165 "type": "object",
1166 "required": ["new_sub_name"],
1167 "title": "SubItem",
1168 },
1169 "tests__test_pydantic_v1_v2_multifile__modelsv2b__Item": {
1170 "properties": {
1171 "dup_title": {
1172 "type": "string",
1173 "title": "Dup Title",
1174 },
1175 "dup_size": {
1176 "type": "integer",
1177 "title": "Dup Size",
1178 },
1179 "dup_description": {
1180 "anyOf": [{"type": "string"}, {"type": "null"}],
1181 "title": "Dup Description",
1182 },
1183 "dup_sub": {
1184 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv2b__SubItem"
1185 },
1186 "dup_multi": {
1187 "items": {
1188 "$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv2b__SubItem"
1189 },
1190 "type": "array",
1191 "title": "Dup Multi",
1192 "default": [],
1193 },
1194 },
1195 "type": "object",
1196 "required": ["dup_title", "dup_size", "dup_sub"],
1197 "title": "Item",
1198 },
1199 "tests__test_pydantic_v1_v2_multifile__modelsv2b__ItemInList": {
1200 "properties": {
1201 "dup_name2": {
1202 "type": "string",
1203 "title": "Dup Name2",
1204 }
1205 },
1206 "type": "object",
1207 "required": ["dup_name2"],
1208 "title": "ItemInList",
1209 },
1210 "tests__test_pydantic_v1_v2_multifile__modelsv2b__SubItem": {
1211 "properties": {
1212 "dup_sub_name": {
1213 "type": "string",
1214 "title": "Dup Sub Name",
1215 }
1216 },
1217 "type": "object",
1218 "required": ["dup_sub_name"],
1219 "title": "SubItem",
1220 },
1221 }
1222 ),
1223 ),
1224 },
1225 }
1226 )