Overview
This is a follow-up issue that appeared on #3568264: Update code component props schema to support 'array' type in this conversation: https://git.drupalcode.org/project/canvas/-/merge_requests/645#note_706433
In JsonSchemaType, I removed the exception thrown when maxItems is less than 2 to improve the DX, but leave the exception thrown has better DX than just returning NULL.
This 3 messages: https://git.drupalcode.org/project/canvas/-/merge_requests/645#note_709202, describe pretty well what is the error, what the developer gets.
Proposed resolution
Improve the DX for maxItems, or maybe even more things for the schema.
Issue fork canvas-3576578
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
velmir_taky commentedImproved the
InvalidArgumentExceptionmessage inJsonSchemaType::computeStorablePropShape()— now includes the actualmaxItemsvalue and suggests using a non-array type instead.Comment #5
wim leersComment #6
wim leersIt's not "improve", it's "implement at all".
#3467870: Support `{type: array, …}` prop shapes just added that exception as a way to land foundations early and force exactly this to happen later, when complete support for it would be implemented.
Comment #8
tedbowworking on test failure
Comment #9
tedbow\Drupal\Tests\canvas\Kernel\PropShapeToFieldInstanceTest::test should now pass and phpstan passes
Comment #10
tedbowtests failure
Comment #11
wim leers😂👏 “judging Gracie”
Per #6: this is paying off technical debt we accepted to go faster in the summer of last year.
Comment #12
wim leersThe test failure was only due to @tedbow improving the message (thanks! 🙏): the test expectation needed updating to match. He did that, good to go now.
Suggested commit message:
Comment #13
wim leersComment #14
wim leers@tedbow's https://git.drupalcode.org/project/canvas/-/merge_requests/663#note_710706 remark is not sufficiently negative — let's fix that distraction: #3576805: DX: reorganize test components: `canvas_test_sdc` should have its (intentionally invalid) SDCs moved to `canvas_test_sdc_invalid`.
Comment #16
tedbow