Repository navigation
Conversation
…chemas in markdown output The markdown renderer kept a global set of already-rendered schemas. Swagger Schema implements equals/hashCode by value, so any second schema with identical content (or a repeated reference to the same component) had its whole subtree silently dropped from the report. Replace the global set with an identity-based set of the schemas on the current recursion path: recursive definitions still terminate, while repeated references and value-identical subtrees are now fully reported. Signed-off-by: Inf1mum <[email protected]>
There was a problem hiding this comment.
1 issue found across 6 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="core/src/main/java/org/openapitools/openapidiff/core/output/MarkdownRender.java">
<violation number="1" location="core/src/main/java/org/openapitools/openapidiff/core/output/MarkdownRender.java:46">
P3: This removes the existing protected `handledSchemas` field from a public renderer, breaking subclasses that access it. Preserve `handledSchemas` as the field name (or provide a compatibility alias) while changing its set implementation.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
| protected RefPointer<Schema<?>> refPointer = new RefPointer<>(RefType.SCHEMAS); | ||
| protected ChangedOpenApi diff; | ||
| protected Set<Schema<?>> handledSchemas = new HashSet<>(); | ||
| protected Set<Schema<?>> visitingSchemas = Collections.newSetFromMap(new IdentityHashMap<>()); |
There was a problem hiding this comment.
P3: This removes the existing protected handledSchemas field from a public renderer, breaking subclasses that access it. Preserve handledSchemas as the field name (or provide a compatibility alias) while changing its set implementation.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At core/src/main/java/org/openapitools/openapidiff/core/output/MarkdownRender.java, line 46:
<comment>This removes the existing protected `handledSchemas` field from a public renderer, breaking subclasses that access it. Preserve `handledSchemas` as the field name (or provide a compatibility alias) while changing its set implementation.</comment>
<file context>
@@ -42,7 +43,7 @@ public class MarkdownRender implements Render {
protected RefPointer<Schema<?>> refPointer = new RefPointer<>(RefType.SCHEMAS);
protected ChangedOpenApi diff;
- protected Set<Schema<?>> handledSchemas = new HashSet<>();
+ protected Set<Schema<?>> visitingSchemas = Collections.newSetFromMap(new IdentityHashMap<>());
/**
* A parameter which indicates whether or not metadata (summary and metadata) changes should be
</file context>
Suggested change
| protected Set<Schema<?>> visitingSchemas = Collections.newSetFromMap(new IdentityHashMap<>()); | |
| protected Set<Schema<?>> handledSchemas = Collections.newSetFromMap(new IdentityHashMap<>()); | |
| protected Set<Schema<?>> visitingSchemas = handledSchemas; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #523
MarkdownRenderkept a globalhandledSchemasset (from the 2022 stack-overflow fix) keyed bySchema.equals/hashCode, which are value-based: any second reference to the same component — and any value-identical subtree — was treated as already rendered and silently dropped from the report, so enum changes and nested properties vanished from the .md output.The set is replaced with an identity-based set of schemas on the current recursion path (added on entry, removed on exit): true recursive definitions still terminate, while repeated references now render in full under every occurrence. Both issue samples now render complete output; 4 new fixture-based regressions (all fail on master). Full reactor
mvn testgreen (272 core tests).Summary by cubic
Fixes #523: repeated and value-identical schemas were silently dropped from markdown output.
MarkdownRenderkept a global set of handled schemas keyed bySchema.equals/hashCode, which are value-based, so any second reference to the same component — or any value-identical subtree — was treated as already rendered and its enum changes and nested properties vanished from the report.Replaced the global set with an identity-based set of schemas on the current recursion path (added on entry, removed on exit), so true recursive definitions still terminate while repeated references now render in full under every occurrence.
master; full reactor test suite passes (272 core tests).Written for commit 0d30511. Summary will update on new commits.