Skip to content

Commit b437a72

Browse files
author
Jakub Jankowski
committed
feat: support x-example
1 parent a59d0b9 commit b437a72

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/components/shared/Validations.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,12 @@ export function getValidationsFromSchema(schemaNode: RegularNode) {
180180
...(schemaNode.annotations.examples ? { examples: schemaNode.annotations.examples } : null),
181181
}
182182
: null),
183-
...('fragment' in schemaNode && 'const' in schemaNode.fragment ? { const: schemaNode.fragment.const } : null),
183+
...('fragment' in schemaNode
184+
? {
185+
...('const' in schemaNode.fragment ? { const: schemaNode.fragment.const } : null),
186+
...('x-example' in schemaNode.fragment ? { ['x-example']: schemaNode.fragment['x-example'] } : null),
187+
}
188+
: null),
184189
...schemaNode.validations,
185190
};
186191
}

0 commit comments

Comments
 (0)