-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
remove the sample Swagger UI request body if present fix #12412 #12927
remove the sample Swagger UI request body if present fix #12412 #12927
Conversation
generators/client/templates/vue/src/main/webapp/swagger-ui/index.html.ejs
Outdated
Show resolved
Hide resolved
seriously, the patch was so easy ! thanks a lot @PierreBesson |
a2cbc85
to
c81355c
Compare
Can you also check that the request method is a GET ? |
Good job @PierreBesson 👍 |
@@ -102,6 +102,10 @@ | |||
if (authToken) { | |||
req.headers['Authorization'] = "Bearer " + authToken; | |||
} | |||
// Remove the sample Swagger UI request body if present | |||
if (req.body === '{"additionalProp1":"string","additionalProp2":"string","additionalProp3":"string"}') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need to add this part above too, for oauth2 configuration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -102,6 +102,10 @@ | |||
if (authToken) { | |||
req.headers['Authorization'] = "Bearer " + authToken; | |||
} | |||
// Remove the sample Swagger UI request body if present | |||
if (req.body === '{"additionalProp1":"string","additionalProp2":"string","additionalProp3":"string"}') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same, you need to add this part above too, for oauth2 configuration
@@ -98,6 +98,10 @@ | |||
if (authToken) { | |||
req.headers['Authorization'] = "Bearer " + authToken; | |||
} | |||
// Remove the sample Swagger UI request body if present | |||
if (req.body === '{"additionalProp1":"string","additionalProp2":"string","additionalProp3":"string"}') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same, you need to add this part above too, for oauth2 configuration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added it for other auth methods as well. Good catch @pascalgrimaud !
c81355c
to
856bce5
Compare
Done, I only do it in case of GET. I agree that no one should pass a body to a GET request but just in case someone does it, it will still be supported by our Swagger UI if the content is not |
This is my workaround for #12412. It does not remove the Swagger UI
additionalProps: "string"
content but it patches it when detected so that requests to management endpoints from Swagger UI work out of the box (no need to remove the sample request anymore).Please make sure the below checklist is followed for Pull Requests.
When you are still working on the PR, consider converting it to Draft (bellow reviewers) and adding
skip-ci
label, you can still see CI build result at your branch.