-
Notifications
You must be signed in to change notification settings - Fork 9k
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
Swagger-UI and application/hal+json #708
Comments
Yeah, I saw your SO question about it. For now it seems the UI strictly requests application/json for the api docs. For now, you can change it locally in your distribution by changing the following line: I've pointed you to the compiled code since I assume you don't build it yourself. Otherwise, just modify the original swagger-client.js and run the build. |
Awesome! Thanks a bunch! If you add your answer to my SO question I can accept it. I'm not sure if I can modify the source though since I believe it comes from Also, is it alright if I contribute a patch to fix this? Or is it by design that it strictly asks for |
That's something @fehguy needs to answer. Eventually, I believe we'd want to go down this road - OAI/OpenAPI-Specification#110 but until then I imagine there shouldn't be a problem with that. |
This has been asked before--I don't think it's a bad thing to allow configuration of the javascript client with a particular accept header. Will look more, but it's reasonable to me. |
So to confirm, should the line that @webron mentioned be changed to include |
Hi, I believe we would add a new option to configure the default header to use when fetching the resource listing. Happy to merge a PR, but I'd suggest having a value that is set when configuring swagger-ui, which is passed to swagger-js for fetching the resource listings. |
I'm using
swagger-spring-mvc-ui
for my Swagger UI. I'm not sure if the issue lies there or not (not entirely clear which version of Swagger UI they are using). I've configured Swagger to use HAL, which means that the/api-docs
endpoint vendsapplication/hal+json
. However, theAccept:
header from Swagger UI seems to sayAccept: application/json
. This works coincidentally because by default a Spring Boot app recognizesapplication/json
andapplication/*+json
.However, I was trying to add custom media-types and ran into an issue with Spring Boot where
application/json
andapplication/*+json
were blown away. So the only producible media-types wereapplication/hal+json
and my custom media-type.Should Swagger UI be using an
Accept:
header ofAccept: application/json,application/hal+json
instead? Apologies if this is an issue that has already been fixed, or if I'm missing something totally obvious.The text was updated successfully, but these errors were encountered: