ad-on-is / adonis-autoswagger

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

Bug: Swagger returns empty object for controller with responseBody validator #120

Closed IgorsKolcins closed 2 months ago

IgorsKolcins commented 2 months ago

Description:

When using validator for reponseBody, it is not generating responseBody type when result object has only integer properties.

How to reproduce:

  1. Create controller app/controllers/salons_controller.ts (don't forget to define route to it):
    
    import type { HttpContext } from '@adonisjs/core/http'
    import { salonDeleteByUserIdResponse } from '#validators/salon'

export default class SalonsController { /**

export const salonDeleteByUserIdResponse = vine.compile( vine.object({ salon: vine.object({ id: vine.number(), }), }) )


3. Start server and go to `/docs` page

## Expected result
Type is shown correctly
![image](https://github.com/user-attachments/assets/1c9ca1ab-fefe-40f6-a8b6-d06e7a688202)

## Actual result
Type is empty object
![image](https://github.com/user-attachments/assets/728f6b3e-9074-4ca1-a809-5ec1fd0f6ba4)
IgorsKolcins commented 2 months ago

I have added a fix for that issue in my fork, please check and approve PR: https://github.com/ad-on-is/adonis-autoswagger/pull/121

ad-on-is commented 2 months ago

Added in 3.63 - Thx @IgorsKolcins