Commit fed90a8c authored by robwa's avatar robwa
Browse files

fix: Use swaggertype for custom schema types

parent 92ac5b8a
...@@ -1525,13 +1525,13 @@ const docTemplate = `{ ...@@ -1525,13 +1525,13 @@ const docTemplate = `{
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"$ref": "#/definitions/main.Health2" "$ref": "#/definitions/main.Health"
} }
}, },
"503": { "503": {
"description": "Service Unavailable", "description": "Service Unavailable",
"schema": { "schema": {
"$ref": "#/definitions/main.Health2" "$ref": "#/definitions/main.Health"
} }
} }
} }
...@@ -1691,7 +1691,7 @@ const docTemplate = `{ ...@@ -1691,7 +1691,7 @@ const docTemplate = `{
} }
} }
}, },
"main.Health2": { "main.Health": {
"type": "object", "type": "object",
"properties": { "properties": {
"auth": { "auth": {
......
...@@ -109,24 +109,17 @@ func (s HealthStatus) MarshalText() (data []byte, err error) { ...@@ -109,24 +109,17 @@ func (s HealthStatus) MarshalText() (data []byte, err error) {
} }
type Health struct { type Health struct {
Auth HealthStatus `json:"auth"` Auth HealthStatus `json:"auth" swaggertype:"string"`
Store HealthStatus `json:"store"` Store HealthStatus `json:"store" swaggertype:"string"`
Importer HealthStatus `json:"importer"` Importer HealthStatus `json:"importer" swaggertype:"string"`
}
// HealthDoc is used in doc and prevents errors when checking response schema conformance with schemathesis
type HealthDoc struct {
Auth string `json:"auth"`
Store string `json:"store"`
Importer string `json:"importer"`
} }
// healthzHandler checks daemon health. // healthzHandler checks daemon health.
// @Summary Check health // @Summary Check health
// @Description Checks daemon health. // @Description Checks daemon health.
// @Produce json // @Produce json
// @Success 200 {object} HealthDoc // @Success 200 {object} Health
// @Failure 503 {object} HealthDoc // @Failure 503 {object} Health
// @Router /healthz [get] // @Router /healthz [get]
func healthzHandler(c *gin.Context, st *store.Store, im *importer.Importer) { func healthzHandler(c *gin.Context, st *store.Store, im *importer.Importer) {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) // TODO: hardcoded value ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) // TODO: hardcoded value
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment