@tsed/common
Version:
A TypeScript Framework on top of Express
71 lines • 1.45 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Ignore = void 0;
const schema_1 = require("@tsed/schema");
/**
* Ignore the property when JsonMapper serialize the class to a Plain Object JavaScript.
*
* ::: tip
* This decorator is used by the Converters to serialize correctly your model.
* :::
*
* ::: warning
* Swagger will not generate documentation for the ignored property.
* :::
*
* ```typescript
* class User {
* @Ignore()
* _id: string;
*
* @Property()
* firstName: string;
*
* @Property()
* lastName: string;
*
* @Ignore()
* password: string;
* }
* ```
*
* The controller:
* ```typescript
* import {Post, Controller, BodyParams} from "@tsed/common";
* import {Person} from "../models/Person";
*
* @Controller("/")
* export class UsersCtrl {
*
* @Get("/")
* get(): User {
* const user = new User();
* user._id = "12345";
* user.firstName = "John";
* user.lastName = "Doe";
* user.password = "secretpassword";
* return
* }
* }
* ```
*
* The expected json object:
*
* ```json
* {
* "firstName": "John",
* "lastName": "Doe"
* }
* ```
*
* @decorator
* @jsonMapper
* @schema
* @ignore
* @deprecated Since v6. Use @Ignore decorator from @tsed/schema instead of.
*/
function Ignore() {
return schema_1.Ignore();
}
exports.Ignore = Ignore;
//# sourceMappingURL=ignoreProperty.js.map