Fix Workflow Validation error when node pack 'unknown' version (#3179)

This commit is contained in:
Christian Byrne
2025-03-21 08:04:06 -07:00
committed by GitHub
parent 830933e78f
commit f7bfb6ec57
2 changed files with 7 additions and 4 deletions

View File

@@ -155,9 +155,10 @@ const zAuxId = z
)
.transform(([username, repo]) => `${username}/${repo}`)
const zSemVer = z
.string()
.regex(semverPattern, 'Invalid semantic version (x.y.z)')
const zSemVer = z.union([
z.string().regex(semverPattern, 'Invalid semantic version (x.y.z)'),
z.literal('unknown')
])
const zGitHash = z.string().regex(gitHashPattern, 'Invalid Git commit hash')
const zVersion = z.union([zSemVer, zGitHash])

View File

@@ -176,7 +176,9 @@ describe('parseComfyWorkflow', () => {
'0.1.0-alpha.1',
'1.3.321',
// Git hash
'080e6d4af809a46852d1c4b7ed85f06e8a3a72be'
'080e6d4af809a46852d1c4b7ed85f06e8a3a72be',
// Special case
'unknown'
]
it.each(validVersionStrings)('valid version: %s', async (ver) => {
const workflow = JSON.parse(JSON.stringify(defaultGraph))