Commit 3ba7cc7
authored
YAML Error Handling (#2747)
* refactor(annot): enhance YAML parsing error reporting and handle nested contexts
- Replaced `ParsingException` with `YamlParsingException` for improved error details.
- Introduced `YamlErrorRenderer` for visual error markers in YAML reports.
- Added support for nested parsing contexts in `YamlParsingException`.
- Improved validation logic and error messages in `NodeValidationUtils` and `MethodSetter`.
- Updated `GenericYamlParser` to enhance schema validation handling.
* refactor(yaml-parsing): rename `YamlParsingException` to `ConfigurationParsingException` and update related classes
- Replaced `YamlParsingException` with `ConfigurationParsingException` for better clarity in exception usage.
- Updated `GenericYamlParser` and test cases to align with the new exception class.
- Simplified exception handling and removed redundant YAML-related logic.
* refactor(yaml-parsing): remove unused parameters and simplify logic in parsing methods
- Eliminated redundant parameters from `resolveSpelValue` and `replaceMarkerWithError` methods.
- Improved clarity in conditionals flagged as always true or false, annotated with TODO comments for future review.
- Streamlined exception handling in `GenericYamlParser` and optimized parsing utility logic.
* add copyright headers and improve YAML context handling
- Added missing Apache License headers to multiple classes.
- Introduced `updateContext` in `ParsingContext` for enhanced YAML parsing context tracking.
- Fixed formatting and improved error handling logic in `YamlErrorRenderer`.
- Applied minor code cleanups in `MethodSetter` and `GenericYamlParser`.
* refactor(tests): remove redundant `System.out.println` calls and outdated YAML parsing test blocks
- Cleaned up unused debug statements in `YAMLParsingReportTest`.
- Removed obsolete and commented-out test sections to simplify and improve readability.
- Adjusted YAML error context validation to reflect updated parsing behavior.
* refactor(yaml-parsing): replace `YamlErrorRenderer` with `LineYamlErrorRenderer`
- Replaced `YamlErrorRenderer` with `LineYamlErrorRenderer` for improved line-based error rendering in YAML context.
- Removed obsolete `YamlErrorRenderer` class and its dependencies.
- Refactored `MethodSetter` and `ParsingContext` to enhance error handling and context tracking.
- Updated test cases to align with the new error rendering approach and improved YAML parsing validation logic.
* refactor(yaml-parsing): clean up null checks, update formatting, and remove unused constants
- Replaced `assertEquals(null, ...)` with `assertNull(...)` for better readability.
- Updated `ParsingContext#toString` with a modern `formatted` multi-line string.
- Removed unused `BASE_INDENT` constant from `LineYamlErrorRenderer`.
* refactor(yaml-parsing): improve error handling, logging, and simplify exception messages
- Added SLF4J logging to `MethodSetter` for detailed debug messages on missing methods/beans.
- Simplified `ConfigurationParsingException` message initialization in `GenericYamlParser`.
- Replaced redundant `System.out.println` call with direct usage of `renderErrorReport`.
- Enhanced error messages in `McYamlIntrospector` for clarity on list vs. object mismatches.
- Imported SLF4J and utility classes as part of code cleanup.
* refactor(yaml-parsing): fix typos, improve logging, and update generic handling
- Corrected typos in method names (e.g., `validateAgaistSchema` to `validateAgainstSchema`).
- Introduced additional debug logging in `GenericYamlParser` for enhanced error tracking.
- Updated generic type handling in `ParsingContext` and `NodeValidationUtils`.
- Improved exception message formatting for clarity.
* test(yaml-parsing): reformat YAML test cases and update validation methods
- Reformatted YAML sources in `YAMLParsingCollapsedTest` and `YAMLParsingTest` for consistent indentation.
- Replaced redundant inline structure definitions with properly aligned multi-line structures in test assertions.
- Updated exception validation logic to use `assertNull` and `assertTrue` for better clarity.
* test(tests): clean up redundant methods and minor fixes in YAML parsing tests
- Removed unused `rootCause` method from `YAMLParsingCollapsedTest`.
- Updated exception handling to ignore caught exceptions for clarity.
- Replaced `assertEquals(null, ...)` with `assertNull(...)` in `YAMLParsingTest`.
- Fixed minor formatting issues in test cases.
* refactor: standardize accessor methods in `ParsingContext` and update usages
- Updated `ParsingContext` to use consistent `get*` accessor methods.
- Replaced direct field accesses with the new accessor methods across all relevant classes and test files.
- Improved exception messages and updated formatting for enhanced readability and clarity.
* refactor: migrate `ParsingContext` to record, simplify exception handling in YAML tests
- Converted `ParsingContext` to a record for cleaner implementation.
- Updated YAML parsing tests to use the new `getRootCause` helper method with type assertions.
- Reintroduced a previously commented-out YAML parsing test with improved exception handling.
* refactor: clean up tests and improve annotation handling in YAML parsing
- Replaced `assertEquals(null, ...)` with `assertNull(...)` in `YAMLParsingErrorTest`.
- Added `@NotNull` annotation to `ParsingContext#toString` for improved null safety.
- Removed unused `assertSchemaErrorContains` method from `YAMLComponentsParsingTest`.
- Simplified `getRootCause` logic by removing redundant null checks.1 parent 0fe9f66 commit 3ba7cc7
27 files changed
Lines changed: 1996 additions & 1043 deletions
File tree
- annot
- src
- main/java/com/predic8/membrane
- annot
- beanregistry
- bean
- yaml
- error
- common
- test/java/com/predic8/membrane
- annot
- yaml
- common
- core/src
- main/java/com/predic8/membrane/core
- cli
- util/text
- test/java/com/predic8/membrane/core
- config/spring/k8s
- kubernetes
- docs
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| |||
64 | 66 | | |
65 | 67 | | |
66 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
67 | 74 | | |
68 | 75 | | |
69 | 76 | | |
| |||
Lines changed: 6 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
| 16 | + | |
20 | 17 | | |
21 | | - | |
22 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
26 | | - | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
Lines changed: 7 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
92 | 96 | | |
93 | 97 | | |
94 | 98 | | |
| |||
101 | 105 | | |
102 | 106 | | |
103 | 107 | | |
104 | | - | |
105 | 108 | | |
106 | 109 | | |
107 | 110 | | |
| |||
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
| |||
126 | 125 | | |
127 | 126 | | |
128 | 127 | | |
129 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
130 | 132 | | |
131 | 133 | | |
132 | 134 | | |
| |||
156 | 158 | | |
157 | 159 | | |
158 | 160 | | |
159 | | - | |
160 | 161 | | |
161 | 162 | | |
162 | 163 | | |
| |||
170 | 171 | | |
171 | 172 | | |
172 | 173 | | |
173 | | - | |
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
| |||
Lines changed: 62 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
0 commit comments