nelmio / NelmioApiDocBundle

Generates documentation for your REST API from annotations
MIT License
2.23k stars 836 forks source link

[Question]: How to insert description for cases of an enum #2364

Closed mateusfmello closed 1 month ago

mateusfmello commented 1 month ago

Version

v4.32.2

Question

In an Enum of type int, Swagger is only displaying the values ​​(1,2,3,4...) in the documentation, so it is not possible to know what each case is about.

I would like to be able to add a description for each case

Additional context

Enum:

<?php

namespace App\Enum;

enum TipoAnexoItemPaginaFormEnum: int implements ValidadorEnum {

    use ValidadorEnumTrait;

    case VIDEO_INTERNO = 1;
    case VIDEO_YOUTUBE = 2;
    case VIDEO_VIEMO   = 3;

    case IMAGEM = 4;
    case IFRAME = 5;
    case MAPA   = 6;
}

Result: image

I would like a result like this:

TipoAnexoItemPaginaFormEnum integer
Enum:

[
    VIDEO_INTERNO = 1,
    VIDEO_YOUTUBE = 2,
    VIDEO_VIEMO = 3,

    IMAGEM = 4,
    IFRAME = 5,
    MAPA = 6,
]
DjordyKoert commented 1 month ago

This isn't possible.

This bundle uses swagger-ui internally to show the page that you are seeing, I suggest that you open an discussion there 😄