api

package
v0.0.0-...-2b4f61d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// URLParamsRegex is a regular expression to match URL parameters in the openapi spec format (e.g. {id}).
	// It allows to replace the parameters with the gin-gonic format (e.g. :id).
	URLParamsRegex = regexp.MustCompile(`\{([a-zA-Z0-9]+)\}`)
)

Functions

func Annotate

func Annotate(t *openapi3.T)

func Handle_CreateNewUserRequest

func Handle_CreateNewUserRequest(c *fiber.Ctx) error

func Handle_GetUserRequest

func Handle_GetUserRequest(c *fiber.Ctx) error

func Handle_GetUsersRequest

func Handle_GetUsersRequest(c *fiber.Ctx) error

func Handle_UpdateUserRequest

func Handle_UpdateUserRequest(c *fiber.Ctx) error

func Mount

func Mount(app *fiber.App)

Types

type CreateNewUserRequest

type CreateNewUserRequest struct {
	Name string `json:"name" validate:"required"`
	Age  int    `json:"age" validate:"required,gte=18"`
}

type CreateNewUserResponse

type CreateNewUserResponse struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Age  int    `json:"age"`
}

type DetailedURLParameters

type DetailedURLParameters struct {
	UserID string `json:"id" validate:"required"`
}

type GetUserResponse

type GetUserResponse struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Age  int    `json:"age"`
}

type GetUsersQueryParameters

type GetUsersQueryParameters struct {
	Offset int `json:"offset"`
	Limit  int `json:"limit"`
}

type GetUsersResponse

type GetUsersResponse struct {
	Total int               `json:"total"`
	Docs  []GetUserResponse `json:"docs"`
}

type UpdateUserRequest

type UpdateUserRequest struct {
	Name string `json:"name" validate:"required"`
	Age  int    `json:"age" validate:"required,gte=18"`
}

type UpdateUserResponse

type UpdateUserResponse struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Age  int    `json:"age"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL