tests(ui): add iterate to test schema

This commit is contained in:
psychedelicious 2024-05-19 01:04:58 +10:00
parent 857889d1fa
commit 972398d203

View File

@ -442,10 +442,78 @@ export const img_resize: InvocationTemplate = {
classification: 'stable',
};
const iterate: InvocationTemplate = {
title: 'Iterate',
type: 'iterate',
version: '1.1.0',
tags: [],
description: 'Iterates over a list of items',
outputType: 'iterate_output',
inputs: {
collection: {
name: 'collection',
title: 'Collection',
required: false,
description: 'The list of items to iterate over',
fieldKind: 'input',
input: 'connection',
ui_hidden: false,
ui_type: 'CollectionField',
type: {
name: 'CollectionField',
isCollection: true,
isCollectionOrScalar: false,
},
},
},
outputs: {
item: {
fieldKind: 'output',
name: 'item',
title: 'Collection Item',
description: 'The item being iterated over',
type: {
name: 'CollectionItemField',
isCollection: false,
isCollectionOrScalar: false,
},
ui_hidden: false,
ui_type: 'CollectionItemField',
},
index: {
fieldKind: 'output',
name: 'index',
title: 'Index',
description: 'The index of the item',
type: {
name: 'IntegerField',
isCollection: false,
isCollectionOrScalar: false,
},
ui_hidden: false,
},
total: {
fieldKind: 'output',
name: 'total',
title: 'Total',
description: 'The total number of items',
type: {
name: 'IntegerField',
isCollection: false,
isCollectionOrScalar: false,
},
ui_hidden: false,
},
},
useCache: true,
classification: 'stable',
};
export const templates: Templates = {
add,
sub,
collect,
iterate,
scheduler,
main_model_loader,
img_resize,
@ -1410,6 +1478,111 @@ export const schema = {
title: 'BoardField',
description: 'A board primitive field',
},
IterateInvocation: {
properties: {
id: {
type: 'string',
title: 'Id',
description: 'The id of this instance of an invocation. Must be unique among all instances of invocations.',
field_kind: 'node_attribute',
},
is_intermediate: {
type: 'boolean',
title: 'Is Intermediate',
description: 'Whether or not this is an intermediate invocation.',
default: false,
field_kind: 'node_attribute',
ui_type: 'IsIntermediate',
},
use_cache: {
type: 'boolean',
title: 'Use Cache',
description: 'Whether or not to use the cache',
default: true,
field_kind: 'node_attribute',
},
collection: {
items: {},
type: 'array',
title: 'Collection',
description: 'The list of items to iterate over',
default: [],
field_kind: 'input',
input: 'any',
orig_default: [],
orig_required: false,
ui_hidden: false,
ui_type: 'CollectionField',
},
index: {
type: 'integer',
title: 'Index',
description: 'The index, will be provided on executed iterators',
default: 0,
field_kind: 'input',
input: 'any',
orig_default: 0,
orig_required: false,
ui_hidden: true,
},
type: {
type: 'string',
enum: ['iterate'],
const: 'iterate',
title: 'type',
default: 'iterate',
field_kind: 'node_attribute',
},
},
type: 'object',
required: ['type', 'id'],
title: 'IterateInvocation',
description: 'Iterates over a list of items',
classification: 'stable',
version: '1.1.0',
output: {
$ref: '#/components/schemas/IterateInvocationOutput',
},
class: 'invocation',
},
IterateInvocationOutput: {
description: 'Used to connect iteration outputs. Will be expanded to a specific output.',
properties: {
item: {
description: 'The item being iterated over',
field_kind: 'output',
title: 'Collection Item',
ui_hidden: false,
ui_type: 'CollectionItemField',
},
index: {
description: 'The index of the item',
field_kind: 'output',
title: 'Index',
type: 'integer',
ui_hidden: false,
},
total: {
description: 'The total number of items',
field_kind: 'output',
title: 'Total',
type: 'integer',
ui_hidden: false,
},
type: {
const: 'iterate_output',
default: 'iterate_output',
enum: ['iterate_output'],
field_kind: 'node_attribute',
title: 'type',
type: 'string',
},
},
required: ['item', 'index', 'total', 'type', 'type'],
title: 'IterateInvocationOutput',
type: 'object',
class: 'output',
},
},
},
} as OpenAPIV3_1.Document;