Azure / api-management-developer-portal

Developer portal provided by the Azure API Management service.
MIT License
478 stars 306 forks source link

Query parameter examples still not supported #2470

Open erwinkramer opened 2 months ago

erwinkramer commented 2 months ago

Bug description

Query parameter examples are not displayed in the developer portal.

Reproduction steps

Go into an already imported API and edit the API in the Azure Portal with the OpenAPI specification (Json) editor. Create a query parameter that looks like this:

 "parameters": [{
        "name": "page",
        "in": "query",
        "description": "Format - int32. The pagee number.",
        "schema": {
            "type": "integer",
            "format": "int32",
            "example": 2
        }
    }]

or this:

 "parameters": [{
        "name": "page",
        "in": "query",
        "description": "Format - int32. The pagee number.",
        "schema": {
            "type": "integer",
            "format": "int32"
        },
       "example": 2
    }]

....or a variant with an examples array with one or two examples.

Not a single variant will actually display the example. I've only seen this working for HTTP POST examples on the body element.

In any case, if you export the definition on the API Management dev portal, it actually has the example(s) element with the right example values, so it stores and passes through just fine. Only thing left is for the dev portal to support this visually.

As a side note: On the Azure Portal, examples don't show up anywhere, there doesn't seem to be any view (apart from OpenAPI specification yaml/json view) that supports examples, only default values under the values column, this is fine, because with HTTP POST examples on the body element, it doesn't display on the Azure portal either, but it works in the API Management dev portal, so that shouldn't be an excuse: image

Looks to be solved with, but doesn't show: https://github.com/Azure/api-management-developer-portal/issues/610 https://github.com/Azure/api-management-developer-portal/issues/582

Expected behavior

Show the example on the dev portal operation main page, or in the dev portal try-it window, both won't show it.

Is your portal managed or self-hosted?

Self-hosted

Release tag or commit SHA (if using self-hosted version)

2.26.0

Environment