1
0
Files
breadcrumb-the-shire/docs/howto-request-input-validation.md
fs 545bcc789b docs: replace ASCII umlaut fallbacks with proper äöüß across all .md
Most German docs were written with `ue`/`ae`/`oe`/`ss` ASCII fallbacks
(`fuer`, `aenderung`, `koennen`, `gemaess`) — relic from older toolchain
constraints. Replaced 237 occurrences across 38 .md files with proper
umlauts and ß so the docs read naturally.

Substitutions are constrained to plain prose: fenced code blocks
(```...```), inline code spans (`...`), markdown link targets `[..](..)`,
and HTML comments are preserved verbatim. Path references like
`docs/howto-erste-aenderung.md` keep their original (umlaut-replaced)
filenames — only the surrounding prose is normalised.

Tool: bin/fix-md-umlauts.py (idempotent — no-op on already-clean files).
Re-runnable if ASCII fallbacks creep back in via copy-paste.

Doc-link-check + doc-drift-check stay green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 09:57:22 +02:00

59 lines
1.4 KiB
Markdown

# Request Input + Validation
Letzte Aktualisierung: 2026-03-06
Kurzstandard für neue Actions/Endpoints.
## Regeln
- Input immer über `requestInput()`.
- Validierungsfehler intern immer als `FormErrors`.
- API-Validation immer mit `ApiResponse::validationFromFormErrors(...)`.
- Web-Templates bekommen kompakte Fehlerlisten (`$errors`) aus `toFlatList()`.
- `Flash` ist für Redirect-/Outcome-Meldungen (z. B. Success) gedacht, nicht als primaerer Validation-Container.
- Bei Redirect-POST-Formen: `FormErrors` intern sammeln und erst am Redirect-Rand transportieren (z. B. `flashFormErrors(...)`).
## Web-Beispiel (Action)
```php
$request = requestInput();
$errorBag = formErrors();
if ($request->isMethod('POST')) {
if (!Session::checkCsrfToken()) {
$errorBag->addGlobal(t('Form expired, please try again'));
}
if (!$errorBag->hasAny()) {
$result = $service->save($request->bodyAll());
$errorBag->merge($result['errors'] ?? []);
}
}
$errors = $errorBag->toFlatList();
```
## API-Beispiel (Endpoint)
```php
$request = requestInput();
$errors = formErrors();
if ($request->bodyString('name') === '') {
$errors->add('name', 'required');
}
if ($errors->hasAny()) {
ApiResponse::validationFromFormErrors($errors);
}
```
## Migration-Gates
```bash
rg -n '\\$_POST|\\$_GET|\\$_FILES|REQUEST_METHOD' pages -g '*.php'
rg -n 'ApiResponse::readJsonBody\\(' pages/api/v1 -g '*.php'
```
Erwartung jeweils: `0` Treffer.