3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-12 19:58:28 +01:00

11b: fail on combinators an attribute kind cannot read

This commit is contained in:
2026-09-14 17:33:13 +02:00
parent 1a11d54804
commit f3862b7e8b
+2
View File
@@ -161,6 +161,8 @@ function propertyKinds(property: SchemaObject, where: string): AttributeKind[] {
if (type === 'string') return ['string']
if (type === 'array' || type === 'object') return ['json']
if (type !== undefined) return assert.fail(`${where}: the schema types it ${JSON.stringify(type)}, which reads as no attribute kind`)
const combinator = ['$ref', 'allOf', 'anyOf'].find((keyword) => property[keyword] !== undefined)
if (combinator !== undefined) return assert.fail(`${where}: the schema holds the keyword ${combinator}, which the gate reads as no attribute kind`)
const values = property['enum']
return Array.isArray(values) ? values.map(valueKind) : ['json']
}