|
4 | 4 | **Projekt:** @techdivision/appsheet |
5 | 5 | **Status:** Konzeptphase |
6 | 6 | **Datum:** 2025-01-20 |
| 7 | +**Aktualisiert:** 2025-11-21 (Post-SOSO-247 v2.0.0) |
| 8 | + |
| 9 | +> **⚠️ Wichtig:** Dieses Dokument berücksichtigt die Änderungen aus SOSO-247 (v2.0.0): |
| 10 | +> - Alle Schema-Beispiele verwenden AppSheet field types (Text, Email, Enum, etc.) |
| 11 | +> - Validators (AppSheetTypeValidator, FormatValidator) sind stateless und benötigen keine DI |
| 12 | +> - FieldDefinition verwendet `allowedValues` statt `enum` |
7 | 13 |
|
8 | 14 | --- |
9 | 15 |
|
@@ -312,9 +318,48 @@ export class DynamicTable<T = Record<string, any>> { |
312 | 318 |
|
313 | 319 | --- |
314 | 320 |
|
| 321 | +#### 3.8 Validation Layer - NO DI Required |
| 322 | + |
| 323 | +**Validators aus SOSO-247 (v2.0.0):** |
| 324 | + |
| 325 | +Die neuen Validator-Klassen sind **stateless** und verwenden **statische Methoden**. Sie benötigen **KEINE Dependency Injection**: |
| 326 | + |
| 327 | +```typescript |
| 328 | +// src/utils/validators/AppSheetTypeValidator.ts |
| 329 | +export class AppSheetTypeValidator { |
| 330 | + // Statische Methoden - keine DI nötig |
| 331 | + static validate(fieldName: string, fieldType: AppSheetFieldType, value: any, rowIndex: number): void |
| 332 | + static validateEnum(...): void |
| 333 | + static validateRequired(...): void |
| 334 | +} |
| 335 | + |
| 336 | +// src/utils/validators/FormatValidator.ts |
| 337 | +export class FormatValidator { |
| 338 | + // Statische Methoden - keine DI nötig |
| 339 | + static validateEmail(fieldName: string, value: string, rowIndex: number): void |
| 340 | + static validateURL(...): void |
| 341 | + static validatePhone(...): void |
| 342 | +} |
| 343 | + |
| 344 | +// src/utils/validators/BaseTypeValidator.ts |
| 345 | +export class BaseTypeValidator { |
| 346 | + // Statische Methoden - keine DI nötig |
| 347 | + static validateString(...): void |
| 348 | + static validateNumber(...): void |
| 349 | +} |
| 350 | +``` |
| 351 | + |
| 352 | +**Begründung:** |
| 353 | +- Validators sind **pure functions** ohne State |
| 354 | +- Keine Dependencies auf externe Services |
| 355 | +- Performance-optimal durch statische Methoden |
| 356 | +- Einfach testbar ohne DI-Setup |
| 357 | + |
| 358 | +--- |
| 359 | + |
315 | 360 | ### Phase 4: DI Helper & Utilities (Tag 3) |
316 | 361 |
|
317 | | -#### 3.8 DI Helper Module |
| 362 | +#### 3.9 DI Helper Module |
318 | 363 |
|
319 | 364 | **Neues Modul: src/di/index.ts** |
320 | 365 |
|
|
0 commit comments