fern-api / fern

Input OpenAPI. Output SDKs and Docs.
https://buildwithfern.com
Apache License 2.0
2.58k stars 134 forks source link

[Bug] `fern check` does not detect recursive examples #4135

Open dsinghvi opened 1 month ago

dsinghvi commented 1 month ago

Describe the bug

fern check does not detect infinitely recursive types.

To reproduce

Create the following yaml file and run fern check.

types: 
  Node: 
   properties: 
    child: Node

Here is a fern definition with the repro recursive.zip

Expected behavior

The CLI should emit an error along the lines of Node is a cyclic type and then print out the cycle Node -> node.

Additional context

This should be added as an additional validation rule in the validation directory.

Schnides123 commented 1 month ago

Hey, mind if I hop on this one? I think I have an idea of how you could detect cycles for this

dannysheridan commented 1 month ago

Hey, mind if I hop on this one? I think I have an idea of how you could detect cycles for this

Absolutely & welcome to Fern! We review contributor PRs within 5 business days and are always up for chatting through questions you have here in the comments.

Schnides123 commented 1 month ago

Draft PR is open here. One thing I'm noticing in the E2E testing is that there are some recursive types already defined in test files, like this one. How do we want to update this?