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,60 +522,105 @@ export default {
components: { components: {
schemas: { schemas: {
workflow: { workflow: {
type: 'object', model: {
description: 'Workflow', type: 'object',
properties: { description: 'Workflow',
id: { properties: {
id: {
type: 'integer',
description: 'ID',
},
key: {
type: 'string',
description: 'Key. Variant versions of the same workflow share the same key.',
},
title: {
type: 'string',
description: 'Title',
},
description: {
type: 'string',
description: 'Description',
},
current: {
type: 'boolean',
description: 'Current version',
},
enabled: {
type: 'boolean',
description: 'Enabled',
},
type: {
type: 'string',
description: 'Event type',
},
config: {
type: 'object',
description: 'Configuration JSON object',
},
nodes: {
type: 'array',
description: 'Workflow nodes',
},
executions: {
type: 'array',
description: 'Executions',
},
revisions: {
type: 'array',
description: 'Revisions',
},
executed: {
type: 'integer',
description: 'Executed count for a single version',
},
allExecuted: {
type: 'integer',
description: 'Executed count for all versions of the same workflow',
},
},
},
filterByTk: {
name: 'filterByTk',
in: 'query',
description: 'Primary key of a record',
schema: {
type: 'integer', type: 'integer',
description: 'ID', description: 'ID',
}, },
key: { },
type: 'string', filter: {
description: 'Key. Variant versions of the same workflow share the same key.', name: 'filter',
}, in: 'query',
title: { description: 'Filter parameters in JSON format',
type: 'string', schema: {
description: 'Title',
},
description: {
type: 'string',
description: 'Description',
},
current: {
type: 'boolean',
description: 'Current version',
},
enabled: {
type: 'boolean',
description: 'Enabled',
},
type: {
type: 'string',
description: 'Event type',
},
config: {
type: 'object', type: 'object',
description: 'Configuration JSON object', properties: {
}, id: {
nodes: { $ref: '#/components/schemas/workflow/model/properties/id',
type: 'array', },
description: 'Workflow nodes', title: {
}, $ref: '#/components/schemas/workflow/model/properties/title',
executions: { },
type: 'array', type: {
description: 'Executions', $ref: '#/components/schemas/workflow/model/properties/type',
}, },
revisions: { enabled: {
type: 'array', $ref: '#/components/schemas/workflow/model/properties/enabled',
description: 'Revisions', },
}, current: {
executed: { $ref: '#/components/schemas/workflow/model/properties/current',
type: 'integer', },
description: 'Executed count for a single version', key: {
}, $ref: '#/components/schemas/workflow/model/properties/key',
allExecuted: { },
type: 'integer', executed: {
description: 'Executed count for all versions of the same workflow', $ref: '#/components/schemas/workflow/model/properties/executed',
},
allExecuted: {
$ref: '#/components/schemas/workflow/model/properties/allExecuted',
},
},
}, },
}, },
}, },