Skip to content
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

Cannot run validator with localhost, please help! #201

Open
SonNXP opened this issue Apr 5, 2022 · 1 comment
Open

Cannot run validator with localhost, please help! #201

SonNXP opened this issue Apr 5, 2022 · 1 comment

Comments

@SonNXP
Copy link

SonNXP commented Apr 5, 2022

Hello,
I need to run Swagger validator for a localhost, ex: url = http://localhost:8085. And I searched the way to do and follow: https://stackoverflow.com/questions/32188386/cant-read-from-file-issue-in-swagger-ui and tried solution 3: Host the validator locally.

For: You will also need to tell swaggerui the location of the validator, where can I find: config.EnableSwagger().EnableSwaggerUi(c => c.SetValidatorUrl(<validator_url>));? I updated my index.html (in my project) with:

window.swaggerUi = new SwaggerUi({
//url: "/um-api/swagger.json",
url: parseUrl(),
validatorUrl: "http://localhost:8080/validator", // added this line and seems it works
dom_id: "swagger-ui-container",

I can run http://localhost:8080/validator/debug?url={site publicly accessible}/apiDocs , it works well.

But when I change to: http://localhost:8080/validator/debug?url=http://localhost:8085/apiDocs, it always return: {"schemaValidationMessages":[{"level":"error","message":"Can't read from file http://localhost:8085/apiDocs"}]}

I see some note that online swagger ui will not work with locahost but is there anyway to fix this? I really need to run the validator with url = http://localhost:8085.

Many thanks!

@phpclub
Copy link

phpclub commented Apr 27, 2024

Are you running this in docker?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants