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": [] "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": [ "consumes": [
"application/json" "application/json"
], ],
@ -62,26 +62,26 @@
}, },
{ {
"type": "integer", "type": "integer",
"description": "Page Number", "description": "Items per page (If empty: No Limit)",
"name": "page",
"in": "query"
},
{
"type": "integer",
"description": "Items per page",
"name": "items-per-page", "name": "items-per-page",
"in": "query" "in": "query"
}, },
{
"type": "integer",
"description": "Page Number (If empty: No Paging)",
"name": "page",
"in": "query"
},
{ {
"type": "boolean", "type": "boolean",
"description": "Include metadata in response", "description": "Include metadata (e.g. jobScript) in response",
"name": "with-metadata", "name": "with-metadata",
"in": "query" "in": "query"
} }
], ],
"responses": { "responses": {
"200": { "200": {
"description": "Array of jobs", "description": "Array of matching jobs",
"schema": { "schema": {
"type": "array", "type": "array",
"items": { "items": {
@ -362,7 +362,7 @@
], ],
"responses": { "responses": {
"200": { "200": {
"description": "Job resource", "description": "Updated job resource",
"schema": { "schema": {
"$ref": "#/definitions/schema.Job" "$ref": "#/definitions/schema.Job"
} }

View File

@ -362,7 +362,9 @@ paths:
get: get:
consumes: consumes:
- application/json - 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: parameters:
- description: Job State - description: Job State
enum: enum:
@ -383,15 +385,15 @@ paths:
in: query in: query
name: start-time name: start-time
type: string type: string
- description: Page Number - description: 'Items per page (If empty: No Limit)'
in: query
name: page
type: integer
- description: Items per page
in: query in: query
name: items-per-page name: items-per-page
type: integer 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 in: query
name: with-metadata name: with-metadata
type: boolean type: boolean
@ -399,7 +401,7 @@ paths:
- application/json - application/json
responses: responses:
"200": "200":
description: Array of jobs description: Array of matching jobs
schema: schema:
items: items:
$ref: '#/definitions/schema.Job' $ref: '#/definitions/schema.Job'
@ -590,7 +592,7 @@ paths:
- application/json - application/json
responses: responses:
"200": "200":
description: Job resource description: Updated job resource
schema: schema:
$ref: '#/definitions/schema.Job' $ref: '#/definitions/schema.Job'
"400": "400":

View File

@ -1,6 +1,6 @@
// Package api GENERATED BY SWAG; DO NOT EDIT // Package api GENERATED BY SWAG; DO NOT EDIT
// This file was generated by swaggo/swag at // 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 package api
import "github.com/swaggo/swag" import "github.com/swaggo/swag"
@ -33,7 +33,7 @@ const docTemplate = `{
"ApiKeyAuth": [] "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": [ "consumes": [
"application/json" "application/json"
], ],
@ -70,26 +70,26 @@ const docTemplate = `{
}, },
{ {
"type": "integer", "type": "integer",
"description": "Page Number", "description": "Items per page (If empty: No Limit)",
"name": "page",
"in": "query"
},
{
"type": "integer",
"description": "Items per page",
"name": "items-per-page", "name": "items-per-page",
"in": "query" "in": "query"
}, },
{
"type": "integer",
"description": "Page Number (If empty: No Paging)",
"name": "page",
"in": "query"
},
{ {
"type": "boolean", "type": "boolean",
"description": "Include metadata in response", "description": "Include metadata (e.g. jobScript) in response",
"name": "with-metadata", "name": "with-metadata",
"in": "query" "in": "query"
} }
], ],
"responses": { "responses": {
"200": { "200": {
"description": "Array of jobs", "description": "Array of matching jobs",
"schema": { "schema": {
"type": "array", "type": "array",
"items": { "items": {
@ -370,7 +370,7 @@ const docTemplate = `{
], ],
"responses": { "responses": {
"200": { "200": {
"description": "Job resource", "description": "Updated job resource",
"schema": { "schema": {
"$ref": "#/definitions/schema.Job" "$ref": "#/definitions/schema.Job"
} }

View File

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