-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
Requestbody x-www-form-urlencoded is not properly rendered #4643
Comments
Hello, I was about to open a new issue but I've seen this one which is correlated. I would like to integrate Ispvic report with the object-level "example" (as documented here https://swagger.io/docs/specification/adding-examples/#request-response-bodies) which doesn't seem to be supported: application/x-www-form-urlencoded:
schema:
type: object
properties:
userid:
type: string
description: the id (or email address) inserted by the user in the login form
password:
type: string
format: password
example:
userid: test
password: password Plus, the example is still populated by using the notation inside the properties... properties:
userid:
type: string
description: the id (or email address) inserted by the user in the login form
example: test ...but in the form the example is always rendered between quotation marks: If something is wrong on my YAML code, please let me know, I wasn't able to correct the issue even with different notations. Thanks, |
@arlix85 , what is your required configuration for your schema, and which version is your swagger-ui. In my example, the red star and |
@lspvic just like "example", "required" is still working if used inside the property, like the old v2 standard: properties:
userid:
type: string
description: the id (or email address) inserted by the user in the login form
example: test
required: true |
@arlix85 In OpenAPI 3.0, required is not suitable for properties, there's a required array for properties, like type: object
required:
- userid
properties:
userid:
type: string
description: the id (or email address) inserted by the user in the login form
example: test Thanks. |
@lspvic yes, I know, but since it's still working in SwaggerUI, I'm using this workaround until this issue is fixed. |
In case this helps, it's easy to reproduce. Go to https://petstore.swagger.io/#/pet/updatePetWithForm You can see endpoints such as These values are also the default in the Try It Out form, and annoyingly even if you clear the value it normally re-appears on blur. |
@danielflower the default value issue is fixed since 8f65483#diff-47300e7ecd8989b6246221de88fc9a3cR633 The re-appear issue is definitely a bug. |
I'm not sure which is the designed behavior:
I prefer not setting the sample value at all if not present, use the description as the input placeholder would be better. I've also noticed that all the parameter rows are re-render when one of them is changed, which might be a performance issue. |
Is this planned to be fixed? I saw this issue a few months ago, thought that I would be addressed by now but after trying 3.0 again it seems to be present to this day (on SwaggerHub). |
This has been prioritized, and will be fixed shortly 😄 |
Fixed! @arlix85, be advised that the forthcoming version of Swagger UI will break the property-level |
Got the same issue here. |
@huihe, this is fixed, are you sure you're on the latest version of Swagger UI? 😄 |
@shockey, not yet. I saw the release notes, and plan to upgrade to the latest. Thank you. |
I tried to use Swagger-UI 3.18.2(https://github.com/swagger-api/swagger-ui/releases). The description is still not shown when using urlencoded. And I notice that the |
I've just upgraded to 3.18.2 and while the issue is slightly different, it is still there. Previously the pre-populated value was Here is the JSON: "requestBody": {
"content": {
"application/x-www-form-urlencoded": {
"schema": {
"required": [
"gitUrl"
],
"type": "object",
"properties": {
"appName": {
"type": "string",
"description": "The ID that the app will be referenced which should just be letters, numbers, and hyphens. Leave blank to infer it from the git URL",
"nullable": true,
"deprecated": false
},
"gitUrl": {
"type": "string",
"description": "An SSH or HTTP git URL that points to an app-runner compatible app",
"nullable": false,
"deprecated": false
}
}
}
}
},
"required": false
} |
@danielflower, are you still seeing this in latest (3.19.0)? |
That version doesn't appear to be available in maven central yet. (Using |
It's available now: http://central.maven.org/maven2/org/webjars/swagger-ui/3.19.0/ |
Works great now. Thanks a lot! |
Great! I'm going to close out this thread now - if anyone is having issues with this in the future, please open a new issue. |
Q&A (please complete the following information)
Content & configuration
Swagger/OpenAPI definition:
Swagger-UI configuration options:
Is your feature request related to a problem?
However, parameters are ideally shown. There should be no much difference between parameters and body form data.
Describe the solution you'd like
Describe alternatives you've considered
Additional context
The text was updated successfully, but these errors were encountered: