Skip to content

Commit

Permalink
#44 Updated swag CLI to fix differences in generated specs
Browse files Browse the repository at this point in the history
  • Loading branch information
roma-glushko committed Jan 14, 2024
1 parent 00499bf commit 292c620
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 48 deletions.
8 changes: 4 additions & 4 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,12 +318,12 @@ const docTemplate = `{
"routing.Strategy": {
"type": "string",
"enum": [
"priority",
"round-robin"
"round-robin",
"priority"
],
"x-enum-varnames": [
"Priority",
"RoundRobin"
"RoundRobin",
"Priority"
]
},
"schemas.ChatMessage": {
Expand Down
8 changes: 4 additions & 4 deletions docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -315,12 +315,12 @@
"routing.Strategy": {
"type": "string",
"enum": [
"priority",
"round-robin"
"round-robin",
"priority"
],
"x-enum-varnames": [
"Priority",
"RoundRobin"
"RoundRobin",
"Priority"
]
},
"schemas.ChatMessage": {
Expand Down
4 changes: 2 additions & 2 deletions docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,12 @@ definitions:
type: object
routing.Strategy:
enum:
- priority
- round-robin
- priority
type: string
x-enum-varnames:
- Priority
- RoundRobin
- Priority
schemas.ChatMessage:
properties:
content:
Expand Down
20 changes: 10 additions & 10 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ import (
"glide/pkg/cmd"
)

// @title Glide Gateway
// @version 1.0
// @description API documentation for Glide, an open-source lightweight high-performance model gateway
// @title Glide Gateway
// @version 1.0
// @description API documentation for Glide, an open-source lightweight high-performance model gateway

// @contact.name Glide Community
// @contact.url https://github.com/modelgateway/glide
// @contact.name Glide Community
// @contact.url https://github.com/modelgateway/glide

// @license.name Apache 2.0
// @license.url https://github.com/modelgateway/glide/blob/develop/LICENSE
// @license.name Apache 2.0
// @license.url https://github.com/modelgateway/glide/blob/develop/LICENSE

// @host localhost:9099
// @BasePath /
// @schemes http
// @host localhost:9099
// @BasePath /
// @schemes http
func main() {
cli := cmd.NewCLI()

Expand Down
56 changes: 28 additions & 28 deletions pkg/api/http/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ type Handler = func(ctx context.Context, c *app.RequestContext)
// - https://github.com/swaggo/swag/tree/master/example/celler

// LangChatHandler
// @id glide-language-chat
// @Summary Language Chat
// @Description Talk to different LLMs Chat API via unified endpoint
// @tags Language
// @Param router path string true "Router ID"
// @Param payload body schemas.UnifiedChatRequest true "Request Data"
// @Accept json
// @Produce json
// @Success 200 {object} schemas.UnifiedChatResponse
// @Failure 400 {object} http.ErrorSchema
// @Failure 404 {object} http.ErrorSchema
// @Router /v1/language/{router}/chat [POST]
// @id glide-language-chat
// @Summary Language Chat
// @Description Talk to different LLMs Chat API via unified endpoint
// @tags Language
// @Param router path string true "Router ID"
// @Param payload body schemas.UnifiedChatRequest true "Request Data"
// @Accept json
// @Produce json
// @Success 200 {object} schemas.UnifiedChatResponse
// @Failure 400 {object} http.ErrorSchema
// @Failure 404 {object} http.ErrorSchema
// @Router /v1/language/{router}/chat [POST]
func LangChatHandler(routerManager *routers.RouterManager) Handler {
return func(ctx context.Context, c *app.RequestContext) {
var req *schemas.UnifiedChatRequest
Expand Down Expand Up @@ -67,14 +67,14 @@ func LangChatHandler(routerManager *routers.RouterManager) Handler {
}

// LangRoutersHandler
// @id glide-language-routers
// @Summary Language Router List
// @Description Retrieve list of configured language routers and their configurations
// @tags Language
// @Accept json
// @Produce json
// @Success 200 {object} http.RouterListSchema
// @Router /v1/language/ [GET]
// @id glide-language-routers
// @Summary Language Router List
// @Description Retrieve list of configured language routers and their configurations
// @tags Language
// @Accept json
// @Produce json
// @Success 200 {object} http.RouterListSchema
// @Router /v1/language/ [GET]
func LangRoutersHandler(routerManager *routers.RouterManager) Handler {
return func(ctx context.Context, c *app.RequestContext) {
configuredRouters := routerManager.GetLangRouters()
Expand All @@ -89,14 +89,14 @@ func LangRoutersHandler(routerManager *routers.RouterManager) Handler {
}

// HealthHandler
// @id glide-health
// @Summary Gateway Health
// @Description
// @tags Operations
// @Accept json
// @Produce json
// @Success 200 {object} http.HealthSchema
// @Router /v1/health/ [get]
// @id glide-health
// @Summary Gateway Health
// @Description
// @tags Operations
// @Accept json
// @Produce json
// @Success 200 {object} http.HealthSchema
// @Router /v1/health/ [get]
func HealthHandler(_ context.Context, c *app.RequestContext) {
c.JSON(consts.StatusOK, HealthSchema{Healthy: true})
}

0 comments on commit 292c620

Please sign in to comment.