TYPO3 / Fluid

Fluid template rendering engine - Standalone version
GNU Lesser General Public License v3.0
151 stars 93 forks source link

[FEATURE] Command to generate XSD Schemas for ViewHelpers #876

Closed s2b closed 2 months ago

s2b commented 2 months ago

This feature is a re-implementation of the XSD schema generator, which was previously available as a separate package ^1. These schema files provide auto-complete in IDEs (like PHPStorm) for all available ViewHelpers in a composer project.

The bin/fluid CLI command now supports the additional command schema, which scans the whole composer projects for valid ViewHelper classes. The class in question needs to meet the following requirements, which enforces already-existing conventions:

These conditions are checked by ViewHelperMetadataFactory, which then creates the corresponding ViewHelperMetadata value object. The SchemaGenerator then receives a list of ViewHelperMetadata objects as well as an XML namespace (like http://typo3.org/ns/TYPO3Fluid/Fluid/ViewHelpers) and generates an xsd schema file that describes the ViewHelper and its arguments. The ConsoleRunner collects these files, creates unique file names and writes them as schema_*.xsd files to the destination folder, specified with --destination.

IDEs either pick up those files automatically or need to be configured manually to do so.

RozbehSharahi commented 2 months ago

🥳