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

tcases:api: Circular references cause StackOverflowError #177

Closed
sid0704 opened this issue Jun 15, 2021 · 2 comments
Closed

tcases:api: Circular references cause StackOverflowError #177

sid0704 opened this issue Jun 15, 2021 · 2 comments

Comments

@sid0704
Copy link

sid0704 commented Jun 15, 2021

I am working with Tcases for OpenAPI wherein I am using my own Open API documentation in JSON format to generate the test cases. I am getting a BUILD FAILURE message when I am using the command mvn tcases:api in the terminal or tcases:api as goal. This error is specific to this API document (but there is no error in the API), when I am using this project for other API documentation it seems to work fine. I am attaching the below screenshot for your reference and the API documentation which you can use for checking. Thankyou!
OpenAPI-17-06.txt

image
image (1)

@kerrykimbrough
Copy link
Contributor

The trouble arises from circular references between certain schemas. For example, schema AcctAggregator has a consent property matching schema Consent. But schema Consent has a property named consentAisps which is array of AcctAggregator items. Traversing this circular structure results in an infinite loop and ultimately a StackOverflowError.

It's possible to fix the Tcases code that traverses this structure. But deeper problems remain. For the basic Schema class defined by the swagger-parser, the implementation of the hashCode method also gets trapped in this infinite loop. That breaks Tcases at a fundamental level that is not easy to fix.

If at all possible, you should try to rework this OpenAPI spec to avoid such circular references.

@kerrykimbrough kerrykimbrough changed the title Stack overflow Error when running tcases:api goal tcases:api: Circular references cause StackOverflowError Jun 20, 2021
@kerrykimbrough
Copy link
Contributor

The first symptom of this problem was the infinite loop that occurs when Tcases analyzes the circular structure of schema references. This symptom has been fixed, which avoids the hideous StackOverflowError. But ultimately, when Tcases tries to generate the request input model, this circular structure is an intractable obstacle.

The purpose of the input model, which is to describe all possible values for the input, can't be met without going in circles. The only way out is to eventually stop with some kind of stub. But that leaves an abstract description that can't be resolved to the concrete values needed to generate real tests.

For now, the resolution to this issue is to recognize and report the situation as a failure. No further fix is planned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants