Skip to content

Commit c807073

Browse files
mforiclaude
andcommitted
test: add test for enum error reporting on sub-schema array properties
Verifies that invalid editor values on nested (sub-schema) array properties show all valid editors, not just a subset from a oneOf branch. Co-Authored-By: Claude Opus 4.6 <[email protected]>
1 parent 7933e6f commit c807073

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

test/input_schema.test.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,38 @@ describe('input_schema.json', () => {
561561
);
562562
});
563563

564+
it('should report all valid editors when an invalid editor is used on a sub-schema array property', () => {
565+
const schema = {
566+
title: 'Test input schema',
567+
type: 'object',
568+
schemaVersion: 1,
569+
properties: {
570+
myField: {
571+
title: 'Field title',
572+
type: 'object',
573+
description: 'Description',
574+
editor: 'schemaBased',
575+
additionalProperties: false,
576+
properties: {
577+
subArray: {
578+
type: 'array',
579+
title: 'Sub array',
580+
description: 'Sub array description',
581+
editor: 'fileUpload',
582+
items: {
583+
type: 'string',
584+
},
585+
},
586+
},
587+
},
588+
},
589+
};
590+
expect(() => validateInputSchema(validator, schema)).toThrow(
591+
// eslint-disable-next-line max-len
592+
'Input schema is not valid (Field schema.properties.myField.subArray.editor must be equal to one of the allowed values: "json", "requestListSources", "pseudoUrls", "globs", "keyValue", "stringList", "fileupload", "select", "hidden")',
593+
);
594+
});
595+
564596
it('should not accept both enum and enumSuggestedValues for array property', () => {
565597
const schema = {
566598
title: 'Test input schema',

0 commit comments

Comments
 (0)