orionis 0.602.0__py3-none-any.whl → 0.604.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,6 +25,7 @@ from orionis.foundation.contracts.application import IApplication
25
25
  from orionis.foundation.exceptions import OrionisTypeError, OrionisRuntimeError, OrionisValueError
26
26
  from orionis.services.asynchrony.coroutines import Coroutine
27
27
  from orionis.services.log.contracts.log_service import ILogger
28
+ from orionis.support.wrapper.dataclass import DataClass
28
29
 
29
30
  class Application(Container, IApplication):
30
31
  """
@@ -556,170 +557,99 @@ class Application(Container, IApplication):
556
557
  *,
557
558
  app: App | dict = App(),
558
559
  auth: Auth | dict = Auth(),
559
- cache : Cache | dict = Cache(),
560
- cors : Cors | dict = Cors(),
561
- database : Database | dict = Database(),
562
- filesystems : Filesystems | dict = Filesystems(),
563
- logging : Logging | dict = Logging(),
564
- mail : Mail | dict = Mail(),
565
- path : Paths | dict = Paths(),
566
- queue : Queue | dict = Queue(),
567
- session : Session | dict = Session(),
568
- testing : Testing | dict = Testing()
560
+ cache: Cache | dict = Cache(),
561
+ cors: Cors | dict = Cors(),
562
+ database: Database | dict = Database(),
563
+ filesystems: Filesystems | dict = Filesystems(),
564
+ logging: Logging | dict = Logging(),
565
+ mail: Mail | dict = Mail(),
566
+ path: Paths | dict = Paths(),
567
+ queue: Queue | dict = Queue(),
568
+ session: Session | dict = Session(),
569
+ testing: Testing | dict = Testing()
569
570
  ) -> 'Application':
570
571
  """
571
- Configure the application with comprehensive service configuration objects.
572
+ Configure all major application subsystems using configuration entities or dictionaries.
572
573
 
573
- This method provides a centralized way to configure all major application
574
- subsystems using either configuration entity instances or dictionary objects.
575
- Each configurator manages settings for a specific aspect of the application
576
- such as authentication, caching, database connectivity, logging, and more.
574
+ This method provides a centralized interface for setting up the application's
575
+ configuration by accepting configuration objects or dictionaries for each major
576
+ subsystem. Each configurator parameter corresponds to a specific aspect of the
577
+ application, such as authentication, caching, database, logging, mail, paths,
578
+ queue, session, and testing. The method validates and loads each configurator
579
+ into the application's configuration system.
577
580
 
578
581
  Parameters
579
582
  ----------
580
583
  app : App or dict, optional
581
- Application-level configuration including name, environment, debug settings,
582
- and URL configuration. Default creates a new App() instance.
584
+ Application-level configuration (e.g., name, environment, debug settings).
585
+ Defaults to a new App() instance.
583
586
  auth : Auth or dict, optional
584
- Authentication system configuration including guards, providers, and
585
- password settings. Default creates a new Auth() instance.
587
+ Authentication configuration (e.g., guards, providers, password settings).
588
+ Defaults to a new Auth() instance.
586
589
  cache : Cache or dict, optional
587
- Caching system configuration including default store, prefix settings,
588
- and driver-specific options. Default creates a new Cache() instance.
590
+ Caching configuration (e.g., default store, prefix, driver options).
591
+ Defaults to a new Cache() instance.
589
592
  cors : Cors or dict, optional
590
- Cross-Origin Resource Sharing configuration including allowed origins,
591
- methods, and headers. Default creates a new Cors() instance.
593
+ CORS configuration (e.g., allowed origins, methods, headers).
594
+ Defaults to a new Cors() instance.
592
595
  database : Database or dict, optional
593
- Database connectivity configuration including default connection, migration
594
- settings, and connection definitions. Default creates a new Database() instance.
596
+ Database configuration (e.g., connections, migration settings).
597
+ Defaults to a new Database() instance.
595
598
  filesystems : Filesystems or dict, optional
596
- File storage system configuration including default disk, cloud storage
597
- settings, and disk definitions. Default creates a new Filesystems() instance.
599
+ Filesystem configuration (e.g., disks, cloud storage).
600
+ Defaults to a new Filesystems() instance.
598
601
  logging : Logging or dict, optional
599
- Logging system configuration including default channel, log levels,
600
- and channel definitions. Default creates a new Logging() instance.
602
+ Logging configuration (e.g., channels, levels).
603
+ Defaults to a new Logging() instance.
601
604
  mail : Mail or dict, optional
602
- Email system configuration including default mailer, transport settings,
603
- and mailer definitions. Default creates a new Mail() instance.
605
+ Mail configuration (e.g., mailers, transport settings).
606
+ Defaults to a new Mail() instance.
604
607
  path : Paths or dict, optional
605
- Application path configuration including directories for controllers,
606
- models, views, and other application components. Default creates a new Paths() instance.
608
+ Application path configuration (e.g., directories for components).
609
+ Defaults to a new Paths() instance.
607
610
  queue : Queue or dict, optional
608
- Queue system configuration including default connection, worker settings,
609
- and connection definitions. Default creates a new Queue() instance.
611
+ Queue configuration (e.g., connections, worker settings).
612
+ Defaults to a new Queue() instance.
610
613
  session : Session or dict, optional
611
- Session management configuration including driver, lifetime, encryption,
612
- and storage settings. Default creates a new Session() instance.
614
+ Session configuration (e.g., driver, lifetime, encryption).
615
+ Defaults to a new Session() instance.
613
616
  testing : Testing or dict, optional
614
- Testing framework configuration including database settings, environment
615
- variables, and test-specific options. Default creates a new Testing() instance.
617
+ Testing configuration (e.g., database, environment variables).
618
+ Defaults to a new Testing() instance.
616
619
 
617
620
  Returns
618
621
  -------
619
622
  Application
620
- The current application instance to enable method chaining.
623
+ The current Application instance, allowing for method chaining.
621
624
 
622
625
  Raises
623
626
  ------
624
627
  OrionisTypeError
625
628
  If any configurator parameter is not an instance of its expected type
626
- or a dictionary that can be converted to the expected type.
629
+ or a dictionary convertible to the expected type.
627
630
 
628
631
  Notes
629
632
  -----
630
- Each configurator is validated for type correctness and then passed to its
631
- corresponding load method for processing and storage in the application's
632
- configuration system.
633
- """
634
-
635
- # Convert dataclass instances to dictionaries
636
- from orionis.services.introspection.dataclass.extractor import extractor
637
-
638
- # Load app configurator
639
- if (isinstance(app, type) and issubclass(app, App)):
640
- app = extractor(app)
641
- if not isinstance(app, (App, dict)):
642
- raise OrionisTypeError(f"Expected App instance or dict, got {type(app).__name__}")
643
- self.loadConfigApp(app)
644
-
645
- # Load auth configurator
646
- if (isinstance(auth, type) and issubclass(auth, Auth)):
647
- auth = extractor(auth)
648
- if not isinstance(auth, (Auth, dict)):
649
- raise OrionisTypeError(f"Expected Auth instance or dict, got {type(auth).__name__}")
650
- self.loadConfigAuth(auth)
651
-
652
- # Load cache configurator
653
- if (isinstance(cache, type) and issubclass(cache, Cache)):
654
- cache = extractor(cache)
655
- if not isinstance(cache, (Cache, dict)):
656
- raise OrionisTypeError(f"Expected Cache instance or dict, got {type(cache).__name__}")
657
- self.loadConfigCache(cache)
658
-
659
- # Load cors configurator
660
- if (isinstance(cors, type) and issubclass(cors, Cors)):
661
- cors = extractor(cors)
662
- if not isinstance(cors, (Cors, dict)):
663
- raise OrionisTypeError(f"Expected Cors instance or dict, got {type(cors).__name__}")
664
- self.loadConfigCors(cors)
665
-
666
- # Load database configurator
667
- if (isinstance(database, type) and issubclass(database, Database)):
668
- database = extractor(database)
669
- if not isinstance(database, (Database, dict)):
670
- raise OrionisTypeError(f"Expected Database instance or dict, got {type(database).__name__}")
671
- self.loadConfigDatabase(database)
672
-
673
- # Load filesystems configurator
674
- if (isinstance(filesystems, type) and issubclass(filesystems, Filesystems)):
675
- filesystems = extractor(filesystems)
676
- if not isinstance(filesystems, (Filesystems, dict)):
677
- raise OrionisTypeError(f"Expected Filesystems instance or dict, got {type(filesystems).__name__}")
678
- self.loadConfigFilesystems(filesystems)
679
-
680
- # Load logging configurator
681
- if (isinstance(logging, type) and issubclass(logging, Logging)):
682
- logging = extractor(logging)
683
- if not isinstance(logging, (Logging, dict)):
684
- raise OrionisTypeError(f"Expected Logging instance or dict, got {type(logging).__name__}")
685
- self.loadConfigLogging(logging)
686
-
687
- # Load mail configurator
688
- if (isinstance(mail, type) and issubclass(mail, Mail)):
689
- mail = extractor(mail)
690
- if not isinstance(mail, (Mail, dict)):
691
- raise OrionisTypeError(f"Expected Mail instance or dict, got {type(mail).__name__}")
692
- self.loadConfigMail(mail)
693
-
694
- # Load paths configurator
695
- if (isinstance(path, type) and issubclass(path, Paths)):
696
- path = extractor(path)
697
- if not isinstance(path, (Paths, dict)):
698
- raise OrionisTypeError(f"Expected Paths instance or dict, got {type(path).__name__}")
699
- self.loadConfigPaths(path)
700
-
701
- # Load queue configurator
702
- if (isinstance(queue, type) and issubclass(queue, Queue)):
703
- queue = extractor(queue)
704
- if not isinstance(queue, (Queue, dict)):
705
- raise OrionisTypeError(f"Expected Queue instance or dict, got {type(queue).__name__}")
706
- self.loadConfigQueue(queue)
707
-
708
- # Load session configurator
709
- if (isinstance(session, type) and issubclass(session, Session)):
710
- session = extractor(session)
711
- if not isinstance(session, (Session, dict)):
712
- raise OrionisTypeError(f"Expected Session instance or dict, got {type(session).__name__}")
713
- self.loadConfigSession(session)
714
-
715
- # Load testing configurator
716
- if (isinstance(testing, type) and issubclass(testing, Testing)):
717
- testing = extractor(testing)
718
- if not isinstance(testing, (Testing, dict)):
719
- raise OrionisTypeError(f"Expected Testing instance or dict, got {type(testing).__name__}")
720
- self.loadConfigTesting(testing)
721
-
722
- # Return self instance for method chaining
633
+ - Each configurator is validated and loaded using its corresponding load method.
634
+ - This method does not perform deep validation of the contents of each configurator.
635
+ - The method returns the Application instance itself for fluent chaining.
636
+ """
637
+
638
+ # Load each configurator into the application's configuration system.
639
+ self.loadConfigApp(app) # Load application-level configuration
640
+ self.loadConfigAuth(auth) # Load authentication configuration
641
+ self.loadConfigCache(cache) # Load cache configuration
642
+ self.loadConfigCors(cors) # Load CORS configuration
643
+ self.loadConfigDatabase(database) # Load database configuration
644
+ self.loadConfigFilesystems(filesystems) # Load filesystems configuration
645
+ self.loadConfigLogging(logging) # Load logging configuration
646
+ self.loadConfigMail(mail) # Load mail configuration
647
+ self.loadConfigPaths(path) # Load path configuration
648
+ self.loadConfigQueue(queue) # Load queue configuration
649
+ self.loadConfigSession(session) # Load session configuration
650
+ self.loadConfigTesting(testing) # Load testing configuration
651
+
652
+ # Return self for method chaining
723
653
  return self
