# ACE_LIB.getConfig - More Examples Repository ini berisi contoh-contoh penggunaan fungsi `ACE_LIB.getConfig()` untuk parsing YAML nested dengan berbagai skenario. ## ๐Ÿ“‹ Overview Fungsi `getConfig()` adalah YAML parser yang dapat membaca file konfigurasi dengan struktur nested (object dan array) dan mengembalikan JSON yang dapat langsung diakses di ESQL. ## ๐Ÿงช Test Scenarios Repository ini menyediakan **5 skenario testing** yang mencakup berbagai use case: | Config | Scenario | Description | |--------|----------|-------------| | [CONFIG1.yaml](configs/CONFIG1.yaml) | **Standard Nested YAML** | Multiple root keys dengan nested objects dan arrays | | [CONFIG2.yaml](configs/CONFIG2.yaml) | **Flat YAML** | Structure flat tanpa root key, diakses dengan wildcard `'*'` | | [CONFIG3.yaml](configs/CONFIG3.yaml) | **Corner Case: Empty Values** | Testing empty values, mixed arrays, dan special characters | | [CONFIG4.yaml](configs/CONFIG4.yaml) | **Corner Case: Deep Nesting** | Deep nesting (5+ levels) dan complex nested structures | | [CONFIG5.yaml](configs/CONFIG5.yaml) | **Simple Key-Value** | Practical real-world config dengan arrays dan nested objects | ## ๐Ÿ“‚ Repository Structure ``` ACE_LIB.getConfig-moreExample/ โ”œโ”€โ”€ README.md # File ini โ”œโ”€โ”€ configs/ # 5 File YAML untuk testing โ”‚ โ”œโ”€โ”€ CONFIG1.yaml โ”‚ โ”œโ”€โ”€ CONFIG2.yaml โ”‚ โ”œโ”€โ”€ CONFIG3.yaml โ”‚ โ”œโ”€โ”€ CONFIG4.yaml โ”‚ โ””โ”€โ”€ CONFIG5.yaml โ”œโ”€โ”€ parseResults/ # Hasil JSON dari parsing โ”‚ โ”œโ”€โ”€ hasilParseConfig1.json โ”‚ โ”œโ”€โ”€ hasilParseConfig2.json โ”‚ โ”œโ”€โ”€ hasilParseConfig3.json โ”‚ โ”œโ”€โ”€ hasilParseConfig4.json โ”‚ โ””โ”€โ”€ hasilParseConfig5.json โ””โ”€โ”€ docs/ # Detailed documentation โ”œโ”€โ”€ config1-scenario.md โ”œโ”€โ”€ config2-scenario.md โ”œโ”€โ”€ config3-scenario.md โ”œโ”€โ”€ config4-scenario.md โ””โ”€โ”€ config5-scenario.md ``` ## ๐Ÿ“– Detailed Documentation Untuk penjelasan lengkap setiap skenario, lihat dokumentasi berikut: - [Config 1: Standard Nested YAML](docs/config1-scenario.md) - [Config 2: Flat YAML with Wildcard](docs/config2-scenario.md) - [Config 3: Empty Values & Mixed Content](docs/config3-scenario.md) - [Config 4: Deep Nesting & Complex Structures](docs/config4-scenario.md) - [Config 5: Simple & Practical Config](docs/config5-scenario.md) ## ๐Ÿš€ Quick Start ### Cara Menggunakan Test Files ```esql -- Example: Load CONFIG1 dengan key 'fundtastic' DECLARE config REFERENCE TO Environment.Variables; DECLARE success BOOLEAN; CALL ACE_LIB.getConfig( 'TEST_CONFIG1', -- Cache ID 'fundtastic', -- Key yang akan diambil '/path/to/CONFIG1.yaml', -- Path ke file '600', -- Cache expiry (seconds) config -- OUT: Reference hasil parse ) INTO success; IF success THEN -- Akses data DECLARE apiSecret CHARACTER config.ApiSecret; DECLARE endpoint CHARACTER config.endpoint; END IF; ``` ## โœ… Test Coverage | Feature | Config 1 | Config 2 | Config 3 | Config 4 | Config 5 | |---------|----------|----------|----------|----------|----------| | Nested Objects | โœ… | โœ… | โœ… | โœ… | โœ… | | Arrays of Strings | โœ… | โœ… | - | โœ… | โœ… | | Arrays of Objects | โœ… | โœ… | โœ… | โœ… | โœ… | | Multiple Root Keys | โœ… | - | - | - | โœ… | | Flat YAML (wildcard) | - | โœ… | - | - | - | | Empty Values | - | - | โœ… | - | - | | Mixed Arrays | - | - | โœ… | - | - | | Deep Nesting (5+ levels) | - | - | - | โœ… | - | | Special Characters | - | - | โœ… | - | - | ## ๐Ÿ“ Notes - Semua config menggunakan **indentasi 2 spasi** per level - Parser support struktur nested unlimited depth (limited by memory) - Semua values di-parse sebagai **string** (tidak ada type conversion) - Empty values (`key:`) di-parse menjadi empty string `""` --- **Version:** 1.0.0 **Last Updated:** October 2026 **Maintainer:** IBM ACE Middleware Team