Skip to content

Issue 422 #771

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ protected static Schema<?> resolveComposedSchema(
updatedVisitedRefs.add(composed.get$ref());
composed = refPointer.resolveRef(components, composed, composed.get$ref());
composed = resolveComposedSchema(components, composed, updatedVisitedRefs);
schema = addSchema(schema, composed);
addSchema(schema, composed);
}
}
composedSchema.setAllOf(null);
Expand Down Expand Up @@ -340,8 +340,8 @@ public DeferredChanged<ChangedSchema> computeDiffForReal(
left = refPointer.resolveRef(this.leftComponents, left, getSchemaRef(left));
right = refPointer.resolveRef(this.rightComponents, right, getSchemaRef(right));

left = resolveComposedSchema(leftComponents, left, new HashSet<>());
right = resolveComposedSchema(rightComponents, right, new HashSet<>());
left = resolveComposedSchema(leftComponents, left, refSet.getLeftKeys());
right = resolveComposedSchema(rightComponents, right, refSet.getRightKeys());

// If type of schemas are different, just set old & new schema, set changedType to true in
// SchemaDiffResult and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,20 @@ public class RecursiveSchemaSet {
HashSet<String> leftKeys = new HashSet<>();
HashSet<String> rightKeys = new HashSet<>();

public HashSet<String> getLeftKeys() {
return leftKeys;
}

public HashSet<String> getRightKeys() {
return rightKeys;
}

public boolean contains(CacheKey key) {
return leftKeys.contains(key.getLeft()) || rightKeys.contains(key.getRight());
}

public void put(CacheKey key) {
leftKeys.add(key.getLeft());
leftKeys.add(key.getRight());
rightKeys.add(key.getRight());
}
}
11 changes: 11 additions & 0 deletions core/src/test/resources/recursive_model_1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ components:
type: string
message2:
type: string
recursiveDirect:
$ref: '#/components/schemas/B'
recursiveAllOf:
allOf:
- $ref: '#/components/schemas/B'
recursiveOneOf:
oneOf:
- $ref: '#/components/schemas/B'
recursiveAnyOf:
anyOf:
- $ref: '#/components/schemas/B'
details:
type: array
items:
Expand Down