22 lines
484 B
Python
22 lines
484 B
Python
from core.config_factory import SchemaConfig
|
|
from core.typing import Schema
|
|
from pydantic import create_model
|
|
|
|
|
|
def create_schema(module_name: str) -> Schema:
|
|
"""
|
|
Creates pydantic module for item returning.
|
|
|
|
Returns pydantic model.
|
|
|
|
:param module_name: The name of the module.
|
|
"""
|
|
|
|
config = SchemaConfig(module_name)
|
|
|
|
return create_model(
|
|
config.module.get_name("schema"),
|
|
__config__=config.Config,
|
|
**config.get_field_defs(),
|
|
)
|