docs(plugin-workflow): fix swagger docs (#2565)

This commit is contained in:
Junyi 2023-08-29 16:31:40 +07:00 committed by GitHub
parent 050e1e0215
commit 904d7ee87b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,18 +9,21 @@ export default {
get: { get: {
tags: ['workflows'], tags: ['workflows'],
description: '', description: '',
parameters: [], parameters: [
{
$ref: '#/components/schemas/workflow/filter',
},
],
responses: { responses: {
200: { 200: {
description: 'OK', description: 'OK',
content: { content: {
'application/json': { 'application/json': {
schema: { schema: {
allOf: [ type: 'array',
{ items: {
$ref: '#/components/schemas/workflow', $ref: '#/components/schemas/workflow/model',
}, },
],
}, },
}, },
}, },
@ -32,7 +35,14 @@ export default {
get: { get: {
tags: ['workflows'], tags: ['workflows'],
description: 'Get single workflow', description: 'Get single workflow',
parameters: [], parameters: [
{
$ref: '#/components/schemas/workflow/filterByTk',
},
{
$ref: '#/components/schemas/workflow/filter',
},
],
responses: { responses: {
200: { 200: {
description: 'OK', description: 'OK',
@ -41,7 +51,7 @@ export default {
schema: { schema: {
allOf: [ allOf: [
{ {
$ref: '#/components/schemas/workflow', $ref: '#/components/schemas/workflow/model',
}, },
{ {
type: 'object', type: 'object',
@ -74,13 +84,13 @@ export default {
type: 'object', type: 'object',
properties: { properties: {
title: { title: {
$ref: '#/components/schemas/workflow/properties/title', $ref: '#/components/schemas/workflow/model/properties/title',
}, },
type: { type: {
$ref: '#/components/schemas/workflow/properties/type', $ref: '#/components/schemas/workflow/model/properties/type',
}, },
description: { description: {
$ref: '#/components/schemas/workflow/properties/description', $ref: '#/components/schemas/workflow/model/properties/description',
}, },
}, },
}, },
@ -117,16 +127,16 @@ export default {
type: 'object', type: 'object',
properties: { properties: {
title: { title: {
$ref: '#/components/schemas/workflow/properties/title', $ref: '#/components/schemas/workflow/model/properties/title',
}, },
enabled: { enabled: {
$ref: '#/components/schemas/workflow/properties/enabled', $ref: '#/components/schemas/workflow/model/properties/enabled',
}, },
description: { description: {
$ref: '#/components/schemas/workflow/properties/description', $ref: '#/components/schemas/workflow/model/properties/description',
}, },
config: { config: {
$ref: '#/components/schemas/workflow/properties/config', $ref: '#/components/schemas/workflow/model/properties/config',
}, },
}, },
}, },
@ -222,7 +232,7 @@ export default {
name: 'triggerWorkflows', name: 'triggerWorkflows',
in: 'query', in: 'query',
description: description:
'A combined string to describe workflows to trigger and context data to use. e.g. `?triggerWorkflows=1,2!category`', 'A combined string to describe workflows to trigger and context data to use. e.g. `?triggerWorkflows=1,2!category`. Each comma separated part is a trigger pair, as `1` and `2!category`. The number part is the ID of workflow, exclamation means the path of association to use in form data. If ignored, will trigger with the full form data object.',
schema: { schema: {
type: 'string', type: 'string',
}, },
@ -512,6 +522,7 @@ export default {
components: { components: {
schemas: { schemas: {
workflow: { workflow: {
model: {
type: 'object', type: 'object',
description: 'Workflow', description: 'Workflow',
properties: { properties: {
@ -569,6 +580,50 @@ export default {
}, },
}, },
}, },
filterByTk: {
name: 'filterByTk',
in: 'query',
description: 'Primary key of a record',
schema: {
type: 'integer',
description: 'ID',
},
},
filter: {
name: 'filter',
in: 'query',
description: 'Filter parameters in JSON format',
schema: {
type: 'object',
properties: {
id: {
$ref: '#/components/schemas/workflow/model/properties/id',
},
title: {
$ref: '#/components/schemas/workflow/model/properties/title',
},
type: {
$ref: '#/components/schemas/workflow/model/properties/type',
},
enabled: {
$ref: '#/components/schemas/workflow/model/properties/enabled',
},
current: {
$ref: '#/components/schemas/workflow/model/properties/current',
},
key: {
$ref: '#/components/schemas/workflow/model/properties/key',
},
executed: {
$ref: '#/components/schemas/workflow/model/properties/executed',
},
allExecuted: {
$ref: '#/components/schemas/workflow/model/properties/allExecuted',
},
},
},
},
},
node: { node: {
type: 'object', type: 'object',
description: 'Workflow node', description: 'Workflow node',