Skip to content

Move Yaml Parsing to annot and add yaml parsing test infra#2332

Merged
rrayst merged 5 commits into
masterfrom
yaml-parsing-test-infra
Nov 19, 2025
Merged

Move Yaml Parsing to annot and add yaml parsing test infra#2332
rrayst merged 5 commits into
masterfrom
yaml-parsing-test-infra

Conversation

@christiangoerdes
Copy link
Copy Markdown
Collaborator

@christiangoerdes christiangoerdes commented Nov 19, 2025

Summary by CodeRabbit

  • New Features

    • New YAML loader and improved parsing path for more reliable handling of complex objects.
  • Tests

    • Added unit tests and test utilities to validate YAML parsing and object mapping.
  • Chores

    • Reorganized YAML/Kubernetes-related components and relocated several public types.
    • Added Maven dependencies for YAML format support and annotations.

…ce API

Extract YamlLoader, GenericYamlParser, BeanRegistry and related exceptions into com.predic8.membrane.annot.yaml. Change generated K8sHelperGeneratorAutoGenerated to implement K8sHelperGenerator (instance methods) and update callers (Envelope, BeanDefinition, KubernetesWatcher, tests) to use new instance-based API. Add YAML testing utilities (YamlParser, YAMLParsingTest, StructureAssertionUtil, CompilerHelper.parseYAML) and necessary dependencies (jackson-dataformat-yaml, org.jetbrains annotations). Update imports and tests accordingly.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Nov 19, 2025

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

💤 Files selected but had no reviewable changes (1)
  • annot/src/main/java/com/predic8/membrane/annot/yaml/McYamlIntrospector.java

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Adds YAML parsing support and JetBrains annotations to the annot module, relocates several YAML-related classes into com.predic8.membrane.annot.yaml, introduces an event-driven YamlLoader and parser flow, converts generated K8s helper data from public static fields to an interface-backed instance API, and adds tests and test utilities for YAML parsing.

Changes

Cohort / File(s) Summary
Maven Dependencies
annot/pom.xml
Added org.jetbrains:annotations (compile) and com.fasterxml.jackson.dataformat:jackson-dataformat-yaml (${jackson.version}).
Generated K8s helper
annot/src/main/java/.../generator/kubernetes/K8sHelperGenerator.java
Generated class now implements K8sHelperGenerator; elementMapping, localElementMapping, crdSingularNames made private; added instance methods getLocal, getElement, getCrdSingularNames; class Javadoc updated.
YAML package relocations
annot/src/main/java/com/predic8/membrane/annot/yaml/BeanRegistry.java, .../PublicMarkedYAMLException.java, .../WrongEnumConstantException.java, .../McYamlIntrospector.java
Moved types into com.predic8.membrane.annot.yaml; McYamlIntrospector now uses AnnotationUtils.findAnnotation.
YamlLoader (new)
annot/src/main/java/com/predic8/membrane/annot/yaml/YamlLoader.java
New event-based YAML utility exposing static readString, readObj, readSequence, readMap and position-aware errors; uses deterministic TreeMap for mappings.
GenericYamlParser updates
annot/src/main/java/com/predic8/membrane/annot/yaml/GenericYamlParser.java
Added parseMembraneObject and readMembraneObject; delegates to generator to resolve concrete kind; switched reflective instantiation to getConstructor().newInstance(); uses YamlLoader.read* and Map.of() replacements.
Core call-site updates
core/src/main/java/.../config/spring/k8s/Envelope.java, core/.../kubernetes/BeanDefinition.java, core/.../kubernetes/KubernetesWatcher.java
Replaced static field access on generated helper with instance method calls (getElement, getCrdSingularNames); updated imports to relocated BeanRegistry/GenericYamlParser.
Core parser cleanup
core/src/main/java/.../config/spring/k8s/YamlLoader.java, core/src/main/java/.../kubernetes/BeanCache.java
Removed internal YAML helper methods from core YamlLoader; updated imports for relocated BeanRegistry; minor import cleanup.
Tests & utilities (new/updated)
annot/src/test/java/.../YAMLParsingTest.java, .../util/CompilerHelper.java, .../util/YamlParser.java, .../util/StructureAssertionUtil.java
Added YAMLParsingTest; CompilerHelper.parseYAML added (classloader overlay + in-memory resource); new YamlParser test helper and StructureAssertionUtil to assert parsed object classes.
Test adjustments
core/src/test/java/.../config/spring/k8s/EnvelopeTest.java, core/src/test/java/.../kubernetes/GenericYamlParserTest.java
Updated imports to relocated BeanRegistry; renamed test class to GenericYamlParserTest; replaced anonymous K8sHelperGenerator with generated auto instance.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Test as TestRunner
    participant Parser as GenericYamlParser
    participant Loader as YamlLoader
    participant Gen as K8sHelperGenerator
    participant Registry as BeanRegistry

    Test->>Parser: parseMembraneObject(events, generator, registry)
    Parser->>Loader: iterate events / readObj
    Loader-->>Parser: scalar or structured value
    Parser->>Gen: getElement(kind)
    Gen-->>Parser: concrete Java class
    Parser->>Parser: parse(events, concreteClass, registry)
    Parser->>Loader: readMap / readSequence / readString
    Loader-->>Parser: parsed primitives/structures
    Parser-->>Test: constructed membrane object
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Pay extra attention to:
    • YamlLoader: nested mapping/sequence correctness and precise error locations.
    • GenericYamlParser: kind-to-class resolution and reflective instantiation changes.
    • Call-site switch from static fields to instance getters (initialization timing).
    • Test utilities that manipulate classloaders (CompilerHelper.parseYAML, YamlParser).

