-
Notifications
You must be signed in to change notification settings - Fork 64
Open
Description
Hi!
I am using the @Body decorator from routing-controllers and it somehow doesn't parse to the Swagger Docs.
I read that it might have to do with using @Body and not Request Body, but routing-controllers does not seem to support any Request Body Decorator.
The response is parsed correctly though!
export type SignUpBody = {
email: string;
password: string;
userType: UserType;
};
@JsonController('/auth/')
export class AuthenticationController {
@OpenAPI({
summary: 'User sign up for buyer and supplier owners',
description: 'Input value of `userType` can be either `supplier` or `buyer`',
requestBody: {
required: true,
content: {
'application/json': {
example: {
email: '[email protected]',
password: '1234!hello@',
userType: 'admin',
},
},
},
},
responses: {
401: {
description:
'Invalid password. Password must be at least 8 characters long, have at least one uppercase letter, one lowercase letter, one number, and one special character.',
},
409: {
description: 'User already exists',
},
422: {
description: 'Invalid access type',
},
500: {
description: 'Internal server error',
},
},
})
@HttpCode(201)
@ResponseSchema(User)
@Post('sign-up')
async signUp(@Body() body: SignUpBody): Promise<User> {
return signUp(body);
}
}Any ideas how I can also parse the Body to the schema in the Swagger docs?
Thanks a lot!
kKen94
Metadata
Metadata
Assignees
Labels
No labels