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

fix: faulty swagger configuration to render api docs properly #387

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions pkg/router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,9 @@ func Setup(logger *utility.Logger, validator *validator.Validate, db *storage.Da
})

r.StaticFile("/swagger.yaml", "static/swagger.yaml")
url := ginSwagger.URL("/swagger.yaml")
r.GET("/api/docs/*any", func(c *gin.Context) {
c.Writer.Header().Set("Content-Security-Policy", "default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' 'sha256-2TOI2ugkuROHHfKZr6kdGv+XxhrVUI8uHycXqXUIR4g='; img-src 'self' data:;")
ginSwagger.WrapHandler(swaggerFiles.Handler, url)(c)
ginSwagger.WrapHandler(swaggerFiles.Handler, ginSwagger.URL("/swagger.yaml"))(c)
})

r.NoRoute(func(c *gin.Context) {
Expand Down
4 changes: 2 additions & 2 deletions static/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ info:
version: 1.0.0
servers:
# Added by API Auto Mocking Plugin
- url: https://staging.api-golang.boilerplate.hng.tech/api/v1
- url: https://deployment.api-golang.boilerplate.hng.tech/api/v1
- url: https://api.golang.boilerplate.hng.tech/api/v1
- url: https://api.golang.boilerplate.hng.tech/api/v1
Comment on lines +16 to +17
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look for the staging url and add it here, Ask Phoenix


tags:
- name: auth
Expand Down
Loading