Giter VIP home page Giter VIP logo

Comments (4)

lganzzzo avatar lganzzzo commented on August 25, 2024

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.

qvfh83 avatar qvfh83 commented on August 25, 2024

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.

lganzzzo avatar lganzzzo commented on August 25, 2024

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.

qvfh83 avatar qvfh83 commented on August 25, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.