Small additions to 'getJobs' API docs

This commit is contained in:
Christoph Kluge 2022-09-22 13:32:40 +02:00
parent 93713edcac
commit b96c515c2c
4 changed files with 40 additions and 37 deletions

View File

@ -25,7 +25,7 @@
"ApiKeyAuth": []
}
],
"description": "Get a list of all jobs. Filters can be applied using query parameters.",
"description": "Get a list of all jobs. Filters can be applied using query parameters.\nNumber of results can be limited by page. Results are sorted by descending startTime.",
"consumes": [
"application/json"
],
@ -62,26 +62,26 @@
},
{
"type": "integer",
"description": "Page Number",
"name": "page",
"in": "query"
},
{
"type": "integer",
"description": "Items per page",
"description": "Items per page (If empty: No Limit)",
"name": "items-per-page",
"in": "query"
},
{
"type": "integer",
"description": "Page Number (If empty: No Paging)",
"name": "page",
"in": "query"
},
{
"type": "boolean",
"description": "Include metadata in response",
"description": "Include metadata (e.g. jobScript) in response",
"name": "with-metadata",
"in": "query"
}
],
"responses": {
"200": {
"description": "Array of jobs",
"description": "Array of matching jobs",
"schema": {
"type": "array",
"items": {
@ -362,7 +362,7 @@
],
"responses": {
"200": {
"description": "Job resource",
"description": "Updated job resource",
"schema": {
"$ref": "#/definitions/schema.Job"
}

View File

@ -362,7 +362,9 @@ paths:
get:
consumes:
- application/json
description: Get a list of all jobs. Filters can be applied using query parameters.
description: |-
Get a list of all jobs. Filters can be applied using query parameters.
Number of results can be limited by page. Results are sorted by descending startTime.
parameters:
- description: Job State
enum:
@ -383,15 +385,15 @@ paths:
in: query
name: start-time
type: string
- description: Page Number
in: query
name: page
type: integer
- description: Items per page
- description: 'Items per page (If empty: No Limit)'
in: query
name: items-per-page
type: integer
- description: Include metadata in response
- description: 'Page Number (If empty: No Paging)'
in: query
name: page
type: integer
- description: Include metadata (e.g. jobScript) in response
in: query
name: with-metadata
type: boolean
@ -399,7 +401,7 @@ paths:
- application/json
responses:
"200":
description: Array of jobs
description: Array of matching jobs
schema:
items:
$ref: '#/definitions/schema.Job'
@ -590,7 +592,7 @@ paths:
- application/json
responses:
"200":
description: Job resource
description: Updated job resource
schema:
$ref: '#/definitions/schema.Job'
"400":

View File

@ -1,6 +1,6 @@
// Package api GENERATED BY SWAG; DO NOT EDIT
// This file was generated by swaggo/swag at
// 2022-09-21 17:13:02.799543712 +0200 CEST m=+0.123569150
// 2022-09-22 13:31:53.353204065 +0200 CEST m=+0.139444562
package api
import "github.com/swaggo/swag"
@ -33,7 +33,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
"description": "Get a list of all jobs. Filters can be applied using query parameters.",
"description": "Get a list of all jobs. Filters can be applied using query parameters.\nNumber of results can be limited by page. Results are sorted by descending startTime.",
"consumes": [
"application/json"
],
@ -70,26 +70,26 @@ const docTemplate = `{
},
{
"type": "integer",
"description": "Page Number",
"name": "page",
"in": "query"
},
{
"type": "integer",
"description": "Items per page",
"description": "Items per page (If empty: No Limit)",
"name": "items-per-page",
"in": "query"
},
{
"type": "integer",
"description": "Page Number (If empty: No Paging)",
"name": "page",
"in": "query"
},
{
"type": "boolean",
"description": "Include metadata in response",
"description": "Include metadata (e.g. jobScript) in response",
"name": "with-metadata",
"in": "query"
}
],
"responses": {
"200": {
"description": "Array of jobs",
"description": "Array of matching jobs",
"schema": {
"type": "array",
"items": {
@ -370,7 +370,7 @@ const docTemplate = `{
],
"responses": {
"200": {
"description": "Job resource",
"description": "Updated job resource",
"schema": {
"$ref": "#/definitions/schema.Job"
}

View File

@ -144,15 +144,16 @@ func decode(r io.Reader, val interface{}) error {
// getJobs godoc
// @Summary Lists all jobs
// @Description Get a list of all jobs. Filters can be applied using query parameters.
// @Description Number of results can be limited by page. Results are sorted by descending startTime.
// @Accept json
// @Produce json
// @Param state query string false "Job State" Enums(running, completed, failed, cancelled, stopped, timeout)
// @Param cluster query string false "Job Cluster"
// @Param start-time query string false "Syntax: '$from-$to', as unix epoch timestamps in seconds"
// @Param page query int false "Page Number"
// @Param items-per-page query int false "Items per page"
// @Param with-metadata query bool false "Include metadata in response"
// @Success 200 {array} schema.Job "Array of jobs"
// @Param items-per-page query int false "Items per page (If empty: No Limit)"
// @Param page query int false "Page Number (If empty: No Paging)"
// @Param with-metadata query bool false "Include metadata (e.g. jobScript) in response"
// @Success 200 {array} schema.Job "Array of matching jobs"
// @Failure 400 {object} api.ErrorResponse "Bad Request"
// @Failure 401 {object} api.ErrorResponse "Unauthorized"
// @Failure 500 {object} api.ErrorResponse "Internal Server Error"
@ -275,7 +276,7 @@ func (api *RestApi) getJobs(rw http.ResponseWriter, r *http.Request) {
// @Produce json
// @Param id path int true "Job Database ID"
// @Param request body api.TagJobApiRequest true "Array of tag-objects to add"
// @Success 200 {object} schema.Job "Job resource"
// @Success 200 {object} schema.Job "Updated job resource"
// @Failure 400 {object} api.ErrorResponse "Bad Request"
// @Failure 401 {object} api.ErrorResponse "Unauthorized"
// @Failure 404 {object} api.ErrorResponse "Job or tag does not exist"