Skip to content

Commit

Permalink
#235: Updated OpenAPI specs
Browse files Browse the repository at this point in the history
  • Loading branch information
roma-glushko committed May 5, 2024
1 parent 99f5bb8 commit 1c529ff
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 37 deletions.
27 changes: 15 additions & 12 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const docTemplate = `{
},
"/v1/language/": {
"get": {
"description": "Retrieve list of configured language routers and their configurations",
"description": "Retrieve list of configured active language routers and their configurations",
"consumes": [
"application/json"
],
Expand Down Expand Up @@ -112,13 +112,13 @@ const docTemplate = `{
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/http.ErrorSchema"
"$ref": "#/definitions/schemas.Error"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/http.ErrorSchema"
"$ref": "#/definitions/schemas.Error"
}
}
}
Expand Down Expand Up @@ -179,7 +179,7 @@ const docTemplate = `{
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/http.ErrorSchema"
"$ref": "#/definitions/schemas.Error"
}
},
"426": {
Expand Down Expand Up @@ -460,14 +460,6 @@ const docTemplate = `{
}
}
},
"http.ErrorSchema": {
"type": "object",
"properties": {
"message": {
"type": "string"
}
}
},
"http.HealthSchema": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -885,6 +877,17 @@ const docTemplate = `{
}
}
},
"schemas.Error": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"schemas.ModelResponse": {
"type": "object",
"properties": {
Expand Down
27 changes: 15 additions & 12 deletions docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
},
"/v1/language/": {
"get": {
"description": "Retrieve list of configured language routers and their configurations",
"description": "Retrieve list of configured active language routers and their configurations",
"consumes": [
"application/json"
],
Expand Down Expand Up @@ -109,13 +109,13 @@
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/http.ErrorSchema"
"$ref": "#/definitions/schemas.Error"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/http.ErrorSchema"
"$ref": "#/definitions/schemas.Error"
}
}
}
Expand Down Expand Up @@ -176,7 +176,7 @@
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/http.ErrorSchema"
"$ref": "#/definitions/schemas.Error"
}
},
"426": {
Expand Down Expand Up @@ -457,14 +457,6 @@
}
}
},
"http.ErrorSchema": {
"type": "object",
"properties": {
"message": {
"type": "string"
}
}
},
"http.HealthSchema": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -882,6 +874,17 @@
}
}
},
"schemas.Error": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"schemas.ModelResponse": {
"type": "object",
"properties": {
Expand Down
20 changes: 11 additions & 9 deletions docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,6 @@ definitions:
required:
- temperature
type: object
http.ErrorSchema:
properties:
message:
type: string
type: object
http.HealthSchema:
properties:
healthy:
Expand Down Expand Up @@ -475,6 +470,13 @@ definitions:
router:
type: string
type: object
schemas.Error:
properties:
message:
type: string
name:
type: string
type: object
schemas.ModelResponse:
properties:
message:
Expand Down Expand Up @@ -541,7 +543,7 @@ paths:
get:
consumes:
- application/json
description: Retrieve list of configured language routers and their configurations
description: Retrieve list of configured active language routers and their configurations
operationId: glide-language-routers
produces:
- application/json
Expand Down Expand Up @@ -581,11 +583,11 @@ paths:
"400":
description: Bad Request
schema:
$ref: '#/definitions/http.ErrorSchema'
$ref: '#/definitions/schemas.Error'
"404":
description: Not Found
schema:
$ref: '#/definitions/http.ErrorSchema'
$ref: '#/definitions/schemas.Error'
summary: Language Chat
tags:
- Language
Expand Down Expand Up @@ -628,7 +630,7 @@ paths:
"404":
description: Not Found
schema:
$ref: '#/definitions/http.ErrorSchema'
$ref: '#/definitions/schemas.Error'
"426":
description: Upgrade Required
summary: Language Chat
Expand Down
8 changes: 4 additions & 4 deletions pkg/api/http/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ type Handler = func(c *fiber.Ctx) error
// @Accept json
// @Produce json
// @Success 200 {object} schemas.ChatResponse
// @Failure 400 {object} http.ErrorSchema
// @Failure 404 {object} http.ErrorSchema
// @Failure 400 {object} schemas.Error
// @Failure 404 {object} schemas.Error
// @Router /v1/language/{router}/chat [POST]
func LangChatHandler(routerManager *routers.RouterManager) Handler {
return func(c *fiber.Ctx) error {
Expand Down Expand Up @@ -104,7 +104,7 @@ func LangStreamRouterValidator(routerManager *routers.RouterManager) Handler {
// @Accept json
// @Success 101
// @Failure 426
// @Failure 404 {object} http.ErrorSchema
// @Failure 404 {object} schemas.Error
// @Router /v1/language/{router}/chatStream [GET]
func LangStreamChatHandler(tel *telemetry.Telemetry, routerManager *routers.RouterManager) Handler {
// TODO: expose websocket connection configs https://github.com/gofiber/contrib/tree/main/websocket
Expand Down Expand Up @@ -167,7 +167,7 @@ func LangStreamChatHandler(tel *telemetry.Telemetry, routerManager *routers.Rout
//
// @id glide-language-routers
// @Summary Language Router List
// @Description Retrieve list of configured language routers and their configurations
// @Description Retrieve list of configured active language routers and their configurations
// @tags Language
// @Accept json
// @Produce json
Expand Down

0 comments on commit 1c529ff

Please sign in to comment.