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

[BUG] Schemathesis Can't handle a simple recursive reference: #1611

Closed
2 tasks done
fscarlato opened this issue Sep 19, 2022 · 2 comments
Closed
2 tasks done

[BUG] Schemathesis Can't handle a simple recursive reference: #1611

fscarlato opened this issue Sep 19, 2022 · 2 comments
Assignees
Labels
Status: Needs Triage Requires initial assessment to categorize and prioritize Type: Bug Errors or unexpected behavior

Comments

@fscarlato
Copy link

Checklist

I'm still getting:
hypothesis.errors.Unsatisfiable: Currently, Schemathesis can't generate data for this operation due to recursive references in the operation definition. See more information in this issue - #947

And the schema is a simple Parent-Child relationship:

CategoryChildCreate:
  required:
    - category_id
    - category_label
  type: "object"
  properties:
    category_id:
      $ref: "#/components/schemas/CategoryId"
    category_label:
      type: "string"
    description:
      type: string
      maxLength: 255
    image:
      type: "string"
      format: "base64"
    children:
      type: array
      items:
        $ref: "#/components/schemas/CategoryChildCreate"

If this is a recursion level problem, why it isn't solved by defining a maximum depth?
Can this maximum depth be specified from the command line?

@fscarlato fscarlato added Status: Needs Triage Requires initial assessment to categorize and prioritize Type: Bug Errors or unexpected behavior labels Sep 19, 2022
@Stranger6667
Copy link
Member

Hi!

I know that is long overdue and I am sorry for not getting back to you earlier.

The underlying issue is on the hypothesis-jsonschema side and Schemathesis works around it by schema inlining and cutting of leaves that contain recursive references. That is quite hacky as we need to avoid over-inlining and at the same time resolve references deep enough.

It recently got a significant improvement in 3.18.0 and it should cover the schema you provided too. This approach has limitations as it does not work on references that recurse via multiple intermediate references. I am going to address it in a separate issue and close this one.

But ideally, we'd like to rewrite hypothesis-jsonschema so it supports recursive references natively.

@Stranger6667
Copy link
Member

Can this maximum depth be specified from the command line?

Not at the moment, but I'd consider this in the new issue where I'll gather the current limitations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Triage Requires initial assessment to categorize and prioritize Type: Bug Errors or unexpected behavior
Projects
None yet
Development

No branches or pull requests

2 participants