feat: refactor whole bunch of stuff
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { z } from "npm:zod";
|
||||
import { RecipeResource } from "./marka/schema.ts";
|
||||
|
||||
export const IngredientSchema = z.object({
|
||||
quantity: z.string().describe(
|
||||
@@ -17,7 +18,6 @@ export const IngredientGroupSchema = z.object({
|
||||
export type IngredientGroup = z.infer<typeof IngredientGroupSchema>;
|
||||
|
||||
const recipeSchema = z.object({
|
||||
_type: z.literal("Recipe"),
|
||||
name: z.string().describe(
|
||||
"Title of the Recipe, without the name of the website or author",
|
||||
),
|
||||
@@ -29,6 +29,9 @@ const recipeSchema = z.object({
|
||||
_type: z.literal("Person"),
|
||||
name: z.string().describe("author of the Recipe (optional)"),
|
||||
}),
|
||||
keywords: z.array(z.string()).describe(
|
||||
"List of keywords that match the recipe",
|
||||
),
|
||||
recipeIngredient: z.array(z.string())
|
||||
.describe("List of ingredients"),
|
||||
recipeInstructions: z.array(z.string()).describe("List of instructions"),
|
||||
@@ -48,7 +51,7 @@ export const recipeResponseSchema = z.union([recipeSchema, noRecipeSchema]);
|
||||
|
||||
export function isValidRecipe(
|
||||
recipe:
|
||||
| Recipe
|
||||
| RecipeResource
|
||||
| null
|
||||
| undefined,
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user