Allow input spec with extra values passthrough (#273)

* Allow input spec extra values passthrough

* Refine custom input spec

* nit

* nit
This commit is contained in:
Chenlei Hu
2024-07-31 09:51:32 -04:00
committed by GitHub
parent d77343da83
commit c00e2fd208
2 changed files with 30 additions and 24 deletions

View File

@@ -27,7 +27,11 @@ describe('validateNodeDef', () => {
describe.each([
[{ ckpt_name: 'foo' }, ['foo', {}]],
[{ ckpt_name: ['foo'] }, ['foo', {}]],
[{ ckpt_name: ['foo', { default: 1 }] }, ['foo', { default: 1 }]]
[{ ckpt_name: ['foo', { default: 1 }] }, ['foo', { default: 1 }]],
// Extra input spec should be preserved
[{ ckpt_name: ['foo', { bar: 1 }] }, ['foo', { bar: 1 }]],
[{ ckpt_name: ['INT', { bar: 1 }] }, ['INT', { bar: 1 }]],
[{ ckpt_name: [[1, 2, 3], { bar: 1 }] }, [[1, 2, 3], { bar: 1 }]]
])(
'validateComfyNodeDef with various input spec formats',
(inputSpec, expected) => {
@@ -47,7 +51,9 @@ describe('validateNodeDef', () => {
describe.each([
[{ ckpt_name: { 'model1.safetensors': 'foo' } }],
[{ ckpt_name: ['*', ''] }],
[{ ckpt_name: ['foo', { default: 1 }, { default: 2 }] }]
[{ ckpt_name: ['foo', { default: 1 }, { default: 2 }] }],
// Should reject incorrect default value type.
[{ ckpt_name: ['INT', { default: '124' }] }]
])(
'validateComfyNodeDef rejects with various input spec formats',
(inputSpec) => {