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

Could not resolve recursive references when trying to generate swaggers #68

Closed
sdementen opened this issue Nov 18, 2020 · 2 comments
Closed

Comments

@sdementen
Copy link

hello, I would like to use hypothesis-jsonschema to test a library to manage swagger specifications (https://github.com/sdementen/oasapi).
I am using the jsonschema for the swagger https://github.com/sdementen/oasapi/blob/master/src/oasapi/schemas/schema_swagger.json.

When I try to run the following test

schema = json.load(Path(r"..\oasapi\src\oasapi\schemas\schema_swagger.json").open())

@given(from_schema(schema))
def test_swagger(value):
    assert isinstance(value, dict)

I receive the error hypothesis_jsonschema._canonicalise.HypothesisRefResolutionError: Could not resolve recursive references in schema={...}.

Am I using the library properly ? if so, is there some workaround to avoid this infinite recursion (even if it restrains the range of objects that could be generated by hypothesis) ?

@Zac-HD
Copy link
Member

Zac-HD commented Nov 18, 2020

Hi @sdementen - unfortunately recursive references aren't supported yet - fixing that is #33, our oldest open issue! In the meantime, https://schemathesis.readthedocs.io might be a better tool for what you're trying to do.

There isn't really a workaround at the moment either, but I think it might be possible to add one... I'll post more on the older issue; closing this one just to de-duplicate.

@sdementen
Copy link
Author

Ok, i will watch the other issue.
For schemathesis, I am not trying to generate api calls matching a swagger (to test the API represented by the swagger) but really generating compliant swagger files (as my lib is about manipulating swagger files).

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