MCPcopy
hub / github.com/markdoc/markdoc / ConditionalAttributeType

Class ConditionalAttributeType

src/schema-types/conditional.ts:15–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13 * - `object`
14 */
15export class ConditionalAttributeType implements CustomAttributeTypeInterface {
16 validate(value: any, _config: Config, key: string): ValidationError[] {
17 if (
18 typeof value === 'boolean' ||
19 value === null ||
20 value === undefined ||
21 typeof value === 'object'
22 ) {
23 return [];
24 }
25
26 return [
27 {
28 id: 'attribute-type-invalid',
29 level: 'error',
30 message: `Attribute '${key}' must be type 'boolean | object' (null or undefined are also allowed)`,
31 },
32 ];
33 }
34}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…