Nog CLI Developer Guide - v0.10.5
    Preparing search index...

    Represents a single property/field within a DTO class.

    interface IrProperty {
        description?: string;
        discriminator?: { mapping: Record<string, string>; propertyName: string };
        isOptional: boolean;
        isReadonly: boolean;
        name: string;
        type: IrType;
        validators: IrValidator[];
    }
    Index

    Properties

    description?: string

    Optional description from the OpenAPI schema. Used to generate JSDoc comments for the property.

    discriminator?: { mapping: Record<string, string>; propertyName: string }

    Discriminator configuration for polymorphic union properties. Used with class-transformer's @Type decorator to enable runtime deserialization of discriminated unions (oneOf with discriminator).

    Type Declaration

    • mapping: Record<string, string>

      Maps discriminator values to TypeScript class names. Key: discriminator value from the schema Value: TypeScript class name to instantiate

      { 'text': 'TextContent', 'image': 'ImageContent' }
      
    • propertyName: string

      The name of the discriminator property (e.g., 'type', 'kind', 'contentType').

    {
    propertyName: 'type',
    mapping: { 'guard': 'GuardDogTraits', 'companion': 'CompanionDogTraits' }
    }

    Generates:

    @Type(() => Object, {
    discriminator: {
    property: 'type',
    subTypes: [
    { value: 'guard', name: GuardDogTraits },
    { value: 'companion', name: CompanionDogTraits }
    ]
    }
    })
    isOptional: boolean

    Indicates if this property is optional (nullable or not required). When true, generates the ? modifier and @IsOptional() decorator.

    `public email?: string;` with `@IsOptional()`
    
    isReadonly: boolean

    Indicates if this property is readonly. When true, generates the readonly modifier.

    `public readonly id: string;`
    
    name: string

    The property name in camelCase. Safe to use as a TypeScript property identifier.

    'firstName'
    
    'emailAddress'
    
    type: IrType

    The type information for this property. Includes primitives, DTO references, arrays, and compositions.

    validators: IrValidator[]

    List of validation rules to apply to this property. Each validator generates a class-validator decorator.

    [{ type: 'IS_EMAIL' }] → generates `@IsEmail()`