Git Product home page Git Product logo

fiber-swagger's Issues

License missing

Hi! Could you please add a license to you repository? Otherwise we cannot use it in our company. Thanks in advance!

After updating from v2.2.0 to v2.2.4 get javascript error on load

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.

image

Unable to install. Possible dependency issue

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

defaultDocURL

Why do we have defaultDocURL = "doc.json" while "swag init " generates swagger.json by default?

cannot find type definition: address.Address

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
}

Provide swagger.json with application

	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)

Cannot make Swagger route use the correct doc.json

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 :

  • Installed swag
  • Ran swag init to initialize the ./doc directory with docs.go, swagger.json, swagger.yaml
  • Added imports to my main.go file
  • Added declarative comments to my main.go file
  • Added the default handler to my main.go file
  • Ran swag init to update the ./doc directory files

main.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 !

Manage errors

Hi,
how can I add error handling in swagger ?
regards

unknown revision codec/v1.1.5-pre

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 :/

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.