Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #241
Closed
Open
Issue created Jun 07, 2018 by Administrator@rootContributor

debugSupportingFiles causes Infinite recursion

Created by: matteomazza91

Description

the option debugSupportingFiles causes a com.fasterxml.jackson.databind.JsonMappingException: Infinite recursion (StackOverflowError) exception.
This only occurs if a Model-schema reference another model-schema

As (part of) the stack trace point out, the CodegenModel has a "parentModel" property that cause the infinite recursion:

[main] INFO org.openapitools.codegen.DefaultGenerator - ############ Supporting file info ############
com.fasterxml.jackson.databind.JsonMappingException: Infinite recursion (StackOverflowError) (through reference chain:      org.openapitools.codegen.CodegenModel["parentModel"]->org.openapitools.codegen.CodegenModel["children"]->java.util.ArrayList[0]->org.openapitools.codegen.CodegenModel["parentModel"]->org.openapitools.codegen.CodegenModel["children"]->java.util.ArrayList[0]->org.openapitools.codegen.CodegenModel["parentModel"]->org.openapitools.codegen.CodegenModel["children"]->java.util.ArrayList[0]->org.openapitools.codegen.CodegenModel["parentModel"]->org.openapitools.codegen.CodegenModel["children"]->java.util.ArrayList[0]->org.openapitools.codegen.CodegenModel["parentModel"]
openapi-generator version
OpenAPI declaration file content or url

This is the OpenAPI that generates the issue: https://pastebin.com/c5tQgWQ9

Note: if the line - $ref: "#/components/schemas/UserDetail" is removed from the User schema, the exception is not raised.

Command line used for generation

java -jar openapi-generator-cli.jar generate -i /path/to/input.yaml -g java -o test/client/petsore/java -DdebugSupportingFiles=true

Steps to reproduce
  • create the file /path/to/input.yaml with the content of https://pastebin.com/c5tQgWQ9
  • run java -jar openapi-generator-cli.jar generate -i /path/to/input.yaml -g java -o test/client/petsore/java -DdebugSupportingFiles=true
Suggest a fix/enhancement

the call to the debugging method is present in the buildSupportFileBundle method of org.openapitools.codegen.DefaultGenerator class

if (System.getProperty("debugSupportingFiles") != null) {
        LOGGER.info("############ Supporting file info ############");
        Json.prettyPrint(bundle);
 }
Assignee
Assign to
Time tracking