-
Notifications
You must be signed in to change notification settings - Fork 762
example & default values not exposed in UI #579
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
example & default values not exposed in UI
I assume all this is for parameters only. First, isn't 1.2 Also, I think
For parameters, both This PR merges examples & default values: I think it's not correct. I'm not sure about |
@triccardi-systran - in 1.2 we had no examples, so often the |
Ok, I was not aware of this usage in 1.2. However this propagates to 2.0 the ambiguity between What are the benefits of this PR? Why not implement a real example via |
Not really following the usage of 'real example' here. |
For me a 'real example' would be an optional additional field for a parameter, listing one (or more) example value for the parameter. It would only be used by swagger-ui complementary to the description of the parameter. It would be similar to the Currently we have to manually add examples into the description, this is encouraged by the |
That's exactly what this ticket aims to solve. |
As explained in my previous comments, this merged PR doesn't correctly solve the issue because it displays the example value as the default value, which are not the same thing. |
Then that's a bug introduced by this PR. Please open a separate ticket for it. |
This PR addresses a lack of support for example values in two scenarios.
First, the
defaultValue
was lost in the conversion from 1.2 to 2.0.Next, for 2.0 specs, there is no "place" to put example values for body parameters. To extend the functionality so it's equivalent to 1.2, an extension--
x-examples
has been added. This allows the mapping of examples which are rendered by the UI.The current implementation only supports the content-type
default
. For formal support in upcoming specs, we will likely add content-type so developers can give examples in different formats. See OAI/OpenAPI-Specification#418 for details