Stackoverflow error with cyclic references involving allOf
Maintainers usually reply within 5 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
Research direction
Reproduce the failure with the supplied schema and openapi-diff spec.yaml spec.yaml. Trace the recursive calls through SchemaDiff, ReferenceDiffCache, ComposedSchemaDiffResult, and ArraySchemaDiffResult, using the stack trace as the entry point. Done means the recursive allOf schema comparison completes without a StackOverflowError.
Written by the indexing model from the issue text.
Description
Given this schema definition
openapi: 3.0.1
info:
title: recursive test
version: '1.0'
servers:
- url: 'http://localhost:8000/'
paths:
/ping:
get:
operationId: ping
responses:
'200':
description: OK
content:
text/plain:
schema:
$ref: '#/components/schemas/B'
components:
schemas:
B:
type: object
properties:
message:
type: string
message2:
type: string
details:
type: array
items:
allOf:
- $ref: '#/components/schemas/B'
and running openapi-diff spec.yaml spec.yaml I get stack overflow error
Exception in thread "main" java.lang.StackOverflowError
at java.base/java.util.Arrays.spliterator(Arrays.java:5482)
at java.base/java.util.Arrays.stream(Arrays.java:5633)
at java.base/java.util.Arrays.stream(Arrays.java:5614)
at java.base/java.util.stream.Stream.of(Stream.java:1188)
at com.qdesrame.openapi.diff.model.ChangedExtensions.getChangedElements(ChangedExtensions.java:37)
at com.qdesrame.openapi.diff.model.ComposedChanged.isChanged(ComposedChanged.java:19)
at com.qdesrame.openapi.diff.model.Changed.isUnchanged(Changed.java:21)
at com.qdesrame.openapi.diff.utils.ChangedUtils.isUnchanged(ChangedUtils.java:9)
at com.qdesrame.openapi.diff.utils.ChangedUtils.isChanged(ChangedUtils.java:17)
at com.qdesrame.openapi.diff.compare.ExtensionsDiff.diff(ExtensionsDiff.java:79)
at com.qdesrame.openapi.diff.compare.schemadiffresult.SchemaDiffResult.diff(SchemaDiffResult.java:61)
at com.qdesrame.openapi.diff.compare.SchemaDiff.computeDiff(SchemaDiff.java:316)
at com.qdesrame.openapi.diff.compare.SchemaDiff.computeDiff(SchemaDiff.java:27)
at com.qdesrame.openapi.diff.compare.ReferenceDiffCache.cachedDiff(ReferenceDiffCache.java:51)
at com.qdesrame.openapi.diff.compare.SchemaDiff.diff(SchemaDiff.java:282)
at com.qdesrame.openapi.diff.compare.schemadiffresult.SchemaDiffResult.diff(SchemaDiffResult.java:75)
at com.qdesrame.openapi.diff.compare.schemadiffresult.ComposedSchemaDiffResult.diff(ComposedSchemaDiffResult.java:85)
at com.qdesrame.openapi.diff.compare.SchemaDiff.computeDiff(SchemaDiff.java:316)
at com.qdesrame.openapi.diff.compare.SchemaDiff.computeDiff(SchemaDiff.java:27)
at com.qdesrame.openapi.diff.compare.ReferenceDiffCache.cachedDiff(ReferenceDiffCache.java:51)
at com.qdesrame.openapi.diff.compare.SchemaDiff.diff(SchemaDiff.java:282)
at com.qdesrame.openapi.diff.compare.schemadiffresult.ArraySchemaDiffResult.diff(ArraySchemaDiffResult.java:31)
The problem occurs only with allOf. Replacing it with oneOf fixes the problem.
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 191
- Avg merge
- 4d 23h
- Merged PRs (30d)
- 1
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from OpenAPITools/openapi-diff
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
OpenAPITools/openapi-diff#506 ·
Maintainers usually reply within 5 days
-
HtmlRender: Notes of Parameters shows always the new descriptionPossibly taken @Inf1mum claimed this 6 days ago. Opengood first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
OpenAPITools/openapi-diff#364 ·
Maintainers usually reply within 5 days
-
Render capabilities
Difficulty 5/5 Over a week Newbie friendliness 20/100
OpenAPITools/openapi-diff#959 ·
Maintainers usually reply within 5 days
-
Render capabilities
Difficulty 5/5 Over a week Newbie friendliness 18/100
OpenAPITools/openapi-diff#958 ·
Maintainers usually reply within 5 days
-
Render capabilities
Difficulty 3/5 1-2 days Newbie friendliness 55/100
OpenAPITools/openapi-diff#957 ·
Maintainers usually reply within 5 days
All issues in OpenAPITools/openapi-diff
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
eclipse-tradista/tradista#371 ·
Maintainers usually reply within 1 day
-
critical
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
mars-sim/mars-sim#2199 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
projeto-ong-amar/projeto-ong-amar-backend#26 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
primefaces/primefaces#15568 ·
Maintainers usually reply within 1 day
-
崩溃日志只按 CRLF 分行Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
PCL-Community/PCL-CE#3872 ·
Maintainers usually reply within 1 day