724
654
 
725
655
  def setConfigApp(
@@ -751,11 +681,8 @@ class Application(Container, IApplication):
751
681
  arguments and then calls loadConfigApp() to store the configuration.
752
682
  """
753
683
 
754
- # Create App instance with provided parameters
755
- app = App(**app_config)
756
-
757
684
  # Load configuration using App instance
758
- self.loadConfigApp(app)
685
+ self.loadConfigApp(**app_config)
759
686
 
760
687
  # Return the application instance for method chaining
761
688
  return self
@@ -765,49 +692,57 @@ class Application(Container, IApplication):
765
692
  app: App | dict
766
693
  ) -> 'Application':
767
694
  """
768
- Load and store application configuration from an App instance or dictionary.
695
+ Load and store the application configuration from an `App` instance or dictionary.
769
696
 
770
- This method validates and stores the application configuration in the
771
- internal configurators storage. If a dictionary is provided, it will
772
- be converted to an App instance before storage.
697
+ This method validates and stores the application-level configuration in the internal
698
+ configurators dictionary. If a dictionary is provided, it is converted to an `App`
699
+ instance before storage. The configuration is always stored as a dictionary representation
700
+ of the `App` dataclass.
773
701
 
774
702
  Parameters
775
703
  ----------
776
704
  app : App or dict
777
- The application configuration as either an App instance or a dictionary
778
- containing configuration parameters that can be used to construct an
779
- App instance.
705
+ The application configuration, either as an `App` instance or a dictionary
706
+ containing configuration parameters compatible with the `App` dataclass.
780
707
 
781
708
  Returns
782
709
  -------
783
710
  Application
784
- The current application instance to enable method chaining.
711
+ The current `Application` instance, enabling method chaining.
785
712
 
786
713
  Raises
787
714
  ------
788
715
  OrionisTypeError
789
- If the app parameter is not an instance of App or a dictionary.
716
+ If the `app` parameter is not an instance of `App`, a subclass of `App`, or a dictionary.
790
717
 
791
718
  Notes
792
719
  -----
793
- Dictionary inputs are automatically converted to App instances using
794
- the dictionary unpacking operator (**app).
720
+ - If a class type is provided, it is converted using the `DataClass` wrapper.
721
+ - If a dictionary is provided, it is unpacked into an `App` instance.
722
+ - The resulting configuration is stored in the internal configurators under the 'app' key.
723
+ - The method always returns the current `Application` instance.
795
724
  """
796
725
 
797
- # Validate app type
798
- if not isinstance(app, (App, dict)):
799
- raise OrionisTypeError(f"Expected App instance or dict, got {type(app).__name__}")
726
+ # Convert class type to dict using DataClass wrapper
727
+ if (isinstance(app, type) and issubclass(app, App)):
728
+ _app = DataClass(App).fromDataclass(app).toDict()
729
+
730
+ # Convert dictionary to App instance, then to dict
731
+ elif isinstance(app, dict):
732
+ _app = App(**app).toDict()
800
733
 
801
- # If app is a dict, convert it to App instance
802
- if isinstance(app, dict):
803
- app = App(**app).toDict()
734
+ # Convert App instance to dict
804
735
  elif isinstance(app, App):
805
- app = app.toDict()
736
+ _app = app.toDict()
806
737
 
807
- # Store the configuration
808
- self.__configurators['app'] = app
738
+ # Raise error if type is invalid
739
+ else:
740
+ raise OrionisTypeError(f"Expected App instance or dict, got {type(app).__name__}")
809
741
 
810
- # Return the application instance for method chaining
742
+ # Store the configuration dictionary in internal configurators
743
+ self.__configurators['app'] = _app
744
+
745
+ # Return self for method chaining
811
746
  return self
812
747
 
813
748
  def setConfigAuth(
@@ -815,35 +750,34 @@ class Application(Container, IApplication):
815
750
  **auth_config
816
751
  ) -> 'Application':
817
752
  """
818
- Configure the authentication system using keyword arguments.
753
+ Configure the authentication subsystem using keyword arguments.
819
754
 
820
- This method provides a convenient way to set authentication configuration
821
- by passing individual configuration parameters as keyword arguments.
822
- The parameters are used to create an Auth configuration instance.
755
+ This method allows you to set authentication configuration for the application
756
+ by passing individual configuration parameters as keyword arguments. The provided
757
+ parameters are used to construct an `Auth` configuration instance, which is then
758
+ loaded into the application's internal configurators.
823
759
 
824
760
  Parameters
825
761
  ----------
826
762
  **auth_config : dict
827
- Configuration parameters for authentication. These must match the
828
- field names and types expected by the Auth dataclass from
829
- orionis.foundation.config.auth.entities.auth.Auth.
763
+ Keyword arguments representing authentication configuration options.
764
+ These must match the field names and types expected by the `Auth` dataclass
765
+ from `orionis.foundation.config.auth.entities.auth.Auth`.
830
766
 
831
767
  Returns
832
768
  -------
833
769
  Application
834
- The current application instance to enable method chaining.
770
+ Returns the current `Application` instance to enable method chaining.
835
771
 
836
772
  Notes
837
773
  -----
838
- This method internally creates an Auth instance from the provided keyword
839
- arguments and then calls loadConfigAuth() to store the configuration.
774
+ - This method internally creates an `Auth` instance from the provided keyword
775
+ arguments and then calls `loadConfigAuth()` to store the configuration.
776
+ - The configuration is validated and stored for use during application bootstrapping.
840
777
  """
841
778
 
842
- # Create Auth instance with provided parameters
843
- auth = Auth(**auth_config)
844
-
845
- # Load configuration using Auth instance
846
- self.loadConfigAuth(auth)
779
+ # Load authentication configuration using provided keyword arguments
780
+ self.loadConfigAuth(**auth_config)
847
781
 
848
782
  # Return the application instance for method chaining
849
783
  return self
@@ -855,47 +789,56 @@ class Application(Container, IApplication):
855
789
  """
856
790
  Load and store authentication configuration from an Auth instance or dictionary.
857
791
 
858
- This method validates and stores the authentication configuration in the
859
- internal configurators storage. If a dictionary is provided, it will
860
- be converted to an Auth instance before storage.
792
+ This method validates and stores the authentication configuration in the application's
793
+ internal configurators dictionary. If a dictionary is provided, it is converted to an
794
+ Auth instance before being stored. The configuration is always stored as a dictionary
795
+ representation of the Auth dataclass.
861
796
 
862
797
  Parameters
863
798
  ----------
864
799
  auth : Auth or dict
865
- The authentication configuration as either an Auth instance or a dictionary
866
- containing configuration parameters that can be used to construct an
867
- Auth instance.
800
+ The authentication configuration, either as an Auth instance or a dictionary
801
+ containing parameters compatible with the Auth dataclass.
868
802
 
869
803
  Returns
870
804
  -------
871
805
  Application
872
- The current application instance to enable method chaining.
806
+ The current Application instance, enabling method chaining. This allows further
807
+ configuration or initialization calls to be chained after this method.
873
808
 
874
809
  Raises
875
810
  ------
876
811
  OrionisTypeError
877
- If the auth parameter is not an instance of Auth or a dictionary.
812
+ If the `auth` parameter is not an instance of Auth, a subclass of Auth, or a dictionary.
878
813
 
879
814
  Notes
880
815
  -----
881
- Dictionary inputs are automatically converted to Auth instances using
882
- the dictionary unpacking operator (**auth).
816
+ - If a class type is provided, it is converted using the DataClass wrapper.
817
+ - If a dictionary is provided, it is unpacked into an Auth instance.
818
+ - The resulting configuration is stored in the internal configurators under the 'auth' key.
819
+ - The method always returns the current Application instance.
883
820
  """
884
821
 
885
- # Validate auth type
886
- if not isinstance(auth, (Auth, dict)):
887
- raise OrionisTypeError(f"Expected Auth instance or dict, got {type(auth).__name__}")
822
+ # Convert class type to dict using DataClass wrapper
823
+ if (isinstance(auth, type) and issubclass(auth, Auth)):
824
+ _auth = DataClass(Auth).fromDataclass(auth).toDict()
888
825
 
889
- # If auth is a dict, convert it to Auth instance
890
- if isinstance(auth, dict):
891
- auth = Auth(**auth).toDict()
826
+ # Convert dictionary to Auth instance, then to dict
827
+ elif isinstance(auth, dict):
828
+ _auth = Auth(**auth).toDict()
829
+
830
+ # Convert Auth instance to dict
892
831
  elif isinstance(auth, Auth):
893
- auth = auth.toDict()
832
+ _auth = auth.toDict()
833
+
834
+ # Raise error if type is invalid
835
+ else:
836
+ raise OrionisTypeError(f"Expected Auth instance or dict, got {type(auth).__name__}")
894
837
 
895
- # Store the configuration
896
- self.__configurators['auth'] = auth
838
+ # Store the configuration dictionary in internal configurators
839
+ self.__configurators['auth'] = _auth
897
840
 
898
- # Return the application instance for method chaining
841
+ # Return self for method chaining
899
842
  return self
900
843
 
901
844
  def setConfigCache(
@@ -903,35 +846,34 @@ class Application(Container, IApplication):
903
846
  **cache_config
904
847
  ) -> 'Application':
905
848
  """
906
- Configure the cache system using keyword arguments.
849
+ Configure the cache subsystem using keyword arguments.
907
850
 
908
- This method provides a convenient way to set cache configuration by
909
- passing individual configuration parameters as keyword arguments.
910
- The parameters are used to create a Cache configuration instance.
851
+ This method allows you to set cache configuration for the application
852
+ by passing individual configuration parameters as keyword arguments. The provided
853
+ parameters are used to construct a `Cache` configuration instance, which is then
854
+ loaded into the application's internal configurators.
911
855
 
912
856
  Parameters
913
857
  ----------
914
858
  **cache_config : dict
915
- Configuration parameters for the cache system. These must match the
916
- field names and types expected by the Cache dataclass from
917
- orionis.foundation.config.cache.entities.cache.Cache.
859
+ Keyword arguments representing cache configuration options.
860
+ These must match the field names and types expected by the `Cache` dataclass
861
+ from `orionis.foundation.config.cache.entities.cache.Cache`.
918
862
 
919
863
  Returns
920
864
  -------
921
865
  Application
922
- The current application instance to enable method chaining.
866
+ Returns the current `Application` instance to enable method chaining.
923
867
 
924
868
  Notes
925
869
  -----
926
- This method internally creates a Cache instance from the provided keyword
927
- arguments and then calls loadConfigCache() to store the configuration.
870
+ - This method internally creates a `Cache` instance from the provided keyword
871
+ arguments and then calls `loadConfigCache()` to store the configuration.
872
+ - The configuration is validated and stored for use during application bootstrapping.
928
873
  """
929
874
 
930
- # Create Cache instance with provided parameters
931
- cache = Cache(**cache_config)
932
-
933
- # Load configuration using Cache instance
934
- self.loadConfigCache(cache)
875
+ # Load cache configuration using provided keyword arguments
876
+ self.loadConfigCache(**cache_config)
935
877
 
936
878
  # Return the application instance for method chaining
937
879
  return self
@@ -943,47 +885,56 @@ class Application(Container, IApplication):
943
885
  """
944
886
  Load and store cache configuration from a Cache instance or dictionary.
945
887
 
946
- This method validates and stores the cache configuration in the
947
- internal configurators storage. If a dictionary is provided, it will
948
- be converted to a Cache instance before storage.
888
+ This method validates and stores the cache configuration in the application's
889
+ internal configurators dictionary. If a dictionary is provided, it is converted to a
890
+ Cache instance before being stored. The configuration is always stored as a dictionary
891
+ representation of the Cache dataclass.
949
892
 
950
893
  Parameters
951
894
  ----------
952
895
  cache : Cache or dict
953
- The cache configuration as either a Cache instance or a dictionary
954
- containing configuration parameters that can be used to construct a
955
- Cache instance.
896
+ The cache configuration, either as a Cache instance or a dictionary
897
+ containing parameters compatible with the Cache dataclass.
956
898
 
957
899
  Returns
958
900
  -------
959
901
  Application
960
- The current application instance to enable method chaining.
902
+ The current Application instance, enabling method chaining. This allows further
903
+ configuration or initialization calls to be chained after this method.
961
904
 
962
905
  Raises
963
906
  ------
964
907
  OrionisTypeError
965
- If the cache parameter is not an instance of Cache or a dictionary.
908
+ If the `cache` parameter is not an instance of Cache, a subclass of Cache, or a dictionary.
966
909
 
967
910
  Notes
968
911
  -----
969
- Dictionary inputs are automatically converted to Cache instances using
970
- the dictionary unpacking operator (**cache).
912
+ - If a class type is provided, it is converted using the DataClass wrapper.
913
+ - If a dictionary is provided, it is unpacked into a Cache instance.
914
+ - The resulting configuration is stored in the internal configurators under the 'cache' key.
915
+ - The method always returns the current Application instance.
971
916
  """
972
917
 
973
- # Validate cache type
974
- if not isinstance(cache, (Cache, dict)):
975
- raise OrionisTypeError(f"Expected Cache instance or dict, got {type(cache).__name__}")
918
+ # Convert class type to dict using DataClass wrapper
919
+ if (isinstance(cache, type) and issubclass(cache, Cache)):
920
+ _cache = DataClass(Cache).fromDataclass(cache).toDict()
921
+
922
+ # Convert dictionary to Cache instance, then to dict
923
+ elif isinstance(cache, dict):
924
+ _cache = Cache(**cache).toDict()
976
925
 
977
- # If cache is a dict, convert it to Cache instance
978
- if isinstance(cache, dict):
979
- cache = Cache(**cache).toDict()
926
+ # Convert Cache instance to dict
980
927
  elif isinstance(cache, Cache):
981
- cache = cache.toDict()
928
+ _cache = cache.toDict()
982
929
 
983
- # Store the configuration
984
- self.__configurators['cache'] = cache
930
+ # Raise error if type is invalid
931
+ else:
932
+ raise OrionisTypeError(f"Expected Cache instance or dict, got {type(cache).__name__}")
985
933
 
986
- # Return the application instance for method chaining
934
+ # Store the configuration dictionary in internal configurators
935
+ self.__configurators['cache'] = _cache
936
+
937
+ # Return self for method chaining
987
938
  return self
988
939
 
989
940
  def setConfigCors(
@@ -991,35 +942,34 @@ class Application(Container, IApplication):
991
942
  **cors_config
992
943
  ) -> 'Application':
993
944
  """
994
- Configure the CORS (Cross-Origin Resource Sharing) system using keyword arguments.
945
+ Configure the CORS subsystem using keyword arguments.
995
946
 
996
- This method provides a convenient way to set CORS configuration by
997
- passing individual configuration parameters as keyword arguments.
998
- The parameters are used to create a Cors configuration instance.
947
+ This method allows you to set CORS configuration for the application
948
+ by passing individual configuration parameters as keyword arguments. The provided
949
+ parameters are used to construct a `Cors` configuration instance, which is then
950
+ loaded into the application's internal configurators.
999
951
 
1000
952
  Parameters
1001
953
  ----------
1002
954
  **cors_config : dict
1003
- Configuration parameters for CORS settings. These must match the
1004
- field names and types expected by the Cors dataclass from
1005
- orionis.foundation.config.cors.entities.cors.Cors.
955
+ Keyword arguments representing CORS configuration options.
956
+ These must match the field names and types expected by the `Cors` dataclass
957
+ from `orionis.foundation.config.cors.entities.cors.Cors`.
1006
958
 
1007
959
  Returns
1008
960
  -------
1009
961
  Application
1010
- The current application instance to enable method chaining.
962
+ Returns the current `Application` instance to enable method chaining.
1011
963
 
1012
964
  Notes
1013
965
  -----
1014
- This method internally creates a Cors instance from the provided keyword
1015
- arguments and then calls loadConfigCors() to store the configuration.
966
+ - This method internally creates a `Cors` instance from the provided keyword
967
+ arguments and then calls `loadConfigCors()` to store the configuration.
968
+ - The configuration is validated and stored for use during application bootstrapping.
1016
969
  """
1017
970
 
1018
- # Create Cors instance with provided parameters
1019
- cors = Cors(**cors_config)
1020
-
1021
- # Load configuration using Cors instance
1022
- self.loadConfigCors(cors)
971
+ # Load CORS configuration using provided keyword arguments
972
+ self.loadConfigCors(**cors_config)
1023
973
 
1024
974
  # Return the application instance for method chaining
1025
975
  return self
@@ -1031,47 +981,56 @@ class Application(Container, IApplication):
1031
981
  """
1032
982
  Load and store CORS configuration from a Cors instance or dictionary.
1033
983
 
1034
- This method validates and stores the CORS (Cross-Origin Resource Sharing)
1035
- configuration in the internal configurators storage. If a dictionary is
1036
- provided, it will be converted to a Cors instance before storage.
984
+ This method validates and stores the CORS configuration in the application's
985
+ internal configurators dictionary. If a dictionary is provided, it is converted to a
986
+ Cors instance before being stored. The configuration is always stored as a dictionary
987
+ representation of the Cors dataclass.
1037
988
 
1038
989
  Parameters
1039
990
  ----------
1040
991
  cors : Cors or dict
1041
- The CORS configuration as either a Cors instance or a dictionary
1042
- containing configuration parameters that can be used to construct a
1043
- Cors instance.
992
+ The CORS configuration, either as a Cors instance or a dictionary
993
+ containing parameters compatible with the Cors dataclass.
1044
994
 
1045
995
  Returns
1046
996
  -------
1047
997
  Application
1048
- The current application instance to enable method chaining.
998
+ The current Application instance, enabling method chaining. This allows further
999
+ configuration or initialization calls to be chained after this method.
1049
1000
 
1050
1001
  Raises
1051
1002
  ------
1052
1003
  OrionisTypeError
1053
- If the cors parameter is not an instance of Cors or a dictionary.
1004
+ If the `cors` parameter is not an instance of Cors, a subclass of Cors, or a dictionary.
1054
1005
 
1055
1006
  Notes
1056
1007
  -----
1057
- Dictionary inputs are automatically converted to Cors instances using
1058
- the dictionary unpacking operator (**cors).
1008
+ - If a class type is provided, it is converted using the DataClass wrapper.
1009
+ - If a dictionary is provided, it is unpacked into a Cors instance.
1010
+ - The resulting configuration is stored in the internal configurators under the 'cors' key.
1011
+ - The method always returns the current Application instance.
1059
1012
  """
1060
1013
 
1061
- # Validate cors type
1062
- if not isinstance(cors, (Cors, dict)):
1063
- raise OrionisTypeError(f"Expected Cors instance or dict, got {type(cors).__name__}")
1014
+ # Convert class type to dict using DataClass wrapper
1015
+ if (isinstance(cors, type) and issubclass(cors, Cors)):
1016
+ _cors = DataClass(Cors).fromDataclass(cors).toDict()
1017
+
1018
+ # Convert dictionary to Cors instance, then to dict
1019
+ elif isinstance(cors, dict):
1020
+ _cors = Cors(**cors).toDict()
1064
1021
 
1065
- # If cors is a dict, convert it to Cors instance
1066
- if isinstance(cors, dict):
1067
- cors = Cors(**cors).toDict()
1022
+ # Convert Cors instance to dict
1068
1023
  elif isinstance(cors, Cors):
1069
- cors = cors.toDict()
1024
+ _cors = cors.toDict()
1070
1025
 
1071
- # Store the configuration
1072
- self.__configurators['cors'] = cors
1026
+ # Raise error if type is invalid
1027
+ else:
1028
+ raise OrionisTypeError(f"Expected Cors instance or dict, got {type(cors).__name__}")
1073
1029
 
1074
- # Return the application instance for method chaining
1030
+ # Store the configuration dictionary in internal configurators
1031
+ self.__configurators['cors'] = _cors
1032
+
1033
+ # Return self for method chaining
1075
1034
  return self
1076
1035
 
1077
1036
  def setConfigDatabase(
@@ -1079,35 +1038,34 @@ class Application(Container, IApplication):
1079
1038
  **database_config
1080
1039
  ) -> 'Application':
1081
1040
  """
1082
- Configure the database system using keyword arguments.
1041
+ Configure the database subsystem using keyword arguments.
1083
1042
 
1084
- This method provides a convenient way to set database configuration by
1085
- passing individual configuration parameters as keyword arguments.
1086
- The parameters are used to create a Database configuration instance.
1043
+ This method allows you to set database configuration for the application
1044
+ by passing individual configuration parameters as keyword arguments. The provided
1045
+ parameters are used to construct a `Database` configuration instance, which is then
1046
+ loaded into the application's internal configurators.
1087
1047
 
1088
1048
  Parameters
1089
1049
  ----------
1090
1050
  **database_config : dict
1091
- Configuration parameters for the database system. These must match the
1092
- field names and types expected by the Database dataclass from
1093
- orionis.foundation.config.database.entities.database.Database.
1051
+ Keyword arguments representing database configuration options.
1052
+ These must match the field names and types expected by the `Database` dataclass
1053
+ from `orionis.foundation.config.database.entities.database.Database`.
1094
1054
 
1095
1055
  Returns
1096
1056
  -------
1097
1057
  Application
1098
- The current application instance to enable method chaining.
1058
+ Returns the current `Application` instance to enable method chaining.
1099
1059
 
1100
1060
  Notes
1101
1061
  -----
1102
- This method internally creates a Database instance from the provided keyword
1103
- arguments and then calls loadConfigDatabase() to store the configuration.
1062
+ - This method internally creates a `Database` instance from the provided keyword
1063
+ arguments and then calls `loadConfigDatabase()` to store the configuration.
1064
+ - The configuration is validated and stored for use during application bootstrapping.
1104
1065
  """
1105
1066
 
1106
- # Create Database instance with provided parameters
1107
- database = Database(**database_config)
1108
-
1109
- # Load configuration using Database instance
1110
- self.loadConfigDatabase(database)
1067
+ # Load database configuration using provided keyword arguments
1068
+ self.loadConfigDatabase(**database_config)
1111
1069
 
1112
1070
  # Return the application instance for method chaining
1113
1071
  return self
@@ -1119,47 +1077,56 @@ class Application(Container, IApplication):
1119
1077
  """
1120
1078
  Load and store database configuration from a Database instance or dictionary.
1121
1079
 
1122
- This method validates and stores the database configuration in the
1123
- internal configurators storage. If a dictionary is provided, it will
1124
- be converted to a Database instance before storage.
1080
+ This method validates and stores the database configuration in the application's
1081
+ internal configurators dictionary. If a dictionary is provided, it is converted to a
1082
+ Database instance before being stored. The configuration is always stored as a dictionary
1083
+ representation of the Database dataclass.
1125
1084
 
1126
1085
  Parameters
1127
1086
  ----------
1128
1087
  database : Database or dict
1129
- The database configuration as either a Database instance or a dictionary
1130
- containing configuration parameters that can be used to construct a
1131
- Database instance.
1088
+ The database configuration, either as a Database instance or a dictionary
1089
+ containing parameters compatible with the Database dataclass.
1132
1090
 
1133
1091
  Returns
1134
1092
  -------
1135
1093
  Application
1136
- The current application instance to enable method chaining.
1094
+ The current Application instance, enabling method chaining. This allows further
1095
+ configuration or initialization calls to be chained after this method.
1137
1096
 
1138
1097
  Raises
1139
1098
  ------
1140
1099
  OrionisTypeError
1141
- If the database parameter is not an instance of Database or a dictionary.
1100
+ If the `database` parameter is not an instance of Database, a subclass of Database, or a dictionary.
1142
1101
 
1143
1102
  Notes
1144
1103
  -----
1145
- Dictionary inputs are automatically converted to Database instances using
1146
- the dictionary unpacking operator (**database).
1104
+ - If a class type is provided, it is converted using the DataClass wrapper.
1105
+ - If a dictionary is provided, it is unpacked into a Database instance.
1106
+ - The resulting configuration is stored in the internal configurators under the 'database' key.
1107
+ - The method always returns the current Application instance.
1147
1108
  """
1148
1109
 
1149
- # Validate database type
1150
- if not isinstance(database, (Database, dict)):
1151
- raise OrionisTypeError(f"Expected Database instance or dict, got {type(database).__name__}")
1110
+ # Convert class type to dict using DataClass wrapper
1111
+ if (isinstance(database, type) and issubclass(database, Database)):
1112
+ _database = DataClass(Database).fromDataclass(database).toDict()
1113
+
1114
+ # Convert dictionary to Database instance, then to dict
1115
+ elif isinstance(database, dict):
1116
+ _database = Database(**database).toDict()
1152
1117
 
1153
- # If database is a dict, convert it to Database instance
1154
- if isinstance(database, dict):
1155
- database = Database(**database).toDict()
1118
+ # Convert Database instance to dict
1156
1119
  elif isinstance(database, Database):
1157
- database = database.toDict()
1120
+ _database = database.toDict()
1158
1121
 
1159
- # Store the configuration
1160
- self.__configurators['database'] = database
1122
+ # Raise error if type is invalid
1123
+ else:
1124
+ raise OrionisTypeError(f"Expected Database instance or dict, got {type(database).__name__}")
1161
1125
 
1162
- # Return the application instance for method chaining
1126
+ # Store the configuration dictionary in internal configurators
1127
+ self.__configurators['database'] = _database
1128
+
1129
+ # Return self for method chaining
1163
1130
  return self
1164
1131
 
1165
1132
  def setConfigFilesystems(
@@ -1167,35 +1134,34 @@ class Application(Container, IApplication):
1167
1134
  **filesystems_config
1168
1135
  ) -> 'Application':
1169
1136
  """
1170
- Configure the filesystems using keyword arguments.
1137
+ Configure the filesystems subsystem using keyword arguments.
1171
1138
 
1172
- This method provides a convenient way to set filesystem configuration by
1173
- passing individual configuration parameters as keyword arguments.
1174
- The parameters are used to create a Filesystems configuration instance.
1139
+ This method allows you to set filesystems configuration for the application
1140
+ by passing individual configuration parameters as keyword arguments. The provided
1141
+ parameters are used to construct a `Filesystems` configuration instance, which is then
1142
+ loaded into the application's internal configurators.
1175
1143
 
1176
1144
  Parameters
1177
1145
  ----------
1178
1146
  **filesystems_config : dict
1179
- Configuration parameters for the filesystems. These must match the
1180
- field names and types expected by the Filesystems dataclass from
1181
- orionis.foundation.config.filesystems.entitites.filesystems.Filesystems.
1147
+ Keyword arguments representing filesystems configuration options.
1148
+ These must match the field names and types expected by the `Filesystems` dataclass
1149
+ from `orionis.foundation.config.filesystems.entitites.filesystems.Filesystems`.
1182
1150
 
1183
1151
  Returns
1184
1152
  -------
1185
1153
  Application
1186
- The current application instance to enable method chaining.
1154
+ Returns the current `Application` instance to enable method chaining.
1187
1155
 
1188
1156
  Notes
1189
1157
  -----
1190
- This method internally creates a Filesystems instance from the provided keyword
1191
- arguments and then calls loadConfigFilesystems() to store the configuration.
1158
+ - This method internally creates a `Filesystems` instance from the provided keyword
1159
+ arguments and then calls `loadConfigFilesystems()` to store the configuration.
1160
+ - The configuration is validated and stored for use during application bootstrapping.
1192
1161
  """
1193
1162
 
1194
- # Create Filesystems instance with provided parameters
1195
- filesystems = Filesystems(**filesystems_config)
1196
-
1197
- # Load configuration using Filesystems instance
1198
- self.loadConfigFilesystems(filesystems)
1163
+ # Load filesystems configuration using provided keyword arguments
1164
+ self.loadConfigFilesystems(**filesystems_config)
1199
1165
 
1200
1166
  # Return the application instance for method chaining
1201
1167
  return self
@@ -1207,47 +1173,56 @@ class Application(Container, IApplication):
1207
1173
  """
1208
1174
  Load and store filesystems configuration from a Filesystems instance or dictionary.
1209
1175
 
1210
- This method validates and stores the filesystems configuration in the
1211
- internal configurators storage. If a dictionary is provided, it will
1212
- be converted to a Filesystems instance before storage.
1176
+ This method validates and stores the filesystems configuration in the application's
1177
+ internal configurators dictionary. If a dictionary is provided, it is converted to a
1178
+ Filesystems instance before being stored. The configuration is always stored as a dictionary
1179
+ representation of the Filesystems dataclass.
1213
1180
 
1214
1181
  Parameters
1215
1182
  ----------
1216
1183
  filesystems : Filesystems or dict
1217
- The filesystems configuration as either a Filesystems instance or a dictionary
1218
- containing configuration parameters that can be used to construct a
1219
- Filesystems instance.
1184
+ The filesystems configuration, either as a Filesystems instance or a dictionary
1185
+ containing parameters compatible with the Filesystems dataclass.
1220
1186
 
1221
1187
  Returns
1222
1188
  -------
1223
1189
  Application
1224
- The current application instance to enable method chaining.
1190
+ The current Application instance, enabling method chaining. This allows further
1191
+ configuration or initialization calls to be chained after this method.
1225
1192
 
1226
1193
  Raises
1227
1194
  ------
1228
1195
  OrionisTypeError
1229
- If the filesystems parameter is not an instance of Filesystems or a dictionary.
1196
+ If the `filesystems` parameter is not an instance of Filesystems, a subclass of Filesystems, or a dictionary.
1230
1197
 
1231
1198
  Notes
1232
1199
  -----
1233
- Dictionary inputs are automatically converted to Filesystems instances using
1234
- the dictionary unpacking operator (**filesystems).
1200
+ - If a class type is provided, it is converted using the DataClass wrapper.
1201
+ - If a dictionary is provided, it is unpacked into a Filesystems instance.
1202
+ - The resulting configuration is stored in the internal configurators under the 'filesystems' key.
1203
+ - The method always returns the current Application instance.
1235
1204
  """
1236
1205
 
1237
- # Validate filesystems type
1238
- if not isinstance(filesystems, (Filesystems, dict)):
1239
- raise OrionisTypeError(f"Expected Filesystems instance or dict, got {type(filesystems).__name__}")
1206
+ # Convert class type to dict using DataClass wrapper
1207
+ if (isinstance(filesystems, type) and issubclass(filesystems, Filesystems)):
1208
+ _filesystems = DataClass(Filesystems).fromDataclass(filesystems).toDict()
1240
1209
 
1241
- # If filesystems is a dict, convert it to Filesystems instance
1242
- if isinstance(filesystems, dict):
1243
- filesystems = Filesystems(**filesystems).toDict()
1210
+ # Convert dictionary to Filesystems instance, then to dict
1211
+ elif isinstance(filesystems, dict):
1212
+ _filesystems = Filesystems(**filesystems).toDict()
1213
+
1214
+ # Convert Filesystems instance to dict
1244
1215
  elif isinstance(filesystems, Filesystems):
1245
- filesystems = filesystems.toDict()
1216
+ _filesystems = filesystems.toDict()
1246
1217
 
1247
- # Store the configuration
1248
- self.__configurators['filesystems'] = filesystems
1218
+ # Raise error if type is invalid
1219
+ else:
1220
+ raise OrionisTypeError(f"Expected Filesystems instance or dict, got {type(filesystems).__name__}")
1249
1221
 
1250
- # Return the application instance for method chaining
1222
+ # Store the configuration dictionary in internal configurators
1223
+ self.__configurators['filesystems'] = _filesystems
1224
+
1225
+ # Return self for method chaining
1251
1226
  return self
1252
1227
 
1253
1228
  def setConfigLogging(
@@ -1255,35 +1230,34 @@ class Application(Container, IApplication):
1255
1230
  **logging_config
1256
1231
  ) -> 'Application':
1257
1232
  """
1258
- Configure the logging system using keyword arguments.
1233
+ Configure the logging subsystem using keyword arguments.
1259
1234
 
1260
- This method provides a convenient way to set logging configuration by
1261
- passing individual configuration parameters as keyword arguments.
1262
- The parameters are used to create a Logging configuration instance.
1235
+ This method allows you to set logging configuration for the application
1236
+ by passing individual configuration parameters as keyword arguments. The provided
1237
+ parameters are used to construct a `Logging` configuration instance, which is then
1238
+ loaded into the application's internal configurators.
1263
1239
 
1264
1240
  Parameters
1265
1241
  ----------
1266
1242
  **logging_config : dict
1267
- Configuration parameters for the logging system. These must match the
1268
- field names and types expected by the Logging dataclass from
1269
- orionis.foundation.config.logging.entities.logging.Logging.
1243
+ Keyword arguments representing logging configuration options.
1244
+ These must match the field names and types expected by the `Logging` dataclass
1245
+ from `orionis.foundation.config.logging.entities.logging.Logging`.
1270
1246
 
1271
1247
  Returns
1272
1248
  -------
1273
1249
  Application
1274
- The current application instance to enable method chaining.
1250
+ Returns the current `Application` instance to enable method chaining.
1275
1251
 
1276
1252
  Notes
1277
1253
  -----
1278
- This method internally creates a Logging instance from the provided keyword
1279
- arguments and then calls loadConfigLogging() to store the configuration.
1254
+ - This method internally creates a `Logging` instance from the provided keyword
1255
+ arguments and then calls `loadConfigLogging()` to store the configuration.
1256
+ - The configuration is validated and stored for use during application bootstrapping.
1280
1257
  """
1281
1258
 
1282
- # Create Logging instance with provided parameters
1283
- logging = Logging(**logging_config)
1284
-
1285
- # Load configuration using Logging instance
1286
- self.loadConfigLogging(logging)
1259
+ # Load logging configuration using provided keyword arguments
1260
+ self.loadConfigLogging(**logging_config)
1287
1261
 
1288
1262
  # Return the application instance for method chaining
1289
1263
  return self
@@ -1295,47 +1269,56 @@ class Application(Container, IApplication):
1295
1269
  """
1296
1270
  Load and store logging configuration from a Logging instance or dictionary.
1297
1271
 
1298
- This method validates and stores the logging configuration in the
1299
- internal configurators storage. If a dictionary is provided, it will
1300
- be converted to a Logging instance before storage.
1272
+ This method validates and stores the logging configuration in the application's
1273
+ internal configurators dictionary. If a dictionary is provided, it is converted to a
1274
+ Logging instance before being stored. The configuration is always stored as a dictionary
1275
+ representation of the Logging dataclass.
1301
1276
 
1302
1277
  Parameters
1303
1278
  ----------
1304
1279
  logging : Logging or dict
1305
- The logging configuration as either a Logging instance or a dictionary
1306
- containing configuration parameters that can be used to construct a
1307
- Logging instance.
1280
+ The logging configuration, either as a Logging instance or a dictionary
1281
+ containing parameters compatible with the Logging dataclass.
1308
1282
 
1309
1283
  Returns
1310
1284
  -------
1311
1285
  Application
1312
- The current application instance to enable method chaining.
1286
+ The current Application instance, enabling method chaining. This allows further
1287
+ configuration or initialization calls to be chained after this method.
1313
1288
 
1314
1289
  Raises
1315
1290
  ------
1316
1291
  OrionisTypeError
1317
- If the logging parameter is not an instance of Logging or a dictionary.
1292
+ If the `logging` parameter is not an instance of Logging, a subclass of Logging, or a dictionary.
1318
1293
 
1319
1294
  Notes
1320
1295
  -----
1321
- Dictionary inputs are automatically converted to Logging instances using
1322
- the dictionary unpacking operator (**logging).
1296
+ - If a class type is provided, it is converted using the DataClass wrapper.
1297
+ - If a dictionary is provided, it is unpacked into a Logging instance.
1298
+ - The resulting configuration is stored in the internal configurators under the 'logging' key.
1299
+ - The method always returns the current Application instance.
1323
1300
  """
1324
1301
 
1325
- # Validate logging type
1326
- if not isinstance(logging, (Logging, dict)):
1327
- raise OrionisTypeError(f"Expected Logging instance or dict, got {type(logging).__name__}")
1302
+ # Convert class type to dict using DataClass wrapper
1303
+ if (isinstance(logging, type) and issubclass(logging, Logging)):
1304
+ _logging = DataClass(Logging).fromDataclass(logging).toDict()
1328
1305
 
1329
- # If logging is a dict, convert it to Logging instance
1330
- if isinstance(logging, dict):
1331
- logging = Logging(**logging).toDict()
1306
+ # Convert dictionary to Logging instance, then to dict
1307
+ elif isinstance(logging, dict):
1308
+ _logging = Logging(**logging).toDict()
1309
+
1310
+ # Convert Logging instance to dict
1332
1311
  elif isinstance(logging, Logging):
1333
- logging = logging.toDict()
1312
+ _logging = logging.toDict()
1334
1313
 
1335
- # Store the configuration
1336
- self.__configurators['logging'] = logging
1314
+ # Raise error if type is invalid
1315
+ else:
1316
+ raise OrionisTypeError(f"Expected Logging instance or dict, got {type(logging).__name__}")
1337
1317
 
1338
- # Return the application instance for method chaining
1318
+ # Store the configuration dictionary in internal configurators
1319
+ self.__configurators['logging'] = _logging
1320
+
1321
+ # Return self for method chaining
1339
1322
  return self
1340
1323
 
1341
1324
  def setConfigMail(
@@ -1343,35 +1326,34 @@ class Application(Container, IApplication):
1343
1326
  **mail_config
1344
1327
  ) -> 'Application':
1345
1328
  """
1346
- Configure the mail system using keyword arguments.
1329
+ Configure the mail subsystem using keyword arguments.
1347
1330
 
1348
- This method provides a convenient way to set mail configuration by
1349
- passing individual configuration parameters as keyword arguments.
1350
- The parameters are used to create a Mail configuration instance.
1331
+ This method allows you to set mail configuration for the application
1332
+ by passing individual configuration parameters as keyword arguments. The provided
1333
+ parameters are used to construct a `Mail` configuration instance, which is then
1334
+ loaded into the application's internal configurators.
1351
1335
 
1352
1336
  Parameters
1353
1337
  ----------
1354
1338
  **mail_config : dict
1355
- Configuration parameters for the mail system. These must match the
1356
- field names and types expected by the Mail dataclass from
1357
- orionis.foundation.config.mail.entities.mail.Mail.
1339
+ Keyword arguments representing mail configuration options.
1340
+ These must match the field names and types expected by the `Mail` dataclass
1341
+ from `orionis.foundation.config.mail.entities.mail.Mail`.
1358
1342
 
1359
1343
  Returns
1360
1344
  -------
1361
1345
  Application
1362
- The current application instance to enable method chaining.
1346
+ Returns the current `Application` instance to enable method chaining.
1363
1347
 
1364
1348
  Notes
1365
1349
  -----
1366
- This method internally creates a Mail instance from the provided keyword
1367
- arguments and then calls loadConfigMail() to store the configuration.
1350
+ - This method internally creates a `Mail` instance from the provided keyword
1351
+ arguments and then calls `loadConfigMail()` to store the configuration.
1352
+ - The configuration is validated and stored for use during application bootstrapping.
1368
1353
  """
1369
1354
 
1370
- # Create Mail instance with provided parameters
1371
- mail = Mail(**mail_config)
1372
-
1373
- # Load configuration using Mail instance
1374
- self.loadConfigMail(mail)
1355
+ # Load mail configuration using provided keyword arguments
1356
+ self.loadConfigMail(**mail_config)
1375
1357
 
1376
1358
  # Return the application instance for method chaining
1377
1359
  return self
@@ -1383,47 +1365,56 @@ class Application(Container, IApplication):
1383
1365
  """
1384
1366
  Load and store mail configuration from a Mail instance or dictionary.
1385
1367
 
1386
- This method validates and stores the mail configuration in the
1387
- internal configurators storage. If a dictionary is provided, it will
1388
- be converted to a Mail instance before storage.
1368
+ This method validates and stores the mail configuration in the application's
1369
+ internal configurators dictionary. If a dictionary is provided, it is converted to a
1370
+ Mail instance before being stored. The configuration is always stored as a dictionary
1371
+ representation of the Mail dataclass.
1389
1372
 
1390
1373
  Parameters
1391
1374
  ----------
1392
1375
  mail : Mail or dict
1393
- The mail configuration as either a Mail instance or a dictionary
1394
- containing configuration parameters that can be used to construct a
1395
- Mail instance.
1376
+ The mail configuration, either as a Mail instance or a dictionary
1377
+ containing parameters compatible with the Mail dataclass.
1396
1378
 
1397
1379
  Returns
1398
1380
  -------
1399
1381
  Application
1400
- The current application instance to enable method chaining.
1382
+ The current Application instance, enabling method chaining. This allows further
1383
+ configuration or initialization calls to be chained after this method.
1401
1384
 
1402
1385
  Raises
1403
1386
  ------
1404
1387
  OrionisTypeError
1405
- If the mail parameter is not an instance of Mail or a dictionary.
1388
+ If the `mail` parameter is not an instance of Mail, a subclass of Mail, or a dictionary.
1406
1389
 
1407
1390
  Notes
1408
1391
  -----
1409
- Dictionary inputs are automatically converted to Mail instances using
1410
- the dictionary unpacking operator (**mail).
1392
+ - If a class type is provided, it is converted using the DataClass wrapper.
1393
+ - If a dictionary is provided, it is unpacked into a Mail instance.
1394
+ - The resulting configuration is stored in the internal configurators under the 'mail' key.
1395
+ - The method always returns the current Application instance.
1411
1396
  """
1412
1397
 
1413
- # Validate mail type
1414
- if not isinstance(mail, (Mail, dict)):
1415
- raise OrionisTypeError(f"Expected Mail instance or dict, got {type(mail).__name__}")
1398
+ # Convert class type to dict using DataClass wrapper
1399
+ if (isinstance(mail, type) and issubclass(mail, Mail)):
1400
+ _mail = DataClass(Mail).fromDataclass(mail).toDict()
1401
+
1402
+ # Convert dictionary to Mail instance, then to dict
1403
+ elif isinstance(mail, dict):
1404
+ _mail = Mail(**mail).toDict()
1416
1405
 
1417
- # If mail is a dict, convert it to Mail instance
1418
- if isinstance(mail, dict):
1419
- mail = Mail(**mail).toDict()
1406
+ # Convert Mail instance to dict
1420
1407
  elif isinstance(mail, Mail):
1421
- mail = mail.toDict()
1408
+ _mail = mail.toDict()
1422
1409
 
1423
- # Store the configuration
1424
- self.__configurators['mail'] = mail
1410
+ # Raise error if type is invalid
1411
+ else:
1412
+ raise OrionisTypeError(f"Expected Mail instance or dict, got {type(mail).__name__}")
1425
1413
 
1426
- # Return the application instance for method chaining
1414
+ # Store the configuration dictionary in internal configurators
1415
+ self.__configurators['mail'] = _mail
1416
+
1417
+ # Return self for method chaining
1427
1418
  return self
1428
1419
 
1429
1420
  def setConfigQueue(
@@ -1431,35 +1422,34 @@ class Application(Container, IApplication):
1431
1422
  **queue_config
1432
1423
  ) -> 'Application':
1433
1424
  """
1434
- Configure the queue system using keyword arguments.
1425
+ Configure the queue subsystem using keyword arguments.
1435
1426
 
1436
- This method provides a convenient way to set queue configuration by
1437
- passing individual configuration parameters as keyword arguments.
1438
- The parameters are used to create a Queue configuration instance.
1427
+ This method allows you to set queue configuration for the application
1428
+ by passing individual configuration parameters as keyword arguments. The provided
1429
+ parameters are used to construct a `Queue` configuration instance, which is then
1430
+ loaded into the application's internal configurators.
1439
1431
 
1440
1432
  Parameters
1441
1433
  ----------
1442
1434
  **queue_config : dict
1443
- Configuration parameters for the queue system. These must match the
1444
- field names and types expected by the Queue dataclass from
1445
- orionis.foundation.config.queue.entities.queue.Queue.
1435
+ Keyword arguments representing queue configuration options.
1436
+ These must match the field names and types expected by the `Queue` dataclass
1437
+ from `orionis.foundation.config.queue.entities.queue.Queue`.
1446
1438
 
1447
1439
  Returns
1448
1440
  -------
1449
1441
  Application
1450
- The current application instance to enable method chaining.
1442
+ Returns the current `Application` instance to enable method chaining.
1451
1443
 
1452
1444
  Notes
1453
1445
  -----
1454
- This method internally creates a Queue instance from the provided keyword
1455
- arguments and then calls loadConfigQueue() to store the configuration.
1446
+ - This method internally creates a `Queue` instance from the provided keyword
1447
+ arguments and then calls `loadConfigQueue()` to store the configuration.
1448
+ - The configuration is validated and stored for use during application bootstrapping.
1456
1449
  """
1457
1450
 
1458
- # Create Queue instance with provided parameters
1459
- queue = Queue(**queue_config)
1460
-
1461
- # Load configuration using Queue instance
1462
- self.loadConfigQueue(queue)
1451
+ # Load queue configuration using provided keyword arguments
1452
+ self.loadConfigQueue(**queue_config)
1463
1453
 
1464
1454
  # Return the application instance for method chaining
1465
1455
  return self
@@ -1471,47 +1461,56 @@ class Application(Container, IApplication):
1471
1461
  """
1472
1462
  Load and store queue configuration from a Queue instance or dictionary.
1473
1463
 
1474
- This method validates and stores the queue configuration in the
1475
- internal configurators storage. If a dictionary is provided, it will
1476
- be converted to a Queue instance before storage.
1464
+ This method validates and stores the queue configuration in the application's
1465
+ internal configurators dictionary. If a dictionary is provided, it is converted to a
1466
+ Queue instance before being stored. The configuration is always stored as a dictionary
1467
+ representation of the Queue dataclass.
1477
1468
 
1478
1469
  Parameters
1479
1470
  ----------
1480
1471
  queue : Queue or dict
1481
- The queue configuration as either a Queue instance or a dictionary
1482
- containing configuration parameters that can be used to construct a
1483
- Queue instance.
1472
+ The queue configuration, either as a Queue instance or a dictionary
1473
+ containing parameters compatible with the Queue dataclass.
1484
1474
 
1485
1475
  Returns
1486
1476
  -------
1487
1477
  Application
1488
- The current application instance to enable method chaining.
1478
+ The current Application instance, enabling method chaining. This allows further
1479
+ configuration or initialization calls to be chained after this method.
1489
1480
 
1490
1481
  Raises
1491
1482
  ------
1492
1483
  OrionisTypeError
1493
- If the queue parameter is not an instance of Queue or a dictionary.
1484
+ If the `queue` parameter is not an instance of Queue, a subclass of Queue, or a dictionary.
1494
1485
 
1495
1486
  Notes
1496
1487
  -----
1497
- Dictionary inputs are automatically converted to Queue instances using
1498
- the dictionary unpacking operator (**queue).
1488
+ - If a class type is provided, it is converted using the DataClass wrapper.
1489
+ - If a dictionary is provided, it is unpacked into a Queue instance.
1490
+ - The resulting configuration is stored in the internal configurators under the 'queue' key.
1491
+ - The method always returns the current Application instance.
1499
1492
  """
1500
1493
 
1501
- # Validate queue type
1502
- if not isinstance(queue, (Queue, dict)):
1503
- raise OrionisTypeError(f"Expected Queue instance or dict, got {type(queue).__name__}")
1494
+ # Convert class type to dict using DataClass wrapper
1495
+ if (isinstance(queue, type) and issubclass(queue, Queue)):
1496
+ _queue = DataClass(Queue).fromDataclass(queue).toDict()
1497
+
1498
+ # Convert dictionary to Queue instance, then to dict
1499
+ elif isinstance(queue, dict):
1500
+ _queue = Queue(**queue).toDict()
1504
1501
 
1505
- # If queue is a dict, convert it to Queue instance
1506
- if isinstance(queue, dict):
1507
- queue = Queue(**queue).toDict()
1502
+ # Convert Queue instance to dict
1508
1503
  elif isinstance(queue, Queue):
1509
- queue = queue.toDict()
1504
+ _queue = queue.toDict()
1510
1505
 
1511
- # Store the configuration
1512
- self.__configurators['queue'] = queue
1506
+ # Raise error if type is invalid
1507
+ else:
1508
+ raise OrionisTypeError(f"Expected Queue instance or dict, got {type(queue).__name__}")
1513
1509
 
1514
- # Return the application instance for method chaining
1510
+ # Store the configuration dictionary in internal configurators
1511
+ self.__configurators['queue'] = _queue
1512
+
1513
+ # Return self for method chaining
1515
1514
  return self
1516
1515
 
1517
1516
  def setConfigSession(
@@ -1519,35 +1518,34 @@ class Application(Container, IApplication):
1519
1518
  **session_config
1520
1519
  ) -> 'Application':
1521
1520
  """
1522
- Configure the session system using keyword arguments.
1521
+ Configure the session subsystem using keyword arguments.
1523
1522
 
1524
- This method provides a convenient way to set session configuration by
1525
- passing individual configuration parameters as keyword arguments.
1526
- The parameters are used to create a Session configuration instance.
1523
+ This method allows you to set session configuration for the application
1524
+ by passing individual configuration parameters as keyword arguments. The provided
1525
+ parameters are used to construct a `Session` configuration instance, which is then
1526
+ loaded into the application's internal configurators.
1527
1527
 
1528
1528
  Parameters
1529
1529
  ----------
1530
1530
  **session_config : dict
1531
- Configuration parameters for the session system. These must match the
1532
- field names and types expected by the Session dataclass from
1533
- orionis.foundation.config.session.entities.session.Session.
1531
+ Keyword arguments representing session configuration options.
1532
+ These must match the field names and types expected by the `Session` dataclass
1533
+ from `orionis.foundation.config.session.entities.session.Session`.
1534
1534
 
1535
1535
  Returns
1536
1536
  -------
1537
1537
  Application
1538
- The current application instance to enable method chaining.
1538
+ Returns the current `Application` instance to enable method chaining.
1539
1539
 
1540
1540
  Notes
1541
1541
  -----
1542
- This method internally creates a Session instance from the provided keyword
1543
- arguments and then calls loadConfigSession() to store the configuration.
1542
+ - This method internally creates a `Session` instance from the provided keyword
1543
+ arguments and then calls `loadConfigSession()` to store the configuration.
1544
+ - The configuration is validated and stored for use during application bootstrapping.
1544
1545
  """
1545
1546
 
1546
- # Create Session instance with provided parameters
1547
- session = Session(**session_config)
1548
-
1549
- # Load configuration using Session instance
1550
- self.loadConfigSession(session)
1547
+ # Load session configuration using provided keyword arguments
1548
+ self.loadConfigSession(**session_config)
1551
1549
 
1552
1550
  # Return the application instance for method chaining
1553
1551
  return self
@@ -1559,47 +1557,56 @@ class Application(Container, IApplication):
1559
1557
  """
1560
1558
  Load and store session configuration from a Session instance or dictionary.
1561
1559
 
1562
- This method validates and stores the session configuration in the
1563
- internal configurators storage. If a dictionary is provided, it will
1564
- be converted to a Session instance before storage.
1560
+ This method validates and stores the session configuration in the application's
1561
+ internal configurators dictionary. If a dictionary is provided, it is converted to a
1562
+ Session instance before being stored. The configuration is always stored as a dictionary
1563
+ representation of the Session dataclass.
1565
1564
 
1566
1565
  Parameters
1567
1566
  ----------
1568
1567
  session : Session or dict
1569
- The session configuration as either a Session instance or a dictionary
1570
- containing configuration parameters that can be used to construct a
1571
- Session instance.
1568
+ The session configuration, either as a Session instance or a dictionary
1569
+ containing parameters compatible with the Session dataclass.
1572
1570
 
1573
1571
  Returns
1574
1572
  -------
1575
1573
  Application
1576
- The current application instance to enable method chaining.
1574
+ The current Application instance, enabling method chaining. This allows further
1575
+ configuration or initialization calls to be chained after this method.
1577
1576
 
1578
1577
  Raises
1579
1578
  ------
1580
1579
  OrionisTypeError
1581
- If the session parameter is not an instance of Session or a dictionary.
1580
+ If the `session` parameter is not an instance of Session, a subclass of Session, or a dictionary.
1582
1581
 
1583
1582
  Notes
1584
1583
  -----
1585
- Dictionary inputs are automatically converted to Session instances using
1586
- the dictionary unpacking operator (**session).
1584
+ - If a class type is provided, it is converted using the DataClass wrapper.
1585
+ - If a dictionary is provided, it is unpacked into a Session instance.
1586
+ - The resulting configuration is stored in the internal configurators under the 'session' key.
1587
+ - The method always returns the current Application instance.
1587
1588
  """
1588
1589
 
1589
- # Validate session type
1590
- if not isinstance(session, (Session, dict)):
1591
- raise OrionisTypeError(f"Expected Session instance or dict, got {type(session).__name__}")
1590
+ # Convert class type to dict using DataClass wrapper
1591
+ if (isinstance(session, type) and issubclass(session, Session)):
1592
+ _session = DataClass(Session).fromDataclass(session).toDict()
1593
+
1594
+ # Convert dictionary to Session instance, then to dict
1595
+ elif isinstance(session, dict):
1596
+ _session = Session(**session).toDict()
1592
1597
 
1593
- # If session is a dict, convert it to Session instance
1594
- if isinstance(session, dict):
1595
- session = Session(**session).toDict()
1598
+ # Convert Session instance to dict
1596
1599
  elif isinstance(session, Session):
1597
- session = session.toDict()
1600
+ _session = session.toDict()
1601
+
1602
+ # Raise error if type is invalid
1603
+ else:
1604
+ raise OrionisTypeError(f"Expected Session instance or dict, got {type(session).__name__}")
1598
1605
 
1599
- # Store the configuration
1600
- self.__configurators['session'] = session
1606
+ # Store the configuration dictionary in internal configurators
1607
+ self.__configurators['session'] = _session
1601
1608
 
1602
- # Return the application instance for method chaining
1609
+ # Return self for method chaining
1603
1610
  return self
1604
1611
 
1605
1612
  def setConfigTesting(
@@ -1607,35 +1614,34 @@ class Application(Container, IApplication):
1607
1614
  **testing_config
1608
1615
  ) -> 'Application':
1609
1616
  """
1610
- Configure the testing framework using keyword arguments.
1617
+ Configure the testing subsystem using keyword arguments.
1611
1618
 
1612
- This method provides a convenient way to set testing configuration by
1613
- passing individual configuration parameters as keyword arguments.
1614
- The parameters are used to create a Testing configuration instance.
1619
+ This method allows you to set testing configuration for the application
1620
+ by passing individual configuration parameters as keyword arguments. The provided
1621
+ parameters are used to construct a `Testing` configuration instance, which is then
1622
+ loaded into the application's internal configurators.
1615
1623
 
1616
1624
  Parameters
1617
1625
  ----------
1618
1626
  **testing_config : dict
1619
- Configuration parameters for the testing framework. These must match the
1620
- field names and types expected by the Testing dataclass from
1621
- orionis.foundation.config.testing.entities.testing.Testing.
1627
+ Keyword arguments representing testing configuration options.
1628
+ These must match the field names and types expected by the `Testing` dataclass
1629
+ from `orionis.foundation.config.testing.entities.testing.Testing`.
1622
1630
 
1623
1631
  Returns
1624
1632
  -------
1625
1633
  Application
1626
- The current application instance to enable method chaining.
1634
+ Returns the current `Application` instance to enable method chaining.
1627
1635
 
1628
1636
  Notes
1629
1637
  -----
1630
- This method internally creates a Testing instance from the provided keyword
1631
- arguments and then calls loadConfigTesting() to store the configuration.
1638
+ - This method internally creates a `Testing` instance from the provided keyword
1639
+ arguments and then calls `loadConfigTesting()` to store the configuration.
1640
+ - The configuration is validated and stored for use during application bootstrapping.
1632
1641
  """
1633
1642
 
1634
- # Create Testing instance with provided parameters
1635
- testing = Testing(**testing_config)
1636
-
1637
- # Load configuration using Testing instance
1638
- self.loadConfigTesting(testing)
1643
+ # Load testing configuration using provided keyword arguments
1644
+ self.loadConfigTesting(**testing_config)
1639
1645
 
1640
1646
  # Return the application instance for method chaining
1641
1647
  return self
@@ -1647,47 +1653,56 @@ class Application(Container, IApplication):
1647
1653
  """
1648
1654
  Load and store testing configuration from a Testing instance or dictionary.
1649
1655
 
1650
- This method validates and stores the testing framework configuration in the
1651
- internal configurators storage. If a dictionary is provided, it will be
1652
- converted to a Testing instance before storage.
1656
+ This method validates and stores the testing configuration in the application's
1657
+ internal configurators dictionary. If a dictionary is provided, it is converted to a
1658
+ Testing instance before being stored. The configuration is always stored as a dictionary
1659
+ representation of the Testing dataclass.
1653
1660
 
1654
1661
  Parameters
1655
1662
  ----------
1656
1663
  testing : Testing or dict
1657
- The testing configuration as either a Testing instance or a dictionary
1658
- containing configuration parameters that can be used to construct a
1659
- Testing instance.
1664
+ The testing configuration, either as a Testing instance or a dictionary
1665
+ containing parameters compatible with the Testing dataclass.
1660
1666
 
1661
1667
  Returns
1662
1668
  -------
1663
1669
  Application
1664
- The current application instance to enable method chaining.
1670
+ The current Application instance, enabling method chaining. This allows further
1671
+ configuration or initialization calls to be chained after this method.
1665
1672
 
1666
1673
  Raises
1667
1674
  ------
1668
1675
  OrionisTypeError
1669
- If the testing parameter is not an instance of Testing or a dictionary.
1676
+ If the `testing` parameter is not an instance of Testing, a subclass of Testing, or a dictionary.
1670
1677
 
1671
1678
  Notes
1672
1679
  -----
1673
- Dictionary inputs are automatically converted to Testing instances using
1674
- the dictionary unpacking operator (**testing).
1680
+ - If a class type is provided, it is converted using the DataClass wrapper.
1681
+ - If a dictionary is provided, it is unpacked into a Testing instance.
1682
+ - The resulting configuration is stored in the internal configurators under the 'testing' key.
1683
+ - The method always returns the current Application instance.
1675
1684
  """
1676
1685
 
1677
- # Validate testing type
1678
- if not isinstance(testing, (Testing, dict)):
1679
- raise OrionisTypeError(f"Expected Testing instance or dict, got {type(testing).__name__}")
1686
+ # Convert class type to dict using DataClass wrapper
1687
+ if (isinstance(testing, type) and issubclass(testing, Testing)):
1688
+ _testing = DataClass(Testing).fromDataclass(testing).toDict()
1689
+
1690
+ # Convert dictionary to Testing instance, then to dict
1691
+ elif isinstance(testing, dict):
1692
+ _testing = Testing(**testing).toDict()
1680
1693
 
1681
- # If testing is a dict, convert it to Testing instance
1682
- if isinstance(testing, dict):
1683
- testing = Testing(**testing).toDict()
1694
+ # Convert Testing instance to dict
1684
1695
  elif isinstance(testing, Testing):
1685
- testing = testing.toDict()
1696
+ _testing = testing.toDict()
1686
1697
 
1687
- # Store the configuration
1688
- self.__configurators['testing'] = testing
1698
+ # Raise error if type is invalid
1699
+ else:
1700
+ raise OrionisTypeError(f"Expected Testing instance or dict, got {type(testing).__name__}")
1689
1701
 
1690
- # Return the application instance for method chaining
1702
+ # Store the configuration dictionary in internal configurators
1703
+ self.__configurators['testing'] = _testing
1704
+
1705
+ # Return self for method chaining
1691
1706
  return self
1692
1707
 
1693
1708
  def setConfigPaths(
@@ -1770,47 +1785,56 @@ class Application(Container, IApplication):
1770
1785
  """
1771
1786
  Load and store path configuration from a Paths instance or dictionary.
1772
1787
 
1773
- This method validates and stores the application path configuration in the
1774
- internal configurators storage. If a dictionary is provided, it will be
1775
- converted to a Paths instance before storage.
1788
+ This method validates and stores the path configuration in the application's
1789
+ internal configurators dictionary. If a dictionary is provided, it is converted to a
1790
+ Paths instance before being stored. The configuration is always stored as a dictionary
1791
+ representation of the Paths dataclass.
1776
1792
 
1777
1793
  Parameters
1778
1794
  ----------
1779
1795
  paths : Paths or dict
1780
- The path configuration as either a Paths instance or a dictionary
1781
- containing path parameters that can be used to construct a Paths instance.
1796
+ The path configuration, either as a Paths instance or a dictionary
1797
+ containing parameters compatible with the Paths dataclass.
1782
1798
 
1783
1799
  Returns
1784
1800
  -------
1785
1801
  Application
1786
- The current application instance to enable method chaining.
1802
+ The current Application instance, enabling method chaining. This allows further
1803
+ configuration or initialization calls to be chained after this method.
1787
1804
 
1788
1805
  Raises
1789
1806
  ------
1790
1807
  OrionisTypeError
1791
- If the paths parameter is not an instance of Paths or a dictionary.
1808
+ If the `paths` parameter is not an instance of Paths, a subclass of Paths, or a dictionary.
1792
1809
 
1793
1810
  Notes
1794
1811
  -----
1795
- Dictionary inputs are automatically converted to Paths instances using
1796
- the dictionary unpacking operator (**paths). This method is used internally
1797
- by withConfigurators() and can be called directly for path configuration.
1812
+ - If a class type is provided, it is converted using the DataClass wrapper.
1813
+ - If a dictionary is provided, it is unpacked into a Paths instance.
1814
+ - The resulting configuration is stored in the internal configurators under the 'path' key.
1815
+ - The method always returns the current Application instance.
1798
1816
  """
1799
1817
 
1800
- # Validate paths type
1801
- if not isinstance(paths, (Paths, dict)):
1802
- raise OrionisTypeError(f"Expected Paths instance or dict, got {type(paths).__name__}")
1818
+ # Convert class type to dict using DataClass wrapper
1819
+ if (isinstance(paths, type) and issubclass(paths, Paths)):
1820
+ _paths = DataClass(Paths).fromDataclass(paths).toDict()
1821
+
1822
+ # Convert dictionary to Paths instance, then to dict
1823
+ elif isinstance(paths, dict):
1824
+ _paths = Paths(**paths).toDict()
1803
1825
 
1804
- # If paths is a dict, convert it to Paths instance
1805
- if isinstance(paths, dict):
1806
- paths = Paths(**paths).toDict()
1826
+ # Convert Paths instance to dict
1807
1827
  elif isinstance(paths, Paths):
1808
- paths = paths.toDict()
1828
+ _paths = paths.toDict()
1809
1829
 
1810
- # Store the configuration
1811
- self.__configurators['path'] = paths
1830
+ # Raise error if type is invalid
1831
+ else:
1832
+ raise OrionisTypeError(f"Expected Paths instance or dict, got {type(paths).__name__}")
1812
1833
 
1813
- # Return the application instance for method chaining
1834
+ # Store the configuration dictionary in internal configurators
1835
+ self.__configurators['path'] = _paths
1836
+
1837
+ # Return self for method chaining
1814
1838
  return self
1815
1839
 
1816
1840
  def __loadConfig(
@@ -1848,12 +1872,9 @@ class Application(Container, IApplication):
1848
1872
  if not self.__configurators:
1849
1873
  self.__config = Configuration().toDict()
1850
1874
 
1851
- # Convert configurators to a dictionary
1875
+ # Assign the configurators to config and clean up
1852
1876
  else:
1853
- self.__config = Configuration(**self.__configurators).toDict()
1854
-
1855
- # Remove __configurators ofter loading configuration
1856
- if hasattr(self, '_Application__configurators'):
1877
+ self.__config = self.__configurators
1857
1878
  del self.__configurators
1858
1879
 
1859
1880
  except Exception as e: