Function zodify

Alias for schema decorator, use if conflicts with Zod

  • Decorates a class for automatic schema generation using Zod. When applied, it generates and stores a Zod schema based on the class properties and their decorators.

    Parameters

    • descriptionOrOptions: string | Readonly<{ deprecated?: boolean; description?: string; example?: any }> = {}

      Either a description string or a SchemaOptions object

    Returns ClassDecorator

    A class decorator

    // Using string description
    @schema("User profile information")
    class UserProfile {
    @property("User's full name")
    name: string;
    }

    // Using SchemaOptions object
    @schema({
    description: "User profile information"
    })
    class UserProfile {
    @property("User's full name")
    name: string;
    }