ad-on-is / adonis-autoswagger

Auto-Generate swagger docs for AdonisJS
MIT License
129 stars 41 forks source link

Add required field in request form data body #112

Closed akashvspaceo closed 3 months ago

akashvspaceo commented 3 months ago

Is there any possibility to have the fields required in the request body like the image below?

image

Example code:

export default class AuthController {
  /**
   * @login
   * @requestBody {"email": "", "password": ""}
   * @responseBody 200 - {"message": "string", "data": { "user": "<User>", "access_token": "string" }} - Successful login
   * @responseBody 400 - {"message": "string"} - Invalid credentials
   * @responseBody 422 - {"message": "string"} - Validation error
   * @responseBody 500 - {"message": "string"} - Internal server error
   */
  async login({ request, response }: HttpContext) {
    //
  }
}

I can also use @requestFormDataBody {"email":{"type":"string"},"password":{"type":"string"}} but its not allowing to specify the required field.

Any suggestions?