Commit 0cb79447 authored by robwa's avatar robwa
Browse files

fix: Added missing error codes according to schemathesis

parent fdc81742
......@@ -51,6 +51,12 @@ const docTemplate = `{
"$ref": "#/definitions/v1.PlaylistsListing"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/v1.ErrorResponse"
}
},
"403": {
"description": "Forbidden",
"schema": {
......@@ -101,6 +107,12 @@ const docTemplate = `{
"$ref": "#/definitions/v1.ErrorResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/v1.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
......@@ -138,6 +150,12 @@ const docTemplate = `{
"$ref": "#/definitions/v1.ShowsListing"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/v1.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
......@@ -170,8 +188,8 @@ const docTemplate = `{
}
],
"responses": {
"200": {
"description": "OK",
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/store.Show"
}
......@@ -182,6 +200,18 @@ const docTemplate = `{
"$ref": "#/definitions/v1.ErrorResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/v1.ErrorResponse"
}
},
"409": {
"description": "Conflict",
"schema": {
"$ref": "#/definitions/v1.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
......@@ -259,6 +289,12 @@ const docTemplate = `{
"$ref": "#/definitions/v1.FilesListing"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/v1.ErrorResponse"
}
},
"403": {
"description": "Forbidden",
"schema": {
......@@ -376,6 +412,12 @@ const docTemplate = `{
"$ref": "#/definitions/v1.ErrorResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/v1.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
......@@ -419,6 +461,18 @@ const docTemplate = `{
"$ref": "#/definitions/v1.ErrorResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/v1.ErrorResponse"
}
},
"409": {
"description": "Conflict",
"schema": {
"$ref": "#/definitions/v1.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
......@@ -479,6 +533,12 @@ const docTemplate = `{
"$ref": "#/definitions/v1.ErrorResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/v1.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
......@@ -642,6 +702,12 @@ const docTemplate = `{
"$ref": "#/definitions/v1.ErrorResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/v1.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
......@@ -752,6 +818,12 @@ const docTemplate = `{
"$ref": "#/definitions/v1.ErrorResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/v1.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
......@@ -855,6 +927,12 @@ const docTemplate = `{
"$ref": "#/definitions/v1.ErrorResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/v1.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
......@@ -899,6 +977,12 @@ const docTemplate = `{
"$ref": "#/definitions/v1.JobsListing"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/v1.ErrorResponse"
}
},
"403": {
"description": "Forbidden",
"schema": {
......@@ -949,6 +1033,12 @@ const docTemplate = `{
"$ref": "#/definitions/v1.PlaylistsListing"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/v1.ErrorResponse"
}
},
"403": {
"description": "Forbidden",
"schema": {
......@@ -1060,6 +1150,12 @@ const docTemplate = `{
"$ref": "#/definitions/v1.ErrorResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/v1.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
......@@ -1121,6 +1217,12 @@ const docTemplate = `{
"$ref": "#/definitions/v1.ErrorResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/v1.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
......@@ -1164,6 +1266,12 @@ const docTemplate = `{
"$ref": "#/definitions/v1.ErrorResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/v1.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
......@@ -1282,6 +1390,12 @@ const docTemplate = `{
"302": {
"description": ""
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/auth.HTTPErrorResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
......@@ -1311,6 +1425,12 @@ const docTemplate = `{
"$ref": "#/definitions/auth.Session"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/auth.HTTPErrorResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
......@@ -1379,6 +1499,12 @@ const docTemplate = `{
"type": "string"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/auth.HTTPErrorResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
......
......@@ -35,6 +35,7 @@ import (
// @Param limit query int false "Limit number of results"
// @Param offset query int false "Start listing from offset"
// @Success 200 {object} FilesListing
// @Failure 400 {object} ErrorResponse
// @Failure 403 {object} ErrorResponse
// @Failure 500 {object} ErrorResponse
// @Router /api/v1/shows/{name}/files [get]
......@@ -164,6 +165,7 @@ create_file_response:
// @Success 200 {object} store.File
// @Failure 400 {object} ErrorResponse
// @Failure 403 {object} ErrorResponse
// @Failure 404 {object} ErrorResponse
// @Failure 500 {object} ErrorResponse
// @Router /api/v1/shows/{name}/files/{id} [get]
func (api *API) ReadFileOfShow(c *gin.Context) {
......@@ -196,6 +198,7 @@ func (api *API) ReadFileOfShow(c *gin.Context) {
// @Success 200 {object} store.File
// @Failure 400 {object} ErrorResponse
// @Failure 403 {object} ErrorResponse
// @Failure 404 {object} ErrorResponse
// @Failure 500 {object} ErrorResponse
// @Router /api/v1/shows/{name}/files/{id} [patch]
func (api *API) PatchFileOfShow(c *gin.Context) {
......@@ -230,6 +233,8 @@ func (api *API) PatchFileOfShow(c *gin.Context) {
// @Success 204 {object} nil
// @Failure 400 {object} ErrorResponse
// @Failure 403 {object} ErrorResponse
// @Failure 404 {object} ErrorResponse
// @Failure 409 {object} ErrorResponse
// @Failure 500 {object} ErrorResponse
// @Router /api/v1/shows/{name}/files/{id} [delete]
func (api *API) DeleteFileOfShow(c *gin.Context) {
......@@ -262,6 +267,7 @@ func (api *API) DeleteFileOfShow(c *gin.Context) {
// @Success 200 {object} FileUsageListing
// @Failure 400 {object} ErrorResponse
// @Failure 403 {object} ErrorResponse
// @Failure 404 {object} ErrorResponse
// @Failure 500 {object} ErrorResponse
// @Router /api/v1/shows/{name}/files/{id}/usage [get]
func (api *API) ReadUsageOfFile(c *gin.Context) {
......@@ -292,6 +298,7 @@ func (api *API) ReadUsageOfFile(c *gin.Context) {
// @Success 200 {object} FileImportLogs
// @Failure 400 {object} ErrorResponse
// @Failure 403 {object} ErrorResponse
// @Failure 404 {object} ErrorResponse
// @Failure 500 {object} ErrorResponse
// @Router /api/v1/shows/{name}/files/{id}/logs [get]
func (api *API) ReadLogsOfFile(c *gin.Context) {
......
......@@ -32,6 +32,7 @@ import (
// @Param limit query int false "Limit number of results"
// @Param offset query int false "Start listing from offset"
// @Success 200 {object} JobsListing
// @Failure 400 {object} ErrorResponse
// @Failure 403 {object} ErrorResponse
// @Failure 500 {object} ErrorResponse
// @Router /api/v1/shows/{name}/imports [get]
......
......@@ -47,6 +47,7 @@ import (
// @Success 200
// @Failure 400 {object} ErrorResponse
// @Failure 403 {object} ErrorResponse
// @Failure 404 {object} ErrorResponse
// @Failure 500 {object} ErrorResponse
// @Router /api/v1/shows/{name}/files/{id}/upload [put]
func (api *API) UploadFileSimple(c *gin.Context) {
......
......@@ -34,6 +34,7 @@ import (
// @Param limit query int false "Limit number of results"
// @Param offset query int false "Start listing from offset"
// @Success 200 {object} PlaylistsListing
// @Failure 400 {object} ErrorResponse
// @Failure 403 {object} ErrorResponse
// @Failure 500 {object} ErrorResponse
// @Router /api/v1/shows/{name}/playlists [get]
......@@ -95,6 +96,7 @@ func (api *API) CreatePlaylistForShow(c *gin.Context) {
// @Success 200 {object} store.Playlist
// @Failure 400 {object} ErrorResponse
// @Failure 403 {object} ErrorResponse
// @Failure 404 {object} ErrorResponse
// @Failure 500 {object} ErrorResponse
// @Router /api/v1/shows/{name}/playlists/{id} [get]
func (api *API) ReadPlaylistOfShow(c *gin.Context) {
......@@ -127,6 +129,7 @@ func (api *API) ReadPlaylistOfShow(c *gin.Context) {
// @Success 200 {object} store.Playlist
// @Failure 400 {object} ErrorResponse
// @Failure 403 {object} ErrorResponse
// @Failure 404 {object} ErrorResponse
// @Failure 500 {object} ErrorResponse
// @Router /api/v1/shows/{name}/playlists/{id} [put]
func (api *API) UpdatePlaylistOfShow(c *gin.Context) {
......@@ -160,6 +163,7 @@ func (api *API) UpdatePlaylistOfShow(c *gin.Context) {
// @Success 204 {object} nil
// @Failure 400 {object} ErrorResponse
// @Failure 403 {object} ErrorResponse
// @Failure 404 {object} ErrorResponse
// @Failure 500 {object} ErrorResponse
// @Router /api/v1/shows/{name}/playlists/{id} [delete]
func (api *API) DeletePlaylistOfShow(c *gin.Context) {
......@@ -189,6 +193,7 @@ func (api *API) DeletePlaylistOfShow(c *gin.Context) {
// @Param limit query int false "Limit number of results"
// @Param offset query int false "Start listing from offset"
// @Success 200 {object} PlaylistsListing
// @Failure 400 {object} ErrorResponse
// @Failure 403 {object} ErrorResponse
// @Failure 500 {object} ErrorResponse
// @Router /api/v1/playlists [get]
......@@ -217,6 +222,7 @@ func (api *API) ListPlaylists(c *gin.Context) {
// @Success 200 {object} store.Playlist
// @Failure 400 {object} ErrorResponse
// @Failure 403 {object} ErrorResponse
// @Failure 404 {object} ErrorResponse
// @Failure 500 {object} ErrorResponse
// @Router /api/v1/playlists/{id} [get]
func (api *API) ReadPlaylist(c *gin.Context) {
......
......@@ -34,6 +34,7 @@ import (
// @Param limit query int false "Limit number of results"
// @Param offset query int false "Start listing from offset"
// @Success 200 {object} ShowsListing
// @Failure 400 {object} ErrorResponse
// @Failure 500 {object} ErrorResponse
// @Router /api/v1/shows [get]
func (api *API) ListShows(c *gin.Context) {
......@@ -88,8 +89,10 @@ func (api *API) ListShows(c *gin.Context) {
// @Produce json
// @Param name path string true "Name of the show to be created"
// @Param clone-from query string false "If given, all files and playlists will be copied from the show"
// @Success 200 {object} store.Show
// @Success 201 {object} store.Show
// @Failure 403 {object} ErrorResponse
// @Failure 404 {object} ErrorResponse
// @Failure 409 {object} ErrorResponse
// @Failure 500 {object} ErrorResponse
// @Router /api/v1/shows/{name} [post]
func (api *API) CreateShow(c *gin.Context) {
......
......@@ -143,6 +143,7 @@ func newSession(c *gin.Context) {
// @Description Retrieves session info.
// @Produce json
// @Success 200 {object} Session
// @Failure 400 {object} HTTPErrorResponse
// @Failure 404 {object} HTTPErrorResponse
// @Failure 408 {object} HTTPErrorResponse
// @Router /auth/session [get]
......@@ -184,6 +185,7 @@ func getSession(c *gin.Context) {
// @Description Deletes the session.
// @Produce json
// @Success 200 {object} string
// @Failure 400 {object} HTTPErrorResponse
// @Failure 401 {object} HTTPErrorResponse
// @Router /auth/session [delete]
func deleteSession(c *gin.Context) {
......
......@@ -231,6 +231,7 @@ func (b *OIDCBackend) NewSession(ctx context.Context, arguments json.RawMessage)
// @Produce json
// @Param session-id query string true "OIDC session ID"
// @Success 302
// @Failure 400 {object} HTTPErrorResponse
// @Failure 401 {object} HTTPErrorResponse
// @Failure 409 {object} HTTPErrorResponse
// @Router /auth/oidc/login [get]
......
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