1.2.2 • Published 1 month ago

@trapi/decorators v1.2.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

@trapi/decorators 📚

main codecov Known Vulnerabilities npm version

Inspect the CHANGELOG.md in the repository for breaking changes.

Table of Contents

Installation

npm install --save @trapi/decorators

Configuration

declare type Config = {
    /**
     * Use a pre-defined third party configuration in full scope or
     * only use a partial amount of defined type representations.
     *
     * Default: []
     */
    preset?: PresetConfig;
    /**
     * Use all internal defined representations or only use a subset.
     *
     * Default: true
     */
    internal?: MapperIDs;
    /**
     * Set up self defined aka. custom representations.
     */
    custom?: Partial<MapperIDRepresentation>;
}

Usage

import { Config, Mapper, NodeDecorator } from '@trapi/decorators';

const mapper = new Mapper({
    internal: true
});

const decorators : NodeDecorator[] = [
    { text: 'SwaggerTags', arguments: [['auth', 'admin']], typeArguments: [] },
    { text: 'SwaggerTags', arguments: [['auth'], ['admin']], typeArguments: [] },
    { text: 'SwaggerTags', arguments: [], typeArguments: [] },
];

let match = mapper.match('SWAGGER_TAGS', decorators);
let value = match.getPropertyValue('DEFAULT');
console.log(value);
// ['auth', 'admin']

match = mapper.match('RESPONSE_EXAMPLE', decorators);
console.log(match);
// undefined

License

Made with 💚

Published under MIT License.

1.2.2

1 month ago

1.2.1

3 months ago

1.2.0

4 months ago

1.1.0

4 months ago

1.0.1

4 months ago

1.0.0

5 months ago

1.0.0-alpha.7

1 year ago

1.0.0-alpha.6

1 year ago

1.0.0-alpha.5

1 year ago

1.0.0-alpha.4

1 year ago

1.0.0-alpha.3

1 year ago

1.0.0-alpha.9

1 year ago

1.0.0-alpha.8

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago