0.3.0 • Published 2 years ago

@hippo-oss/metadata-decorators v0.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

metadata-decorators

DTO decorators with reflect-metadata.

Provides an implementation of a dto-decorators flavor that persists metadata using reflect-metadata; other systems may use this persistence to implement runtime logic that is aware of decorated attributes.

Usage

Decorate a class with METADATA_DECORATORS (or any composition thereof):

import { METADATA_DECORATORS } from '@hippo-oss/metadata-decorators';

const { IsString } = METADATA_DECORATORS;

class Example {
    @IsString({
        optional: true,
    })
    name?: string;
}

At runtime, query the class for schema data:

import { getSchema } from '@hippo-oss/metadata-decorators'

const schema = getSchema(Example);
0.3.0

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago