How to reach me ๐ญ
arsmn / fiber-swagger Goto Github PK
View Code? Open in Web Editor NEWfiber middleware to automatically generate RESTful API documentation with Swagger 2.0.
License: MIT License
fiber middleware to automatically generate RESTful API documentation with Swagger 2.0.
License: MIT License
On my local computer go get
ends with an error. Did not work for 2.1.2 either.
$ go get github.com/arsmn/fiber-swagger/v2
go: downloading github.com/arsmn/fiber-swagger/v2 v2.1.3
go: github.com/arsmn/fiber-swagger/v2 upgrade => v2.1.3
go get: github.com/arsmn/fiber-swagger/[email protected] requires
github.com/swaggo/[email protected] requires
github.com/swaggo/[email protected] requires
github.com/ugorji/[email protected] requires
github.com/ugorji/go/[email protected]: reading github.com/ugorji/go/codec/codec/go.mod at revision codec/v1.1.5-pre: unknown revision codec/v1.1.5-pre
$ go version
go version go1.15.3 linux/amd64
Hi! Could you please add a license to you repository? Otherwise we cannot use it in our company. Thanks in advance!
After updating our project to use 2.2.4 eg:
go get: upgraded github.com/arsmn/fiber-swagger/v2 v2.2.0 => v2.24.0
the swagger WebApp started giving a javascript error. I also noticed it did not download the .json
file that it normally does, which makes sense with the error as it fails on the downloadSpec()
func.
github.com/valyala/fasthttp vulnerable to Directory Traversal via the ServeFile function, due to improper sanitization.
https://nvd.nist.gov/vuln/detail/CVE-2022-21221
var (
port = envInt("PORT", 4321)
host = envString("HOST", fmt.Sprintf("http://localhost:%d", port))
)
app := fiber.New()
docs.SwaggerInfo.Host = host
app.Use("/docs", swagger.New(swagger.Config{ // custom
URL: host + "/swagger.json",
DeepLinking: true,
}))
setUpRoutes(app)
Why do we have defaultDocURL = "doc.json" while "swag init " generates swagger.json by default?
2020/11/17 11:46:44 Generating wallet.Address
2020/11/17 11:46:44 ParseComment error in file api/handlers_transfer.go :cannot find type definition: address.Address
code
package wallet
import(
"github.com/filecoin-project/go-address" // package address
)
type AddressBalance struct {
Addr address.Address
Balance types.BigInt
Default bool
}
Hi !
I am trying to use your extension in order set-up correctly a swagger endpoint.
I am very new to Go so it's kind of difficult to debug what's happening as I would like. Feel free to give me any advice.
I have carefully followed the instructions provided in your README file and was not able to get the swagger interface to display my project schema. It keeps displaying the default schema instead.
What I did :
swag
swag init
to initialize the ./doc
directory with docs.go
, swagger.json
, swagger.yaml
main.go
filemain.go
filemain.go
fileswag init
to update the ./doc
directory filesmain.go
:
package main
import (
"fmt"
swagger "github.com/arsmn/fiber-swagger"
_ "github.com/arsmn/fiber-swagger/example/docs"
"github.com/gofiber/fiber"
configuration "gitlab.com/xxx/api-media-manager/pkg"
"gitlab.com/xxx/api-media-manager/pkg/handlers"
)
// @title Media Manager API
// @version 1.0
// @description Media Manager service
func main() {
/* Get configuration */
mediaManagerConfiguration := configuration.New()
/* Set-up server */
server := fiber.New()
server.Use("/swagger", swagger.Handler)
server.Get("/*", handlers.ReadImage)
/* Run server */
address := fmt.Sprintf("%s:%d", mediaManagerConfiguration.Host, mediaManagerConfiguration.Port)
server.Listen(address)
}
Taking a look at ./doc
directory files, they are up to date and contain the information defined in my main.go
file.
Thanks for your help !
Which annotations do we need to use for JWT Authorization?
It seems that Swagger is implementing this via bearerAuth: https://swagger.io/docs/specification/authentication/bearer-authentication/
Hi,
how can I add error handling in swagger ?
regards
go: github.com/arsmn/fiber-swagger/[email protected] requires
github.com/swaggo/[email protected] requires
github.com/swaggo/[email protected] requires
github.com/ugorji/[email protected] requires
github.com/ugorji/go/[email protected]: reading github.com/ugorji/go/codec/codec/go.mod at revision codec/v1.1.5-pre: unknown revision codec/v1.1.5-pre
To do this, clear the cache and click sync in Goland. It is strange that it is bad at pulling packages automatically :/
type Type struct {
FirstName string
}
will be in JSON format:
{ "FirstName": "xxx"}
but the docs render it as
{ "firstName": "xxx"}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.