Possibly related PRs

Suggested reviewers

  • christiangoerdes
  • predic8

Poem

🐰 I hop through events, scalars, maps, and streams,
YamlLoader hums while generators chase dreams.
Static fields became methods, tidy and spry,
Tests light the path — a rabbit's joyful sigh. 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 3.03% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the primary changes: moving YAML parsing functionality to the annot module and introducing test infrastructure for YAML parsing.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@membrane-ci-server
Copy link
Copy Markdown

This pull request needs "/ok-to-test" from an authorized committer.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
annot/src/main/java/com/predic8/membrane/annot/yaml/WrongEnumConstantException.java (1)

24-31: Critical: Missing null-check for getEnumConstants() causes NPE.

getEnumConstants() returns null if clazz is not an enum class. Streaming over it on line 27 without a null-check will throw a NullPointerException.

Apply this diff to add validation:

 public WrongEnumConstantException(Class<?> clazz, String value) {
 
     Object[] enumConstants = clazz.getEnumConstants();
+    if (enumConstants == null) {
+        throw new IllegalArgumentException("Class " + clazz.getName() + " is not an enum");
+    }
     this.constants = Arrays.stream(enumConstants)
             .map(e -> ((Enum<?>) e).name().toLowerCase())
             .toList();
     this.value = value;
 }
🧹 Nitpick comments (13)
annot/src/main/java/com/predic8/membrane/annot/yaml/PublicMarkedYAMLException.java (1)

19-25: Consider updating the Javadoc reference (optional).

The Javadoc mentions "Kubernetes integration," which is accurate in terms of usage but could be updated to reflect that this is now part of the general YAML annotation utilities package.

Consider this minor update:

 /**
  * Public wrapper for SnakeYAML's MarkedYAMLException that exposes the protected constructor
- * for use by YAML parsing components in the Kubernetes integration.
+ * for use by YAML parsing components.
  * <p>
  * This exception provides detailed error context including source marks for both
  * the context and problem locations in YAML files.
  */
annot/src/main/java/com/predic8/membrane/annot/yaml/McYamlIntrospector.java (3)

24-24: Inconsistent annotation lookup usage.

The code mixes AnnotationUtils.findAnnotation (lines 24, 39, 90) with the statically imported findAnnotation (lines 34, 43, 57, 62, 106, 108, 112). This inconsistency reduces readability.

Apply this diff to use the static import consistently:

-        return AnnotationUtils.findAnnotation(method, MCChildElement.class) != null;
+        return findAnnotation(method, MCChildElement.class) != null;

39-39: Inconsistent annotation lookup usage.

Use the statically imported findAnnotation for consistency.

Apply this diff:

-        return AnnotationUtils.findAnnotation(method, MCTextContent.class) != null && method.getName().substring(3).equalsIgnoreCase(key);
+        return findAnnotation(method, MCTextContent.class) != null && method.getName().substring(3).equalsIgnoreCase(key);

