Rebuild GraphQL api and Swagger UI code.

This commit is contained in:
Jan Eitzinger 2023-02-21 18:13:16 +01:00
parent 6c0d192662
commit 60437ce264
6 changed files with 108 additions and 81 deletions

View File

@ -708,8 +708,7 @@
"example": 123000 "example": 123000
}, },
"jobState": { "jobState": {
"description": "Final state of job", "description": "Final job state",
"type": "string",
"enum": [ "enum": [
"completed", "completed",
"failed", "failed",
@ -717,6 +716,11 @@
"stopped", "stopped",
"timeout" "timeout"
], ],
"allOf": [
{
"$ref": "#/definitions/schema.JobState"
}
],
"example": "completed" "example": "completed"
}, },
"startTime": { "startTime": {
@ -769,7 +773,6 @@
}, },
"jobState": { "jobState": {
"description": "Final state of job", "description": "Final state of job",
"type": "string",
"enum": [ "enum": [
"completed", "completed",
"failed", "failed",
@ -778,6 +781,11 @@
"timeout", "timeout",
"out_of_memory" "out_of_memory"
], ],
"allOf": [
{
"$ref": "#/definitions/schema.JobState"
}
],
"example": "completed" "example": "completed"
}, },
"metaData": { "metaData": {
@ -901,7 +909,6 @@
}, },
"jobState": { "jobState": {
"description": "Final state of job", "description": "Final state of job",
"type": "string",
"enum": [ "enum": [
"completed", "completed",
"failed", "failed",
@ -910,6 +917,11 @@
"timeout", "timeout",
"out_of_memory" "out_of_memory"
], ],
"allOf": [
{
"$ref": "#/definitions/schema.JobState"
}
],
"example": "completed" "example": "completed"
}, },
"metaData": { "metaData": {
@ -1004,6 +1016,29 @@
} }
} }
}, },
"schema.JobState": {
"type": "string",
"enum": [
"running",
"completed",
"failed",
"cancelled",
"stopped",
"timeout",
"preempted",
"out_of_memory"
],
"x-enum-varnames": [
"JobStateRunning",
"JobStateCompleted",
"JobStateFailed",
"JobStateCancelled",
"JobStateStopped",
"JobStateTimeout",
"JobStatePreempted",
"JobStateOutOfMemory"
]
},
"schema.JobStatistics": { "schema.JobStatistics": {
"description": "Specification for job metric statistics.", "description": "Specification for job metric statistics.",
"type": "object", "type": "object",

View File

@ -59,7 +59,9 @@ definitions:
example: 123000 example: 123000
type: integer type: integer
jobState: jobState:
description: Final state of job allOf:
- $ref: '#/definitions/schema.JobState'
description: Final job state
enum: enum:
- completed - completed
- failed - failed
@ -67,7 +69,6 @@ definitions:
- stopped - stopped
- timeout - timeout
example: completed example: completed
type: string
startTime: startTime:
description: Start Time of job as epoch description: Start Time of job as epoch
example: 1649723812 example: 1649723812
@ -112,6 +113,8 @@ definitions:
example: 123000 example: 123000
type: integer type: integer
jobState: jobState:
allOf:
- $ref: '#/definitions/schema.JobState'
description: Final state of job description: Final state of job
enum: enum:
- completed - completed
@ -121,7 +124,6 @@ definitions:
- timeout - timeout
- out_of_memory - out_of_memory
example: completed example: completed
type: string
metaData: metaData:
additionalProperties: additionalProperties:
type: string type: string
@ -220,6 +222,8 @@ definitions:
example: 123000 example: 123000
type: integer type: integer
jobState: jobState:
allOf:
- $ref: '#/definitions/schema.JobState'
description: Final state of job description: Final state of job
enum: enum:
- completed - completed
@ -229,7 +233,6 @@ definitions:
- timeout - timeout
- out_of_memory - out_of_memory
example: completed example: completed
type: string
metaData: metaData:
additionalProperties: additionalProperties:
type: string type: string
@ -303,6 +306,26 @@ definitions:
minimum: 1 minimum: 1
type: integer type: integer
type: object type: object
schema.JobState:
enum:
- running
- completed
- failed
- cancelled
- stopped
- timeout
- preempted
- out_of_memory
type: string
x-enum-varnames:
- JobStateRunning
- JobStateCompleted
- JobStateFailed
- JobStateCancelled
- JobStateStopped
- JobStateTimeout
- JobStatePreempted
- JobStateOutOfMemory
schema.JobStatistics: schema.JobStatistics:
description: Specification for job metric statistics. description: Specification for job metric statistics.
properties: properties:

View File

@ -1,5 +1,4 @@
// Package api GENERATED BY SWAG; DO NOT EDIT // Code generated by swaggo/swag. DO NOT EDIT
// This file was generated by swaggo/swag
package api package api
import "github.com/swaggo/swag" import "github.com/swaggo/swag"
@ -715,8 +714,7 @@ const docTemplate = `{
"example": 123000 "example": 123000
}, },
"jobState": { "jobState": {
"description": "Final state of job", "description": "Final job state",
"type": "string",
"enum": [ "enum": [
"completed", "completed",
"failed", "failed",
@ -724,6 +722,11 @@ const docTemplate = `{
"stopped", "stopped",
"timeout" "timeout"
], ],
"allOf": [
{
"$ref": "#/definitions/schema.JobState"
}
],
"example": "completed" "example": "completed"
}, },
"startTime": { "startTime": {
@ -776,7 +779,6 @@ const docTemplate = `{
}, },
"jobState": { "jobState": {
"description": "Final state of job", "description": "Final state of job",
"type": "string",
"enum": [ "enum": [
"completed", "completed",
"failed", "failed",
@ -785,6 +787,11 @@ const docTemplate = `{
"timeout", "timeout",
"out_of_memory" "out_of_memory"
], ],
"allOf": [
{
"$ref": "#/definitions/schema.JobState"
}
],
"example": "completed" "example": "completed"
}, },
"metaData": { "metaData": {
@ -908,7 +915,6 @@ const docTemplate = `{
}, },
"jobState": { "jobState": {
"description": "Final state of job", "description": "Final state of job",
"type": "string",
"enum": [ "enum": [
"completed", "completed",
"failed", "failed",
@ -917,6 +923,11 @@ const docTemplate = `{
"timeout", "timeout",
"out_of_memory" "out_of_memory"
], ],
"allOf": [
{
"$ref": "#/definitions/schema.JobState"
}
],
"example": "completed" "example": "completed"
}, },
"metaData": { "metaData": {
@ -1011,6 +1022,29 @@ const docTemplate = `{
} }
} }
}, },
"schema.JobState": {
"type": "string",
"enum": [
"running",
"completed",
"failed",
"cancelled",
"stopped",
"timeout",
"preempted",
"out_of_memory"
],
"x-enum-varnames": [
"JobStateRunning",
"JobStateCompleted",
"JobStateFailed",
"JobStateCancelled",
"JobStateStopped",
"JobStateTimeout",
"JobStatePreempted",
"JobStateOutOfMemory"
]
},
"schema.JobStatistics": { "schema.JobStatistics": {
"description": "Specification for job metric statistics.", "description": "Specification for job metric statistics.",
"type": "object", "type": "object",

View File

@ -5484,7 +5484,6 @@ func (ec *executionContext) _Mutation_createTag(ctx context.Context, field graph
}) })
if err != nil { if err != nil {
ec.Error(ctx, err) ec.Error(ctx, err)
return graphql.Null
} }
if resTmp == nil { if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) { if !graphql.HasFieldError(ctx, fc) {
@ -5547,7 +5546,6 @@ func (ec *executionContext) _Mutation_deleteTag(ctx context.Context, field graph
}) })
if err != nil { if err != nil {
ec.Error(ctx, err) ec.Error(ctx, err)
return graphql.Null
} }
if resTmp == nil { if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) { if !graphql.HasFieldError(ctx, fc) {
@ -5602,7 +5600,6 @@ func (ec *executionContext) _Mutation_addTagsToJob(ctx context.Context, field gr
}) })
if err != nil { if err != nil {
ec.Error(ctx, err) ec.Error(ctx, err)
return graphql.Null
} }
if resTmp == nil { if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) { if !graphql.HasFieldError(ctx, fc) {
@ -5665,7 +5662,6 @@ func (ec *executionContext) _Mutation_removeTagsFromJob(ctx context.Context, fie
}) })
if err != nil { if err != nil {
ec.Error(ctx, err) ec.Error(ctx, err)
return graphql.Null
} }
if resTmp == nil { if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) { if !graphql.HasFieldError(ctx, fc) {
@ -5728,7 +5724,6 @@ func (ec *executionContext) _Mutation_updateConfiguration(ctx context.Context, f
}) })
if err != nil { if err != nil {
ec.Error(ctx, err) ec.Error(ctx, err)
return graphql.Null
} }
if resTmp == nil { if resTmp == nil {
return graphql.Null return graphql.Null
@ -5918,7 +5913,6 @@ func (ec *executionContext) _Query_clusters(ctx context.Context, field graphql.C
}) })
if err != nil { if err != nil {
ec.Error(ctx, err) ec.Error(ctx, err)
return graphql.Null
} }
if resTmp == nil { if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) { if !graphql.HasFieldError(ctx, fc) {
@ -5972,7 +5966,6 @@ func (ec *executionContext) _Query_tags(ctx context.Context, field graphql.Colle
}) })
if err != nil { if err != nil {
ec.Error(ctx, err) ec.Error(ctx, err)
return graphql.Null
} }
if resTmp == nil { if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) { if !graphql.HasFieldError(ctx, fc) {
@ -6024,7 +6017,6 @@ func (ec *executionContext) _Query_user(ctx context.Context, field graphql.Colle
}) })
if err != nil { if err != nil {
ec.Error(ctx, err) ec.Error(ctx, err)
return graphql.Null
} }
if resTmp == nil { if resTmp == nil {
return graphql.Null return graphql.Null
@ -6084,7 +6076,6 @@ func (ec *executionContext) _Query_allocatedNodes(ctx context.Context, field gra
}) })
if err != nil { if err != nil {
ec.Error(ctx, err) ec.Error(ctx, err)
return graphql.Null
} }
if resTmp == nil { if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) { if !graphql.HasFieldError(ctx, fc) {
@ -6145,7 +6136,6 @@ func (ec *executionContext) _Query_job(ctx context.Context, field graphql.Collec
}) })
if err != nil { if err != nil {
ec.Error(ctx, err) ec.Error(ctx, err)
return graphql.Null
} }
if resTmp == nil { if resTmp == nil {
return graphql.Null return graphql.Null
@ -6245,7 +6235,6 @@ func (ec *executionContext) _Query_jobMetrics(ctx context.Context, field graphql
}) })
if err != nil { if err != nil {
ec.Error(ctx, err) ec.Error(ctx, err)
return graphql.Null
} }
if resTmp == nil { if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) { if !graphql.HasFieldError(ctx, fc) {
@ -6306,7 +6295,6 @@ func (ec *executionContext) _Query_jobsFootprints(ctx context.Context, field gra
}) })
if err != nil { if err != nil {
ec.Error(ctx, err) ec.Error(ctx, err)
return graphql.Null
} }
if resTmp == nil { if resTmp == nil {
return graphql.Null return graphql.Null
@ -6364,7 +6352,6 @@ func (ec *executionContext) _Query_jobs(ctx context.Context, field graphql.Colle
}) })
if err != nil { if err != nil {
ec.Error(ctx, err) ec.Error(ctx, err)
return graphql.Null
} }
if resTmp == nil { if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) { if !graphql.HasFieldError(ctx, fc) {
@ -6429,7 +6416,6 @@ func (ec *executionContext) _Query_jobsStatistics(ctx context.Context, field gra
}) })
if err != nil { if err != nil {
ec.Error(ctx, err) ec.Error(ctx, err)
return graphql.Null
} }
if resTmp == nil { if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) { if !graphql.HasFieldError(ctx, fc) {
@ -6502,7 +6488,6 @@ func (ec *executionContext) _Query_jobsCount(ctx context.Context, field graphql.
}) })
if err != nil { if err != nil {
ec.Error(ctx, err) ec.Error(ctx, err)
return graphql.Null
} }
if resTmp == nil { if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) { if !graphql.HasFieldError(ctx, fc) {
@ -6563,7 +6548,6 @@ func (ec *executionContext) _Query_rooflineHeatmap(ctx context.Context, field gr
}) })
if err != nil { if err != nil {
ec.Error(ctx, err) ec.Error(ctx, err)
return graphql.Null
} }
if resTmp == nil { if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) { if !graphql.HasFieldError(ctx, fc) {
@ -6618,7 +6602,6 @@ func (ec *executionContext) _Query_nodeMetrics(ctx context.Context, field graphq
}) })
if err != nil { if err != nil {
ec.Error(ctx, err) ec.Error(ctx, err)
return graphql.Null
} }
if resTmp == nil { if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) { if !graphql.HasFieldError(ctx, fc) {
@ -6681,7 +6664,6 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col
}) })
if err != nil { if err != nil {
ec.Error(ctx, err) ec.Error(ctx, err)
return graphql.Null
} }
if resTmp == nil { if resTmp == nil {
return graphql.Null return graphql.Null
@ -6755,7 +6737,6 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C
}) })
if err != nil { if err != nil {
ec.Error(ctx, err) ec.Error(ctx, err)
return graphql.Null
} }
if resTmp == nil { if resTmp == nil {
return graphql.Null return graphql.Null
@ -11617,7 +11598,6 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet)
}) })
out := graphql.NewFieldSet(fields) out := graphql.NewFieldSet(fields)
var invalids uint32
for i, field := range fields { for i, field := range fields {
innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{
Object: field.Name, Object: field.Name,
@ -11633,36 +11613,24 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet)
return ec._Mutation_createTag(ctx, field) return ec._Mutation_createTag(ctx, field)
}) })
if out.Values[i] == graphql.Null {
invalids++
}
case "deleteTag": case "deleteTag":
out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
return ec._Mutation_deleteTag(ctx, field) return ec._Mutation_deleteTag(ctx, field)
}) })
if out.Values[i] == graphql.Null {
invalids++
}
case "addTagsToJob": case "addTagsToJob":
out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
return ec._Mutation_addTagsToJob(ctx, field) return ec._Mutation_addTagsToJob(ctx, field)
}) })
if out.Values[i] == graphql.Null {
invalids++
}
case "removeTagsFromJob": case "removeTagsFromJob":
out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
return ec._Mutation_removeTagsFromJob(ctx, field) return ec._Mutation_removeTagsFromJob(ctx, field)
}) })
if out.Values[i] == graphql.Null {
invalids++
}
case "updateConfiguration": case "updateConfiguration":
out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
@ -11674,9 +11642,6 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet)
} }
} }
out.Dispatch() out.Dispatch()
if invalids > 0 {
return graphql.Null
}
return out return out
} }
@ -11731,7 +11696,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr
}) })
out := graphql.NewFieldSet(fields) out := graphql.NewFieldSet(fields)
var invalids uint32
for i, field := range fields { for i, field := range fields {
innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{
Object: field.Name, Object: field.Name,
@ -11751,9 +11715,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr
} }
}() }()
res = ec._Query_clusters(ctx, field) res = ec._Query_clusters(ctx, field)
if res == graphql.Null {
atomic.AddUint32(&invalids, 1)
}
return res return res
} }
@ -11774,9 +11735,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr
} }
}() }()
res = ec._Query_tags(ctx, field) res = ec._Query_tags(ctx, field)
if res == graphql.Null {
atomic.AddUint32(&invalids, 1)
}
return res return res
} }
@ -11817,9 +11775,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr
} }
}() }()
res = ec._Query_allocatedNodes(ctx, field) res = ec._Query_allocatedNodes(ctx, field)
if res == graphql.Null {
atomic.AddUint32(&invalids, 1)
}
return res return res
} }
@ -11860,9 +11815,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr
} }
}() }()
res = ec._Query_jobMetrics(ctx, field) res = ec._Query_jobMetrics(ctx, field)
if res == graphql.Null {
atomic.AddUint32(&invalids, 1)
}
return res return res
} }
@ -11903,9 +11855,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr
} }
}() }()
res = ec._Query_jobs(ctx, field) res = ec._Query_jobs(ctx, field)
if res == graphql.Null {
atomic.AddUint32(&invalids, 1)
}
return res return res
} }
@ -11926,9 +11875,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr
} }
}() }()
res = ec._Query_jobsStatistics(ctx, field) res = ec._Query_jobsStatistics(ctx, field)
if res == graphql.Null {
atomic.AddUint32(&invalids, 1)
}
return res return res
} }
@ -11949,9 +11895,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr
} }
}() }()
res = ec._Query_jobsCount(ctx, field) res = ec._Query_jobsCount(ctx, field)
if res == graphql.Null {
atomic.AddUint32(&invalids, 1)
}
return res return res
} }
@ -11972,9 +11915,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr
} }
}() }()
res = ec._Query_rooflineHeatmap(ctx, field) res = ec._Query_rooflineHeatmap(ctx, field)
if res == graphql.Null {
atomic.AddUint32(&invalids, 1)
}
return res return res
} }
@ -11995,9 +11935,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr
} }
}() }()
res = ec._Query_nodeMetrics(ctx, field) res = ec._Query_nodeMetrics(ctx, field)
if res == graphql.Null {
atomic.AddUint32(&invalids, 1)
}
return res return res
} }
@ -12025,9 +11962,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr
} }
} }
out.Dispatch() out.Dispatch()
if invalids > 0 {
return graphql.Null
}
return out return out
} }

View File

@ -2,6 +2,7 @@ package graph
// This file will be automatically regenerated based on the schema, any resolver implementations // This file will be automatically regenerated based on the schema, any resolver implementations
// will be copied through when generating and any unknown code will be moved to the end. // will be copied through when generating and any unknown code will be moved to the end.
// Code generated by github.com/99designs/gqlgen version v0.17.24
import ( import (
"context" "context"

View File

@ -895,7 +895,7 @@ func (r *JobRepository) JobsStatistics(ctx context.Context,
} }
if col == "job.user" { if col == "job.user" {
for id, _ := range stats { for id := range stats {
emptyDash := "-" emptyDash := "-"
name, _ := r.FindNameByUser(ctx, id) name, _ := r.FindNameByUser(ctx, id)
if name != "" { if name != "" {