demessaging.config.registry module
API registry class for demessaging.
Classes:
|
A registry for imports and encoders |
- class demessaging.config.registry.ApiRegistry(*, imports: Dict[str, str] = None, objects: List[str] = None)[source]
Bases:
BaseModel
A registry for imports and encoders
- Parameters:
Methods:
can_import_import
(imports)hard_code
(python_code)Register some code to be implemented in the generated module.
register_import
(module[, alias])Register a module that needs to be imported in generated API files.
register_type
(obj)Register a class or function to be available in the generated API.
Attributes:
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
- hard_code(python_code: str) None [source]
Register some code to be implemented in the generated module.
- Parameters:
python_code (str) – The code that is supposed to be executed on a module level.
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'imports': FieldInfo(annotation=Dict[str, str], required=False, default_factory=dict, description='Modules to import at the top of every file. The first item is the module, the second is the alias'), 'objects': FieldInfo(annotation=List[str], required=False, default_factory=list, description='Source code for objects that should be inlined in the generated Python API.')}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.