Skip to content
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

Stackoverflow Error with cyclic reference and adding new property #144

Closed
RichardSieg opened this issue Apr 17, 2020 · 0 comments · Fixed by #331
Closed

Stackoverflow Error with cyclic reference and adding new property #144

RichardSieg opened this issue Apr 17, 2020 · 0 comments · Fixed by #331
Labels
Milestone

Comments

@RichardSieg
Copy link

RichardSieg commented Apr 17, 2020

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)
@RichardSieg RichardSieg changed the title Stackoverflow Error with cyclic reference and renaming of a property Stackoverflow Error with cyclic reference and adding new property Apr 17, 2020
@joschi joschi added this to the 2.1.0 milestone Mar 3, 2022
@joschi joschi added the bug label Mar 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants