import { IDecorator } from "oly"; import { IField, IType } from "../interfaces"; export declare class FieldDecorator implements IDecorator { private readonly options; constructor(options?: Partial | IType); asProperty(target: object, propertyKey: string): void; asParameter(target: object, propertyKey: string, index: number): void; } /** * ```ts * class Embedded { * @field title: string; * } * * class Data { * @field firstName: string; * @field lastName: string; * @field age: number; * @field something: Embedded; * } * ``` * * ### JSON Schema * * ```ts * class Data { * * @field({ * // json-schema options like minLength, ... * // "required" is also available * }) * propertyKey: string; * } * * json.schema(Data); // {properties: {... * ``` * * ### Type * * Mapping requires a "Type", most of the time TypeScript type annotations are enough. * * Exceptions: * - array (see @array) * - native type (see @date) * * ### Required by default * * Like a Typescript property, **a @field property is required by default**. * * ```ts * class A { * @field({required: false}) myProperty?: string; // now it's optional * } * ``` */ export declare const field: ((data?: Function | Partial | undefined, p?: string | undefined, i?: number | undefined) => (data?: object | Function | undefined, p?: string | undefined, i?: number | TypedPropertyDescriptor | undefined) => any) & ((data?: object | Function | undefined, p?: string | undefined, i?: number | TypedPropertyDescriptor | undefined) => any);