stoplightio / elements

Build beautiful, interactive API Docs with embeddable React or Web Components, powered by OpenAPI and Markdown.
https://stoplight.io/open-source/elements/
Apache License 2.0
1.6k stars 189 forks source link

Default boolean schema value is not shown in parameters dropdown #2585

Closed PatrickSchuster closed 1 week ago

PatrickSchuster commented 1 month ago

Current Behavior

Default boolean schema parameters don't say "default to: ..." in the parameters section.

Expected Behavior

Default boolean schema parameters should say "default to: ..." in the parameters section.

Steps to Reproduce

I have created a reproducable example using a random API I found:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>Boolean value test</title>
    <script src="https://unpkg.com/@stoplight/elements/web-components.min.js"></script>
    <link rel="stylesheet" href="https://unpkg.com/@stoplight/elements/styles.min.css">
</head>
<body>
    <elements-api
      apiDescriptionUrl="https://api.apis.guru/v2/specs/amadeus.com/amadeus-hotel-search/3.0.8/swagger.json"
      router="hash"
      layout="sidebar"
    />
</body>
</html>

This is how it looks:

Screenshot 2024-05-21 at 15 27 15

This endpoint has a "bestRateOnly" parameter. Here is the schema for it:

{
"default": true,
"description": "Used to return only the cheapest offer per hotel or all available offers.",
"in": "query",
"name": "bestRateOnly",
"required": false,
"type": "boolean"
}

Notice that its default value is set to true. While this is correctly displayed in the request query parameters here:

Screenshot 2024-05-21 at 15 22 58

It does not say "defaults to: true" in the parameters section:

Screenshot 2024-05-21 at 15 23 34

However, it does say "defaults to: 1" e.g. for the "adults" parameter.

My question is: Is this behavior intentional? If not, is there a way to still show "defaults to: ..." in the Parameters section?

brendarearden commented 3 weeks ago

Is this behavior intentional? If not, is there a way to still show "defaults to: ..." in the Parameters section? This is not intentional and would be a nice enhancement. Feel free to submit a PR if desired.