90-90: Inconsistent annotation lookup usage.

Use the statically imported findAnnotation for consistency.

Apply this diff:

-                .filter(method -> AnnotationUtils.findAnnotation(method, MCOtherAttributes.class) != null)
+                .filter(method -> findAnnotation(method, MCOtherAttributes.class) != null)
core/src/main/java/com/predic8/membrane/core/kubernetes/BeanDefinition.java (1)

40-40: Consider caching the K8sHelperGeneratorAutoGenerated instance.

Creating a new K8sHelperGeneratorAutoGenerated instance for each BeanDefinition construction may be inefficient if this constructor is called frequently.

Consider using a static cached instance:

+    private static final K8sHelperGenerator K8S_HELPER = new K8sHelperGeneratorAutoGenerated();
+
     public BeanDefinition(WatchAction action, Map<String,Object> m) {
         this.action = action;
         this.m = m;
         Map<String,Object> metadata = (Map<String,Object>) m.get("metadata");
         var kind = (String) m.get("kind");
         if (kind == null)
             kind = "api";
-        isRule = Proxy.class.isAssignableFrom(new K8sHelperGeneratorAutoGenerated().getElement(kind));
+        isRule = Proxy.class.isAssignableFrom(K8S_HELPER.getElement(kind));
         name = (String) metadata.get("name");
annot/src/test/java/com/predic8/membrane/annot/util/CompilerHelper.java (1)

70-85: Reflection + TCCL handling looks sound

Classloader swapping and reflective invocation are wrapped correctly with a finally-block to restore the original TCCL; the in-memory overlay for /demo.yaml is also wired coherently. The behavior of this helper now largely depends on YamlParser.getResult(), which is currently not returning the parsed object (see comment on YamlParser).

core/src/main/java/com/predic8/membrane/core/kubernetes/KubernetesWatcher.java (1)

60-60: Instance-based CRD lookup aligns with new K8sHelperGenerator API

Switching from a static field to new K8sHelperGeneratorAutoGenerated().getCrdSingularNames() matches the new instance‑based helper contract and keeps KubernetesWatcher logic unchanged.

If you ever find this called frequently, you could cache the helper in a static or injected field instead of creating a new instance, but for a typical startup path this is fine.

core/src/main/java/com/predic8/membrane/core/config/spring/k8s/Envelope.java (1)

16-20: Envelope now cleanly delegates spec parsing to shared annot YAML infra

Switching to:

  • BeanRegistry / GenericYamlParser from com.predic8.membrane.annot.yaml,
  • a static K8sHelperGeneratorAutoGenerated instance (K8S_HELPER), and
  • resolving clazz via K8S_HELPER.getElement(kind) in readSpec

makes Envelope reuse the same mapping logic as the generic YAML parser while preserving existing control flow and error handling. The raw Class usage in the GenericYamlParser.parse(...) call is acceptable here given the dynamically resolved types.

Also applies to: 27-29, 37-37, 77-84

annot/src/test/java/com/predic8/membrane/annot/util/StructureAssertionUtil.java (1)

5-21: Consider relaxing Asserter visibility and guarding against null inputs

Using a private nested Asserter type in the public API of assertStructure / clazz is a bit unusual and can confuse tooling and future extensions, even though the current usage via clazz(...) works.

You might want to:

  • Make Asserter public or package‑private instead of private, and
  • Optionally add a null check (e.g. assertNotNull(o1)) before o1.getClass() to produce a clearer assertion failure if parsing ever returns null.

The current implementation is fine for internal tests but could be made more robust with these tweaks.

annot/src/main/java/com/predic8/membrane/annot/yaml/GenericYamlParser.java (1)

30-58: New parseMembraneObject entrypoint and YamlLoader usage look consistent

  • parseMembraneObject(...) correctly walks the event stream until the first mapping and then delegates based on the first scalar key, which matches the intended demo: {} style input.
  • readMembraneObject(...) reuses K8sHelperGenerator for kind→class resolution and feeds straight into the existing parse(...) logic with clear failure when no class is found.
  • Switching object creation to clazz.getConstructor().newInstance() and standardizing scalar reads via YamlLoader.readString(...) (including enums, primitives, map other‑attributes, and reference attributes) improves robustness and centralizes error reporting.

You might consider throwing explicitly when no mapping is encountered instead of returning null from parseMembraneObject(...), but that’s a design choice rather than a correctness issue.

Also applies to: 67-67, 132-171

annot/src/main/java/com/predic8/membrane/annot/yaml/YamlLoader.java (1)

8-65: YamlLoader provides a clear, reusable event-level parsing utility

The helper cleanly encapsulates common SnakeYAML event patterns:

  • readString for scalar values with location-aware errors,
  • readObj to branch into scalars/maps/sequences,
  • readSequence and readMap with proper termination on SequenceEndEvent / MappingEndEvent and detailed error messages.

This is a good foundation for both Envelope and GenericYamlParser; adding type parameters to the List/Map return types would be a minor polish if you want stronger typing, but is not required.

annot/src/main/java/com/predic8/membrane/annot/generator/kubernetes/K8sHelperGenerator.java (2)

85-103: Generated helper now cleanly implements the shared interface and hides internals

The generated class header and imports look good: importing com.predic8.membrane.annot.K8sHelperGenerator and declaring implements K8sHelperGenerator aligns the auto-generated helper with the new interface-based access pattern. Making elementMapping, localElementMapping and crdSingularNames private static instead of public improves encapsulation while still allowing access through the new instance methods below.

Only minor nit: having both this annotation processor and the runtime interface named K8sHelperGenerator can be slightly confusing when reading the code; if this ever gets revisited, renaming the processor to something like K8sHelperClassGenerator would clarify roles, but it’s not functionally required.


115-130: Instance methods correctly wrap the static registries and preserve behavior

The new getLocal, getElement, and getCrdSingularNames implementations correctly delegate to the existing static structures and are consistent with how those maps/lists are populated:

  • getLocal(context, key) returns null when no context map exists, mirroring prior behavior while honoring both original and lower-cased keys inserted via localElementMappingPut.
  • getElement(key) simply forwards to elementMapping.get(key), again preserving the prior key behavior where both original and lower-case variants are present.
  • getCrdSingularNames() exposes the same backing list that was previously public and static, so mutability and semantics remain unchanged.

If you ever want to enforce immutability at the API boundary, consider returning Collections.unmodifiableList(crdSingularNames) from getCrdSingularNames, but that would be a behavioral change and isn’t necessary for this refactor.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 09ef752 and e7a7a25.

📒 Files selected for processing (19)
  • annot/pom.xml (1 hunks)
  • annot/src/main/java/com/predic8/membrane/annot/generator/kubernetes/K8sHelperGenerator.java (2 hunks)
  • annot/src/main/java/com/predic8/membrane/annot/yaml/BeanRegistry.java (1 hunks)
  • annot/src/main/java/com/predic8/membrane/annot/yaml/GenericYamlParser.java (5 hunks)
  • annot/src/main/java/com/predic8/membrane/annot/yaml/McYamlIntrospector.java (4 hunks)
  • annot/src/main/java/com/predic8/membrane/annot/yaml/PublicMarkedYAMLException.java (1 hunks)
  • annot/src/main/java/com/predic8/membrane/annot/yaml/WrongEnumConstantException.java (1 hunks)
  • annot/src/main/java/com/predic8/membrane/annot/yaml/YamlLoader.java (1 hunks)
  • annot/src/test/java/com/predic8/membrane/annot/YAMLParsingTest.java (1 hunks)
  • annot/src/test/java/com/predic8/membrane/annot/util/CompilerHelper.java (1 hunks)
  • annot/src/test/java/com/predic8/membrane/annot/util/StructureAssertionUtil.java (1 hunks)
  • annot/src/test/java/com/predic8/membrane/annot/util/YamlParser.java (1 hunks)
  • core/src/main/java/com/predic8/membrane/core/config/spring/k8s/Envelope.java (3 hunks)
  • core/src/main/java/com/predic8/membrane/core/config/spring/k8s/YamlLoader.java (1 hunks)
  • core/src/main/java/com/predic8/membrane/core/kubernetes/BeanCache.java (1 hunks)
  • core/src/main/java/com/predic8/membrane/core/kubernetes/BeanDefinition.java (1 hunks)
  • core/src/main/java/com/predic8/membrane/core/kubernetes/KubernetesWatcher.java (1 hunks)
  • core/src/test/java/com/predic8/membrane/core/config/spring/k8s/EnvelopeTest.java (1 hunks)
  • core/src/test/java/com/predic8/membrane/core/kubernetes/GenericYamlParserTest.java (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-22T19:49:29.473Z
Learnt from: predic8
Repo: membrane/api-gateway PR: 2156
File: pom.xml:0-0
Timestamp: 2025-09-22T19:49:29.473Z
Learning: In the Membrane API Gateway project, jackson-annotations is pinned to version "2.20" instead of using ${jackson.version} (2.20.0) because version 2.20.0 is not available in Maven repository yet for jackson-annotations, while it is available for jackson-core and jackson-databind. This version inconsistency is intentional and necessary due to different release schedules between Jackson modules.

Applied to files:

  • annot/pom.xml
🧬 Code graph analysis (6)
annot/src/test/java/com/predic8/membrane/annot/util/YamlParser.java (1)
annot/src/main/java/com/predic8/membrane/annot/yaml/GenericYamlParser.java (1)
  • GenericYamlParser (28-254)
annot/src/test/java/com/predic8/membrane/annot/YAMLParsingTest.java (3)
annot/src/test/java/com/predic8/membrane/annot/util/CompilerHelper.java (1)
  • CompilerHelper (35-220)
annot/src/test/java/com/predic8/membrane/annot/SpringConfigurationXSDGeneratingAnnotationProcessorTest.java (1)
  • SpringConfigurationXSDGeneratingAnnotationProcessorTest (23-66)
annot/src/test/java/com/predic8/membrane/annot/util/StructureAssertionUtil.java (1)
  • StructureAssertionUtil (5-23)
core/src/test/java/com/predic8/membrane/core/kubernetes/GenericYamlParserTest.java (1)
annot/src/main/java/com/predic8/membrane/annot/yaml/GenericYamlParser.java (1)
  • GenericYamlParser (28-254)
annot/src/main/java/com/predic8/membrane/annot/yaml/YamlLoader.java (1)
core/src/main/java/com/predic8/membrane/core/config/spring/k8s/YamlLoader.java (1)
  • YamlLoader (24-32)
core/src/main/java/com/predic8/membrane/core/config/spring/k8s/Envelope.java (3)
annot/src/main/java/com/predic8/membrane/annot/yaml/GenericYamlParser.java (1)
  • GenericYamlParser (28-254)
annot/src/main/java/com/predic8/membrane/annot/yaml/YamlLoader.java (1)
  • YamlLoader (8-66)
core/src/main/java/com/predic8/membrane/core/config/spring/k8s/YamlLoader.java (1)
  • YamlLoader (24-32)
annot/src/main/java/com/predic8/membrane/annot/yaml/GenericYamlParser.java (2)
annot/src/main/java/com/predic8/membrane/annot/yaml/McYamlIntrospector.java (1)
  • McYamlIntrospector (12-115)
annot/src/main/java/com/predic8/membrane/annot/yaml/YamlLoader.java (1)
  • YamlLoader (8-66)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Analyze (java)
🔇 Additional comments (8)
annot/src/main/java/com/predic8/membrane/annot/yaml/PublicMarkedYAMLException.java (1)

15-15: Package refactoring is correct and complete—no breaking changes.

Verification confirms that PublicMarkedYAMLException is only used within the same package (com.predic8.membrane.annot.yaml) by GenericYamlParser.java, which can access it without an explicit import. No other files depend on this class, so the package move introduces no breaking changes.

annot/src/main/java/com/predic8/membrane/annot/yaml/WrongEnumConstantException.java (1)

15-15: Package relocation verified as complete.

The class has been successfully relocated to com.predic8.membrane.annot.yaml. All references in the codebase (found in GenericYamlParser.java) are in the same package and properly updated. No orphaned references to the old package location remain.

However, note a potential null pointer issue in the constructor: clazz.getEnumConstants() can return null if the argument is not an enum type, which would cause an NPE on the subsequent Arrays.stream() call. Consider adding a null check or validation before dereferencing the array.

core/src/main/java/com/predic8/membrane/core/kubernetes/BeanCache.java (1)

18-18: LGTM! Import updated for relocated BeanRegistry.

The import correctly reflects the BeanRegistry relocation to the annot.yaml package.

core/src/test/java/com/predic8/membrane/core/config/spring/k8s/EnvelopeTest.java (1)

25-25: LGTM! Import updated for relocated BeanRegistry.

The import correctly reflects the BeanRegistry relocation to the annot.yaml package.

core/src/test/java/com/predic8/membrane/core/kubernetes/GenericYamlParserTest.java (1)

49-51: LGTM! Test updated to use auto-generated K8sHelper.

The change from an anonymous K8sHelperGenerator implementation to a direct instantiation of K8sHelperGeneratorAutoGenerated aligns with the architectural shift from static field-based to instance method-based access patterns.

annot/src/main/java/com/predic8/membrane/annot/yaml/BeanRegistry.java (1)

14-18: LGTM! BeanRegistry successfully relocated to annot.yaml package.

The interface relocation is part of the broader architectural refactoring to consolidate YAML parsing functionality in the annot module. All dependent files have been updated with the new import path.

core/src/main/java/com/predic8/membrane/core/config/spring/k8s/YamlLoader.java (1)

16-31: LGTM! YamlLoader correctly refactored and helper methods properly migrated.

Verification confirms all four helper methods (readString, readObj, readSequence, readMap) have been successfully migrated to the annot module's YamlLoader at annot/src/main/java/com/predic8/membrane/annot/yaml/YamlLoader.java. The core module's YamlLoader now correctly delegates parsing to Envelope, aligning with the architectural consolidation of YAML parsing logic in the annot module.

annot/src/test/java/com/predic8/membrane/annot/YAMLParsingTest.java (1)

11-31: Test logic is correct; will pass once YamlParser returns the parsed object

The test compiles a minimal DemoElement, verifies annotation processing, then parses:

demo: {}

and asserts that the returned object’s runtime class is DemoElement. This is exactly what the new YAML parsing path should guarantee.

Right now the assertion cannot succeed because parseYAML(...) ultimately returns the constant true from YamlParser.getResult(). Once YamlParser is fixed to return the parsed instance, this test should provide good coverage for the new flow.

Comment thread annot/pom.xml
Comment thread annot/src/test/java/com/predic8/membrane/annot/util/YamlParser.java
Comment thread annot/src/test/java/com/predic8/membrane/annot/util/YamlParser.java
….java

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
annot/src/test/java/com/predic8/membrane/annot/util/YamlParser.java (1)

21-23: Optional: provide a clearer error when the YAML resource is missing

requireNonNull(getClass().getResourceAsStream(resourceName)) will throw a bare NullPointerException if the resource is not on the classpath, which can be harder to diagnose. You could pass a custom message to requireNonNull(...) to make test failures more self‑explanatory.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e7a7a25 and 3e733dc.

📒 Files selected for processing (1)
  • annot/src/test/java/com/predic8/membrane/annot/util/YamlParser.java (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
annot/src/test/java/com/predic8/membrane/annot/util/YamlParser.java (2)
annot/src/main/java/com/predic8/membrane/annot/generator/kubernetes/K8sHelperGenerator.java (1)
  • K8sHelperGenerator (30-193)
annot/src/main/java/com/predic8/membrane/annot/yaml/GenericYamlParser.java (1)
  • GenericYamlParser (28-254)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Analyze (java)
🔇 Additional comments (1)
annot/src/test/java/com/predic8/membrane/annot/util/YamlParser.java (1)

12-33: Parsed result is now stored and exposed correctly

YamlParser now wires GenericYamlParser with the generated K8sHelperGeneratorAutoGenerated, uses UTF‑8 with try‑with‑resources, and persists the parsed object in a final result field that getResult() returns. This resolves the earlier issue where the parsed value was discarded.

Comment thread annot/src/test/java/com/predic8/membrane/annot/util/YamlParser.java Outdated
….java

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@rrayst
Copy link
Copy Markdown
Member

rrayst commented Nov 19, 2025

/ok-to-test

rrayst and others added 2 commits November 19, 2025 13:30
# Conflicts:
#	annot/src/main/java/com/predic8/membrane/annot/yaml/McYamlIntrospector.java
@rrayst rrayst merged commit e4bd3b9 into master Nov 19, 2025
1 of 4 checks passed
@rrayst rrayst deleted the yaml-parsing-test-infra branch November 19, 2025 13:06
@coderabbitai coderabbitai Bot mentioned this pull request Nov 20, 2025
This was referenced Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants