Feature/more dynamic unions (#2972)

* with validators

* more dynamic unions

* fixes from v31

* better constructor for dynamic unions

* version bump

* fix build
This commit is contained in:
Aiden McClelland
2025-07-01 17:40:39 -06:00
committed by GitHub
parent 35d2ec8a44
commit 340775a593
21 changed files with 863 additions and 611 deletions

View File

@@ -39,13 +39,7 @@ const {InputSpec, List, Value, Variants} = sdk
const namedConsts = new Set(["InputSpec", "Value", "List"])
const inputSpecName = newConst("inputSpecSpec", convertInputSpec(data))
const inputSpecMatcherName = newConst(
"matchInputSpecSpec",
`${inputSpecName}.validator`,
)
outputLines.push(
`export type InputSpecSpec = typeof ${inputSpecMatcherName}._TYPE;`,
)
outputLines.push(`export type InputSpecSpec = typeof ${inputSpecName}._TYPE;`)
return outputLines.join("\n")
@@ -195,7 +189,8 @@ const {InputSpec, List, Value, Variants} = sdk
description: ${JSON.stringify(value.tag.description || null)},
warning: ${JSON.stringify(value.tag.warning || null)},
default: ${JSON.stringify(value.default)},
}, ${variants})`
variants: ${variants},
})`
}
case "list": {
if (value.subtype === "enum") {
@@ -322,7 +317,8 @@ const {InputSpec, List, Value, Variants} = sdk
)},
warning: ${JSON.stringify(value?.spec?.tag?.warning || null)},
default: ${JSON.stringify(value?.spec?.default || null)},
}, ${variants})
variants: ${variants},
})
`,
)
const listInputSpec = maybeNewConst(