@@ -462,117 +462,107 @@ def init_resource_types_mgr() -> None:
462462
463463# ### create union type aliases for models of any resource type model
464464
465- # CREATE
466- AnyResourceCreate = Union [ # noqa: UP007
467- tuple (
468- [
469- rt .resource_model ().create_model ()
470- for rt in resource_types_mgr .get_all ().values ()
471- ]
472- )
473- ]
474- AnyResourceCreateBody = Annotated [
475- AnyResourceCreate ,
465+ AnyResourceCreate = Annotated [
466+ Union [ # noqa: UP007
467+ tuple (
468+ [
469+ rt .resource_model ().create_model ()
470+ for rt in resource_types_mgr .get_all ().values ()
471+ ]
472+ )
473+ ],
476474 Body (discriminator = "resource_type" ),
475+ Field (discriminator = "resource_type" ),
477476]
478477
479- # READ
480- AnyResourceRead = Union [ # noqa: UP007
481- tuple (
482- [
483- rt .resource_model ().read_model ()
484- for rt in resource_types_mgr .get_all ().values ()
485- ]
486- )
487- ]
488- AnyResourceReadBody = Annotated [
489- AnyResourceRead ,
478+ AnyResourceRead = Annotated [
479+ Union [ # noqa: UP007
480+ tuple (
481+ [
482+ rt .resource_model ().read_model ()
483+ for rt in resource_types_mgr .get_all ().values ()
484+ ]
485+ )
486+ ],
490487 Body (discriminator = "resource_type" ),
488+ Field (discriminator = "resource_type" ),
491489]
492490
493- # UPDATE
494- AnyResourceUpdate = Union [ # noqa: UP007
495- tuple (
496- [
497- rt .resource_model ().update_model ()
498- for rt in resource_types_mgr .get_all ().values ()
499- ]
500- )
501- ]
502- AnyResourceUpdateBody = Annotated [
503- AnyResourceUpdate ,
491+ AnyResourceUpdate = Annotated [
492+ Union [ # noqa: UP007
493+ tuple (
494+ [
495+ rt .resource_model ().update_model ()
496+ for rt in resource_types_mgr .get_all ().values ()
497+ ]
498+ )
499+ ],
504500 Body (discriminator = "resource_type" ),
505- ]
506-
507- # DOCUMENT
508- AnyResourceDocument = Union [ # noqa: UP007
509- tuple (
510- [
511- rt .resource_model ().document_model ()
512- for rt in resource_types_mgr .get_all ().values ()
513- ]
514- )
501+ Field (discriminator = "resource_type" ),
515502]
516503
517504
518- # ### create union type aliases for models of any content type model
505+ # ### CREATE UNION TYPE ALIASES FOR MODELS OF ANY CONTENT TYPE MODEL
519506
520- # CREATE
521- AnyContentCreate = Union [ # noqa: UP007
522- tuple (
523- [
524- rt .content_model ().create_model ()
525- for rt in resource_types_mgr .get_all ().values ()
526- ]
527- )
528- ]
529- AnyContentCreateBody = Annotated [
530- AnyContentCreate ,
507+ AnyContentCreate = Annotated [
508+ Union [ # noqa: UP007
509+ tuple (
510+ [
511+ rt .content_model ().create_model ()
512+ for rt in resource_types_mgr .get_all ().values ()
513+ ]
514+ )
515+ ],
531516 Body (discriminator = "resource_type" ),
517+ Field (discriminator = "resource_type" ),
532518]
533519
534- # READ
535- AnyContentRead = Union [ # noqa: UP007
536- tuple (
537- [
538- rt .content_model ().read_model ()
539- for rt in resource_types_mgr .get_all ().values ()
540- ]
541- )
542- ]
543- AnyContentReadBody = Annotated [
544- AnyContentRead ,
520+ AnyContentRead = Annotated [
521+ Union [ # noqa: UP007
522+ tuple (
523+ [
524+ rt .content_model ().read_model ()
525+ for rt in resource_types_mgr .get_all ().values ()
526+ ]
527+ )
528+ ],
545529 Body (discriminator = "resource_type" ),
530+ Field (discriminator = "resource_type" ),
546531]
547532
548- # UPDATE
549- AnyContentUpdate = Union [ # noqa: UP007
550- tuple (
551- [
552- rt .content_model ().update_model ()
553- for rt in resource_types_mgr .get_all ().values ()
554- ]
555- )
556- ]
557- AnyContentUpdateBody = Annotated [
558- AnyContentUpdate ,
533+ AnyContentUpdate = Annotated [
534+ Union [ # noqa: UP007
535+ tuple (
536+ [
537+ rt .content_model ().update_model ()
538+ for rt in resource_types_mgr .get_all ().values ()
539+ ]
540+ )
541+ ],
559542 Body (discriminator = "resource_type" ),
543+ Field (discriminator = "resource_type" ),
560544]
561545
562- # DOCUMENT
563- AnyContentDocument = Union [ # noqa: UP007
564- tuple (
565- [
566- rt .content_model ().document_model ()
567- for rt in resource_types_mgr .get_all ().values ()
568- ]
569- )
546+ AnyContentDocument = Annotated [
547+ Union [ # noqa: UP007
548+ tuple (
549+ [
550+ rt .content_model ().document_model ()
551+ for rt in resource_types_mgr .get_all ().values ()
552+ ]
553+ )
554+ ],
555+ Body (discriminator = "resource_type" ),
556+ Field (discriminator = "resource_type" ),
570557]
571558
572- # ANY RESOURCE SEARCH QUERY
559+
560+ # ### CREATE UNION TYPE ALIASES FOR MODELS OF RESOURCE TYPE-SPECIFIC SEARCH QUERIES
561+
573562AnyResourceSearchQuery = Annotated [
574563 Union [ # noqa: UP007
575564 tuple ([rt .search_query_model () for rt in resource_types_mgr .get_all ().values ()])
576565 ],
566+ Body (discriminator = "resource_type" ),
577567 Field (discriminator = "resource_type" ),
578568]
0 commit comments