-
Notifications
You must be signed in to change notification settings - Fork 244
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
#54: swagger ui is not available for api-gateway. Fixed. Added tests … #55
base: development
Are you sure you want to change the base?
Conversation
…. Added tests for swagger-ui.
public void testSwaggerUiUrls() throws IOException { | ||
testSwaggerUiUrl(8081, "swagger-ui/index.html"); | ||
testSwaggerUiUrl(8082, "swagger-ui/index.html"); | ||
testSwaggerUiUrl(8083, "swagger-ui.html"); |
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.
Why is this different? Shouldn't the paths be consistent?
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.
swagger-ui/index.html - autogenerated for spring controllers
swagger-ui.html - is created manually here:
Lines 8 to 14 in 4914d49
@RestController | |
public class SwaggerController { | |
@GetMapping("/swagger-ui.html") | |
public Resource getFile() { | |
return new ClassPathResource("META-INF/swagger-ui/index.html"); | |
} | |
} |
if change @GetMapping("/swagger-ui.html") to @GetMapping("swagger-ui/index.html") it will not work, because for some reason swagger css and js are served from server root (not from /swagger-ui/*)
I did not investigate it much, because I did not think that is important.
I will investigate it then
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 suspect eventuate-utils needs to be changed to not use the META-INF folder.
spring: | ||
resources: | ||
static-locations: classpath:/static, classpath:META-INF/swagger-ui | ||
static-locations: classpath:/static, classpath:META-INF |
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.
Why is the UI in the META-INF folder?
AFAIK That's not a good use for the this folder. See specification
Exposing the entire classpath:META-INF
folder seems like an especially bad idea since unlike META-INF/swagger-ui it contains non-UI files.
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 will investigate and fix
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.
From quickly reading https://www.webjars.org/documentation#servlet3 it looks like having static resources in a subfolder of META-INF is a common practice.
I think something like static-locations: classpath:/static, classpath:META-INF/swagger-ui
is ok but static-locations: classpath:/static, classpath:META-INF
is not
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 am sorry, but I don't understand: "static-locations: classpath:/static, ... is ok", but then "static-locations: classpath:/static, ..." is not ok. so "classpath:/static" is ok and is not ok in the same time.
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.
oh, got it, it is quote from config. Sorry.
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.
Exposing the entire classpath:META-INF
folder is not a good idea.
…for swagger-ui.