Giter Site home page Giter Site logo

long2ice / fibers Goto Github PK

View Code? Open in Web Editor NEW
24.0 3.0 4.0 1.08 MB

Fiber + Swagger = Fibers, a web framework dedicated to providing a FastAPI-like development experience

Home Page: https://fibers.long2ice.io/docs

License: Apache License 2.0

Go 94.80% HTML 3.33% Dockerfile 1.07% Makefile 0.80%
fiber swagger fastapi redoc openapi swagger-ui golang

fibers's Introduction

👋 Hello! I'm long2ice

I'm a backend engineer and use Python & Go mainly, love open source.

❤️ Sponsor me

long2ice's github stats

Top Langs

My Projects

tortoise-ormaerich

fastapi-admin

fibers's People

Contributors

long2ice avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

fibers's Issues

有没有可能支持一下非请求结构体的方法作为handle的场景?

在v2看到帖子想尝试一下,然后发现按照readme的例子的话,所有的路由都必须用一个结构体接收请求信息,然后用结构体的一个方法作为实际的路由。

但我的handler已经定义成了结构体的一个方法(Handler{log,cache,metrics...}.GetUser(*fiber.Ctx) error),我的log等等基础组件都绑在这个结构体上,也不可能移到别的地方去。这样一来就没办法跟这个库一起使用。

有没有可能支持一下?

Support const enums

When I used Swaggo, I was able to do something like this:

type PaginationModel struct {
	Search   string  
	Take     int  
	Page     int    
	SortOrder SortOrder
}

type SortOrder string

const (
	SortOrderAsc  SortOrder = "asc"
	SortOrderDesc SortOrder = "desc"
)

this is the result:
image
I was able to select an enum from the dropdown list in Swagger UI.

But when I try this in fibers

type PaginationModel struct {
	Search    string    `query:"search"`
	Take      int       `query:"take"`
	Page      int       `query:"page"`
	SortOrder SortOrder `query:"sortOrder"`
}

type SortOrder string

const (
	SortOrderAsc  SortOrder = "asc"
	SortOrderDesc SortOrder = "desc"
)

it gives me a stack overflow

runtime: goroutine stack exceeds 1000000000-byte limit
runtime: sp=0xc020680360 stack=[0xc020680000, 0xc040680000]
fatal error: stack overflow

I tried using validate:"oneof=asc desc", it didn't render a dropdown list, and it would be painful to enter every value if I have a lot of const enums, for example: database table fields.

Inject custom validator

Would it be possible to inject my own validator ?
I have defined a few custom validators but with the current version, I am stuck doing a second validation.

var validate = validator.New()

Thanks !

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.