Comments (4)
Hello @qvfh83 ,
You should be able to fix it by modifying /res/index.html file.
Both /swagger/ui
and /swagger/ui/
endpoints return index.html
file.
The problem is how other resource paths are defined in the index.html
.
This is how swagger-ui.css
is referenced in the index.html
:
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" >
- When you use
/swagger/ui
endpoint its path is resolved as/swagger/swagger-ui.css
. - When you use
/swagger/ui/
endpoint its path is resolved as/swagger/ui/swagger-ui.css
.
from oatpp-swagger.
Thanks for the quick response @lganzzzo!
Hmm, I see - the files are being serviced out of the /swagger/{filename}
endpoint added in Controller.hpp
and thus are not available via a non-existent swagger/ui/{filename}
endpoint. I suppose adding a duplicate endpoint for "GET", "/swagger/ui/{filename}"
would solve this?
I'm not sure I quite understand the fix on the index.html side (don't come from that background so bear with me 😅) - I'd like to support paths both with and without the /
.
I also suppose similar steps could be taken if I also want to support the localhost:{PORT}/swagger
and localhost:{PORT}/swagger/
paths.
from oatpp-swagger.
I'm not sure I quite understand the fix on the index.html side (don't come from that background so bear with me 😅) - I'd like to support paths both with and without the /.
If you change paths in the index.html
to use full paths it should fix this issue.
<!-- change this -->
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" >
<!-- to this: -->
<link rel="stylesheet" type="text/css" href="http://localhost:8000/swagger/swagger-ui.css" >
from oatpp-swagger.
I see - I just tested this and it works if I use the below (that way we can still use any generic port). Not sure if you think this is a good change to make in the package itself? I could open up an MR if so.
<link rel="stylesheet" type="text/css" href="/swagger/swagger-ui.css" >
from oatpp-swagger.
Related Issues (20)
- Is the default description for DefaultBearerAuthorizationSecurityScheme wrong? HOT 1
- SWAGGER_ROOT_PATH defines missing in cmake-module HOT 1
- No mapping for HTTP-method HOT 3
- CMake compiling with oatapp linking issues HOT 1
- Header parameters not shown in Swagger UI HOT 2
- missing cpack for module HOT 2
- Content-Type not set for CSS or JS responses HOT 2
- Error on start
- oatpp-swagger with HTTPS
- swagger-ui authorize bug HOT 1
- To use "application/x-www-form-urlencoded" with readBodyDtoAsync HOT 1
- Set hosting base path
- Adding a Response with No Message Body Leads to an Oat++ Assertion Error at Runtime
- How To Describe File Type for `multipart/form-data` HOT 1
- The contact information cannot be an email. HOT 1
- bad interpretation of enum schemas
- Add authorization on the swagger controller
- Windows Support
- Crashed when added doc controller
- Access to raw OpenAPI JSON
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oatpp-swagger.