Function property

  • Adds metadata to a class property. This can include descriptions and examples that will be included in the generated schema.

    Parameters

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

      Either a description string or a PropertyOptions object

    Returns PropertyDecorator

    A property decorator

    class User {
    // Using string description
    @property("User's full name")
    name: string;

    // Using PropertyOptions object
    @property({
    description: "User's age in years",
    example: 25
    })
    age: number;
    }