Git Product home page Git Product logo

Comments (5)

vajahath avatar vajahath commented on July 19, 2024

Could you please take a look into this? I'm a bit tight with my schedules.
Since you have a Windows PC, you can try debugging this right away. It is simple code.
This might be the place which causing the issue:

async function getSwaggerDoc(

Can you please take a look?
PR is most welcome. I'm happy to help.

from open-swagger-ui.

UlysseGuyon avatar UlysseGuyon commented on July 19, 2024

In the getSwaggerDoc function, the first action is to try to load the local file with require. At this stage, the function continues to try to find a way to load it, if the file does not exist but also if the file is not a well formed json. So you can get the error "file not found" even if the file was found but not well formed.

from open-swagger-ui.

vajahath avatar vajahath commented on July 19, 2024

Thanks @UlysseGuyon for your investigation. I've updated the code.
Could you please check the latest master in your env to see if the issue exists?

git clone
git checkout master
node -v
# >=10

npm install
npm run build
node dist/bin/open-swagger-ui.js <file/url> --open

Can you please add your findings here?
(@jayrajput )

from open-swagger-ui.

UlysseGuyon avatar UlysseGuyon commented on July 19, 2024

I tried with the last update and got :

  • For a malformed JSON file : SyntaxError: Unexpected token � in JSON at position 0 and { details: 'Unable to parse the JSON swagger file. The JSON may be malformed. Try https://jsonlint.com/ to validate JSON' }
  • For non-existing file : Error: The given swagger file ({"type":"path","path":"<MY_LOCAL_PATH>"}) could not be found.
  • For a good JSON file : √ Loading file and Swagger open on port 5993

So concerning my files, it seems that the problem has been fixed. 👍

from open-swagger-ui.

vajahath avatar vajahath commented on July 19, 2024

Thanks very much. Released 1.1.0 to npm.
Closing.

from open-swagger-ui.

Related Issues (9)

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.