Issue #3472584: Add missing request body schemas to openapi.yml
Twelve POST and PATCH operations in openapi.yml had no requestBody. Eight of them receive one; four do not.
The eight are the form/* operations. They receive form-encoded data, not JSON, because Drupal's Form API reads these values from the request's parameter bag. Two shared request bodies cover them:
ComponentInstanceFormGeneration— the three PATCH operations that generate a component instance form. Documentsform_canvas_tree,form_canvas_props,form_canvas_selected,latestUndoRedoActionIdandajaxPageState.DrupalAjaxFormSubmission— the five POST operations that receive Drupal AJAX form submissions. Declares bothapplication/x-www-form-urlencodedandmultipart/form-data, because Drupal switches to multipart for forms containing a file input. Its schema documents the Form API and AJAX bookkeeping fields and allows additional properties, since the form's own fields are determined at run time.
The remaining four read no request body: the two Page Region operations always respond 410 Gone, and the two CLI push signals carry no data. Each now states that in a comment.
ApiRequestValidator validates live requests against this file, kernel tests included. Request::create() sets neither a Content-Type header nor a raw body for PATCH requests, so three kernel test call sites now use a new RequestTrait::createFormEncodedRequest() helper to send what real clients send.
OpenApiSpecValidationTest::testRequestsComplyWithSpecification() adds 13 cases covering these request shapes. It is the only PHP coverage for the five AJAX submission operations, which are otherwise exercised only by Cypress.
Testing instructions
-
ddev xb-openapireports the description is valid, with no new warnings. -
ddev xb-phpunit tests/src/Unit/OpenApiSpecValidationTest.phppasses. -
ddev xb-phpunit tests/src/Unit/DxRouteConsistencyTest.phppasses. -
ddev xb-phpunit tests/src/Kernel/Plugin/Canvas/ComponentSource/JsComponentEvolutionTest.phppasses. Reverting only thecreateFormEncodedRequest()call site makes 18 assertions fail. -
ddev xb-phpunit tests/src/Kernel/ComponentInstanceFormTest.phppasses. On core 11.5-dev it fails insetUp()for unrelated reasons: thecanvas.component.sdc.canvas_test_sdc.imageconfig is absent. - Cypress form suites pass, for example
entity-form-field-types-test.cy.jsandmedia-library-entity-form.cy.js. - Reverting only
openapi.ymlmakes twoOpenApiSpecValidationTestcases fail, confirming the new request bodies are enforced.
AI use
Written with Claude Code (claude-opus-5) under human review