Closed
Description
Hi there!
When we have a cyclic reference and one of the properties gets renamed, the tool throws a Stackoverflow Error.
Here is a minimal working example. The only thing that differs between those two is the new property propname2
in B.
Old yaml
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/A"
components:
schemas:
A:
type: object
properties:
propname:
$ref: "#/components/schemas/B"
B:
type: object
properties:
propname:
$ref: "#/components/schemas/A"
New yaml
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/A"
components:
schemas:
A:
type: object
properties:
propname2:
$ref: "#/components/schemas/B"
B:
type: object
properties:
propname2:
$ref: "#/components/schemas/A"
Beginning of the output:
==========================================================================
== API CHANGE LOG ==
==========================================================================
recursive test
--------------------------------------------------------------------------
-- What's Changed --
--------------------------------------------------------------------------
- GET /ping
Return Type:
- Changed 200 OK
Media types:
- Changed text/plain
Schema: Broken compatibility
Missing property: propname (object)
--------------------------------------------------------------------------
-- Result --
--------------------------------------------------------------------------
API changes broke backward compatibility
--------------------------------------------------------------------------
Exception in thread "main" java.lang.StackOverflowError
at java.util.regex.Pattern$GroupHead.match(Pattern.java:4660)
at java.util.regex.Pattern$Branch.match(Pattern.java:4606)
at java.util.regex.Pattern$BmpCharProperty.match(Pattern.java:3800)
at java.util.regex.Pattern$Start.match(Pattern.java:3463)
at java.util.regex.Matcher.search(Matcher.java:1248)
at java.util.regex.Matcher.find(Matcher.java:664)
at java.util.Formatter.parse(Formatter.java:2549)
at java.util.Formatter.format(Formatter.java:2501)
at java.util.Formatter.format(Formatter.java:2455)
at java.lang.String.format(String.java:2940)