Skip to content

Rebuild the XML reference pages from the XSD files and validate samples in CI - #109

Open
DavidLambauer wants to merge 7 commits into
mainfrom
docs/xml-reference-from-xsd
Open

DavidLambauer wants to merge 7 commits into
mainfrom
docs/xml-reference-from-xsd

Conversation

@DavidLambauer

@DavidLambauer DavidLambauer commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

The XML reference pages documented elements and attributes that the Mage-OS schemas reject, so samples copied from them failed validation in developer mode. Some examples:

  • roles and permissions in acl.xml, which live in the database;
  • a method attribute on observers;
  • dataType in db_schema.xml;
  • snake_case field attributes in system.xml;
  • an invented <method> element in webapi.xml;
  • a cron_jobs.xml file, which doesn't exist; Magento reads crontab.xml.

Changes

  • All 18 reference pages rebuilt from the XSD files and core files of Mage-OS 4.0.0. They share one structure:
    • what the file does and which class reads it;
    • location and merging;
    • a complete example that validates;
    • an element and attribute reference, with the defaults from the schema;
    • related commands.
  • Topics the old pages left out:
    • the db_schema_whitelist.json workflow;
    • mview.xml;
    • config_path cron schedules and custom cron groups;
    • view models in layout XML;
    • <update>/<remove> in menu.xml;
    • the setup:upgrade --dry-run=1 pitfall: --dry-run without a value runs the upgrade for real.
  • cron_jobs_xml renamed to crontab_xml. The nav label layout.xml is now "Layout XML", because files are named after layout handles.
  • New CI check (.github/workflows/xml-samples.yml + .github/scripts/validate_xml_samples.py):
    • Every XML sample that is a complete file, meaning it has an xsi:noNamespaceSchemaLocation, is validated with xmllint against the XSD files of mage-os/mageos-magento2 at 4.0.0.
    • It does a sparse checkout of only the XSD files, which takes about 2 seconds.
    • urn:magento:* locations resolve through a generated XML catalog.
    • Pull requests check only the pages they change, so older pages don't block unrelated work. A manual run checks every page.
    • To skip a sample on purpose, use ```xml no-validate.
    • The README explains how to run it locally.

All 28 complete XML samples validate, and the PHP samples pass php -l on PHP 8.4.

Tested on a running store

Every command and code sample on these pages was then run on a Mage-OS 4.0.0 store in Warden (PHP 8.4, MariaDB 11.8, OpenSearch 3.4, Valkey 8.1, Varnish 8.0, RabbitMQ 4.2), and the pages were corrected wherever the store behaved differently from what the code suggested. What needs several servers or outside services was checked in the code only.

Merge mage-os/devdocs-website#74 first: this pull request removes pages, and until that change is live the website answers a request for a removed page with a 500. #151 adds the redirects to the pages that replace them.

Merge order and notes for reviewers: #115.

🤖 Generated with Claude Code

DavidLambauer and others added 3 commits November 28, 2026 13:49
The XML reference pages documented elements and attributes that the
schemas reject, so copied samples failed in developer mode. Add a
check that runs every complete XML sample (one with
xsi:noNamespaceSchemaLocation) through xmllint against the XSD files
of Mage-OS 4.0.0, resolving urn:magento:* locations through a
generated XML catalog.

Pull requests and pushes check only the pages they change, so older
pages don't block unrelated work; a manual run checks every page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Magento reads cron jobs from etc/crontab.xml; no cron_jobs.xml file
exists anywhere in the codebase.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Most reference pages documented elements and attributes that the
schemas reject, so copied samples failed validation in developer mode:
roles and permissions in acl.xml, a method attribute on observers,
dataType in db_schema.xml, snake_case field attributes in system.xml,
an invented <method> element in webapi.xml, a <widget> layout
element, and more.

Rewrite all 18 pages from the XSD files and the core files of 4.0.0,
with one structure: what the file does and who reads it, location and
merging, a complete example that validates, an element and attribute
reference with the defaults from the schema, and the related commands.
Also document what the old pages left out, such as the db_schema
whitelist, mview.xml, config_path schedules, layout view models, and
that setup:upgrade --dry-run needs =1.

There is no file called layout.xml, so the nav now says "Layout XML".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@DavidLambauer
DavidLambauer requested review from a team as code owners November 28, 2026 15:41
Comment thread .github/workflows/xml-samples.yml Fixed
…inks

after methods run in ascending sortOrder unless an around method wraps
them; the observers page is being merged into the events page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DavidLambauer and others added 2 commits November 28, 2026 17:44
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every complete example was installed in a module on a Mage-OS 4.0.0
store and its behavior checked. Corrections:

- db_schema.xml: renaming a table with migrateDataFromAnotherTable
  copies rows by column position, so data can land in the wrong
  columns before the old table is dropped (now a warning); a renamed
  column must also be renamed in its keys; generate-whitelist writes
  nothing until the module is enabled. Confirmed that --dry-run
  without =1 runs the upgrade.
- di.xml: plugins are compiled, so a new or changed plugin needs the
  generated classes removed or setup:upgrade; an object argument on
  an untyped parameter arrives as an array.
- crontab.xml / cron_groups.xml: schedules use the store timezone;
  the five other core groups of 4.0.0; separate-process groups run in
  the background even with --group.
- extension_attributes.xml: joined values appear in list calls but not
  in GET by id; the sample plugin now sets the value on the result.
- fieldset.xml: checkout doesn't copy a custom quote field to the
  order on its own; the example now includes the observer that does.
- menu.xml: changes need cache:clean config block_html.
- routes.xml: a new controller needs cache:clean compiled_config; after
  only works with the module in <sequence>.
- layout.xml: page layouts live in page_layout/, not layout/.
- indexer.xml: realtime mode drops the changelog and marks the indexer
  invalid; updated_at-only changes aren't recorded.
- webapi.xml: one method without @return breaks every REST request;
  admin tokens pass self routes with an empty %customer_id%.
- widget.xml: the block class must be declared in a widget.xml or the
  directive renders nothing.
- view.xml: read on every request; images merge by id and type.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants