Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateUser ¶
CreateUser godoc @Summary Create a new user @Description Register a new user in the system @Tags users @Accept json @Produce json @Param user body UserRequest true "User information" @Success 201 {object} UserResponse "User created" @Success 400 {object} ErrorResponse "Bad request" @Success 500 {object} ErrorResponse "Internal server error" @Router /v1/users [post]
func GetUserByID ¶
GetUserByID godoc @Summary Get user by ID @Description Retrieve a user by their unique identifier @Tags users @Accept json @Produce json @Param id path string true "User ID" @Success 200 {object} UserResponse "User found" @Success 400 {object} ErrorResponse "Bad request" @Success 404 {object} ErrorResponse "User not found" @Success 500 {object} ErrorResponse "Internal server error" @Router /v1/users/{id} [get]
Types ¶
type CommentParser ¶
type CommentParser struct {
// contains filtered or unexported fields
}
CommentParser extracts Swagger documentation from Go source files
func NewCommentParser ¶
func NewCommentParser() *CommentParser
NewCommentParser creates a new CommentParser instance
func (*CommentParser) GetHandlerMetadata ¶
func (p *CommentParser) GetHandlerMetadata(handlerName string) (map[string]interface{}, error)
GetHandlerMetadata extracts Swagger metadata from the given handler
type ErrorResponse ¶
ErrorResponse represents an error response
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator builds OpenAPI/Swagger documentation dynamically
func (*Generator) GenerateAPI ¶
func (g *Generator) GenerateAPI( routes interface{}, appName, appVersion, host, port string, ) map[string]interface{}
GenerateAPI creates an OpenAPI specification from route information
type SwaggoGenerator ¶ added in v0.3.9
type SwaggoGenerator struct {
// contains filtered or unexported fields
}
SwaggoGenerator handles programmatic swagger generation using swaggo/swag
func NewSwaggoGenerator ¶ added in v0.3.9
func NewSwaggoGenerator(projectRoot string) *SwaggoGenerator
NewSwaggoGenerator creates a new SwaggoGenerator instance
func (*SwaggoGenerator) GenerateFromGinRoutes ¶ added in v0.3.9
func (sg *SwaggoGenerator) GenerateFromGinRoutes(routes gin.RoutesInfo) ([]byte, error)
GenerateFromGinRoutes generates swagger spec from Gin routes
func (*SwaggoGenerator) GenerateSwaggerDocs ¶ added in v0.3.9
func (sg *SwaggoGenerator) GenerateSwaggerDocs() ([]byte, error)
GenerateSwaggerDocs generates swagger documentation using the registered swag info
func (*SwaggoGenerator) SetHostAndPort ¶ added in v0.3.9
func (sg *SwaggoGenerator) SetHostAndPort(host, port string)
SetHostAndPort updates the host and port for the generator
type UserRequest ¶
type UserRequest struct {
Username string `json:"username" binding:"required"`
FullName string `json:"full_name" binding:"required"`
Email string `json:"email" binding:"required,email"`
Password string `json:"password" binding:"required,min=8"`
}
UserRequest represents a request to create a user
type UserResponse ¶
type UserResponse struct {
ID string `json:"id"`
Username string `json:"username"`
FullName string `json:"full_name"`
Email string `json:"email"`
CreatedAt string `json:"created_at,omitempty"`
UpdatedAt string `json:"updated_at,omitempty"`
}
UserResponse represents a user in the system