Skip to content

Commit 1fd7296

Browse files
committed
Added json schema output
1 parent c951bf2 commit 1fd7296

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

src/tests/superValidate.test.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,26 @@ describe('Zod', () => {
630630

631631
describe.only('with z.record', () => {
632632
it('should work with additionalProperties for records', async () => {
633+
/*
634+
{
635+
type: 'object',
636+
properties: {
637+
id: { type: 'string' },
638+
options: {
639+
type: 'object',
640+
additionalProperties: {
641+
type: 'object',
642+
properties: { label: { type: 'string' } },
643+
required: [ 'label' ],
644+
additionalProperties: false
645+
}
646+
}
647+
},
648+
required: [ 'id', 'options' ],
649+
additionalProperties: false,
650+
'$schema': 'http://json-schema.org/draft-07/schema#'
651+
}
652+
*/
633653
const schema = z.object({
634654
id: z.string(),
635655
options: z.record(
@@ -642,8 +662,6 @@ describe('Zod', () => {
642662
)
643663
});
644664

645-
console.dir(zod(schema).jsonSchema, { depth: 10 }); //debug
646-
647665
let row = {
648666
id: '1',
649667
options: {

0 commit comments

Comments
 (0)