gyoza.decorator#
Gyoza decorator for input/output model-driven function execution.
- class gyoza.decorator.GyozaOp(input_model, output_model)[source]#
Bases:
objectBind a function to Pydantic input/output models.
The decorated function keeps its original call signature and gains a
runmethod that accepts a plaindictand returns a plaindict, using the models for validation at both ends.- Parameters:
input_model (
type[BaseModel]) – Pydantic model whose fields describe the function’s inputs.output_model (
type[BaseModel]) – Pydantic model whose fields describe the function’s outputs.
- gyoza.decorator.gyoza_op(*, input_model, output_model)[source]#
Decorate a function with input/output model definitions.
The decorated function retains its original call signature and gains:
run(inputs: dict) -> dict— validates inputs viainput_model, calls the function, and returns the result serialised viaoutput_model.input_model/output_model— the attached model classes.
- Parameters:
input_model (
type[BaseModel]) – Pydantic model whose fields describe the function’s inputs.output_model (
type[BaseModel]) – Pydantic model whose fields describe the function’s outputs.
- Returns:
Decorator that wraps the target function.
- Return type:
Callable[[F],F]
Simplified gyoza decorator for input/output model-driven function execution.
- class gyoza.decorator.core.GyozaOp(input_model, output_model)[source]#
Bases:
objectBind a function to Pydantic input/output models.
The decorated function keeps its original call signature and gains a
runmethod that accepts a plaindictand returns a plaindict, using the models for validation at both ends.- Parameters:
input_model (
type[BaseModel]) – Pydantic model whose fields describe the function’s inputs.output_model (
type[BaseModel]) – Pydantic model whose fields describe the function’s outputs.
- gyoza.decorator.core.gyoza_op(*, input_model, output_model)[source]#
Decorate a function with input/output model definitions.
The decorated function retains its original call signature and gains:
run(inputs: dict) -> dict— validates inputs viainput_model, calls the function, and returns the result serialised viaoutput_model.input_model/output_model— the attached model classes.
- Parameters:
input_model (
type[BaseModel]) – Pydantic model whose fields describe the function’s inputs.output_model (
type[BaseModel]) – Pydantic model whose fields describe the function’s outputs.
- Returns:
Decorator that wraps the target function.
- Return type:
Callable[[F],F]