Authress-Engineering / openapi-explorer

OpenAPI Web component to generate a UI from the spec.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Property description not rendered, only item description

Xarno opened this issue · comments

Version used: OpenAPI Explorer 2.2.706

If items (on enum propreties) have their own description the description of the property is overwritten by the item description.
I would expect booth to be shown.

class CategoryApiObjects {

    @Schema(description = "Type of category. A category can have multipe types at the same type.") // <- this text is rendered
    enum class ApiCategoryTypeValue {
        INTEREST,
        ORGANIZATION,
        PRODUCT,
        NEWS,
        STANDREGISTRATION,
        EVENT,
        EVENTDATE,
        CUSTOMENTITY,
        TRADEMARK,
        SERIESOFTOPICSUSER,
        PERSON,
        LOOKINGFORANDOFFERING,
        JOBOFFER,
        POINTOFINTEREST,
        MEDIALIBRARY,
        ;
    }


    data class ListCategoriesResponse(

        @field:Schema(description = "Set of types used to filter the categories. For example: `[organization, interest]` Will be null if no such filter was used.") // <-- this text is missing in the render
        val typesFilter: Set<ApiCategoryTypeValue>? = null,

        val lang: String?,

        val orderLang: String?,

        @field:Schema(description = "The categories matching the provided filter criteria.")
        val categories: List<ApiCategory>,
    )

This is the part in the resulting openapi.json file

"ListCategoriesResponse" : {
        "type" : "object",
        "properties" : {
          "typesFilter" : {
            "uniqueItems" : true,
            "type" : "array",
            "description" : "Set of types used to filter the categories. For example: `[organization, interest]` Will be null if no such filter was used.",
            "items" : {
              "type" : "string",
              "description" : "Type of category. A category can have multipe types at the same type.",
              "enum" : [ "INTEREST", "ORGANIZATION", "PRODUCT", "NEWS", "STANDREGISTRATION", "EVENT", "EVENTDATE", "CUSTOMENTITY", "TRADEMARK", "SERIESOFTOPICSUSER", "PERSON", "LOOKINGFORANDOFFERING", "JOBOFFER", "POINTOFINTEREST", "MEDIALIBRARY" ]
            }
          },
          "lang" : {
            "type" : "string"
          },
          "orderLang" : {
            "type" : "string"
          },
          "categories" : {
            "type" : "array",
            "description" : "The categories matching the provided filter criteria.",
            "items" : {
              "$ref" : "#/components/schemas/ApiCategory"
            }
          }
        }
      },

And this is the render. The types Filter description is not shown.
ListCategoryResponse

Thanks for caching that, it actually should be pulling the array level description and not the items schema description. Given the limited amount of space, and by default the lack ability to control what the value of the inner items schema description is, we should by default only show it, when nothing else is available.

With this fix, you can now correctly set the description at the array level, and it will correctly be displayed:
image