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

Swag v2.0.0-rc3 generated docs throws internal server error with echo framework #1588

Open
vinodborole opened this issue May 22, 2023 · 7 comments

Comments

@vinodborole
Copy link

vinodborole commented May 22, 2023

Swag v2.0.0-rc3 generated docs throws internal server error with echo framework
Internal Server Error doc.json with swag latest version and echo framework.

To Reproduce
Steps to reproduce the behavior:

  1. Checkout official example - https://github.com/swaggo/echo-swagger/tree/master/example
  2. delete docs
  3. regenerate docs with latest swag v2.0.0-rc3 using swag init
  4. update the import in main.go pointing to your local docs just generated from step 3
    example: [_ "github.com/vinodborole/swag-ex/docs"]
  5. go run main.go
  6. go to http://localhost:1323/swagger/index.html

Expected behavior
swagger UI opens up without any error.

Screenshots
Internal Server Error doc.json.
Screenshot from 2023-05-22 08-28-33

Your swag version
v2.0.0-rc3

Your go version
1.19

Desktop (please complete the following information):

  • OS: ubuntu
  • Browser: chrome

Additional context
Add any other context about the problem here.

@Nerzal
Copy link
Contributor

Nerzal commented May 22, 2023

Can you post the error, that is being thrown?

@vinodborole
Copy link
Author

Hi @Nerzal

There is no error on the golang console, however this is what i see in the browsers developer tools

error

@o-mago
Copy link

o-mago commented Jul 3, 2023

I've found the same error here. I'm not using echo. Instead I was using https://github.com/swaggo/http-swagger. The problem is actually due to https://github.com/swaggo/echo-swagger/blob/master/go.mod and http-swagger depending on swag version 1.8.12. There is a open PR to solve this problem on the http-swagger: swaggo/http-swagger#102
But I actually think they will update these dependencies only after the swag v2 stable release is available.
Until then you can build your own html page (like a copy paste with the echo-swagger project, only one file)

@gabrielmrts
Copy link

any solution?

@igorwgs
Copy link

igorwgs commented Feb 3, 2024

This #830 (comment) solved this issue.

@talesmgodois
Copy link

SO, just add the following line on the imports section

import (
	_ "<your_mod>/docs" // which is the generated folder after swag init
)

@abdiltegar
Copy link

SO, just add the following line on the imports section

import (
	_ "<your_mod>/docs" // which is the generated folder after swag init
)

Thank you so much, this solution work for me

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

7 participants