diff --git a/queenbee/recipe/recipe.py b/queenbee/recipe/recipe.py index 96a6de75..23d8770f 100644 --- a/queenbee/recipe/recipe.py +++ b/queenbee/recipe/recipe.py @@ -682,17 +682,24 @@ def template_by_name(templates: List[Union[DAG, TemplateFunction]], name: str) - return res -class RecipeInfo(BaseModel): - """Recipe information. +class RecipeInterface(BaseModel): + """An interface object for creating a Recipe. - Recipe information only includes metadata, inputs and outputs of a Recipe. + Recipe information only includes metadata, source, inputs and outputs of a Recipe. This object is useful for creating user interface for Recipes. """ + type: constr(regex='^RecipeInterface$') = 'RecipeInterface' + metadata: MetaData = Field( ..., description='Recipe metadata information.' ) + source: str = Field( + None, + description='A URL to the source this recipe from a registry.' + ) + inputs: List[DAGInputs] = Field( None, description='A list of recipe inputs.' @@ -708,10 +715,11 @@ def create_empty_list(cls, v): return [] if not v else v @classmethod - def from_recipe(cls, recipe: Union[Recipe, BakedRecipe]): + def from_recipe(cls, recipe: Union[Recipe, BakedRecipe], source: str = None): """Create a Recipe info from a recipe.""" return cls( metadata=recipe.metadata, + source=source, inputs=recipe.inputs, outputs=recipe.outputs )