covenix / Example
Function: Example()
Example(
value,status?):MethodDecorator
Defined in: src/decorators.ts:407
Attaches an example value to the operation's OpenAPI media type. Stackable. With no status the example illustrates the request body (pairs with @Body); with a status it illustrates that response (pairs with @Returns).
Parameters
value
unknown
The example value (not validated against the schema).
status?
number
Response status to attach to; omit for the request body.
Returns
MethodDecorator
Example
ts
@Body(CreateUserSchema)
@Example({ username: 'ada' })
@Returns(201, UserSchema)
@Example({ id: '...', username: 'ada' }, 201)
createUser() {}