OpenAPI.NET icon indicating copy to clipboard operation
OpenAPI.NET copied to clipboard

Problem with property with reference to itself.

Open RenatoPacheco opened this issue 3 years ago • 5 comments

Good Morning.

I have a recursive reference problem. I have an object, which has an exception among its properties, and in it has a property of type exception, thus making a recursive reference. I tried to apply JsonIgnore to my property but OpenAPI doesn't consider it.

I'm using a package to build Swagger, and there's no use in applying filters, because it waits for OpenAPI to extract the data, so I can filter, so there's nothing I can do in Swagger.

How can I make it so that OpenAPI can ignore properties marked with JsonIgnore (or whatever notation is possible) so that I don't crash my process?

Thanks.

RenatoPacheco avatar Jul 06 '22 12:07 RenatoPacheco

OpenApi relies on Sharpyaml for deserialization :) So json attributes has no effect

VisualBean avatar Jul 27 '22 14:07 VisualBean

Thanks for the interaction.

I thought actually a notation for Json wouldn't solve the problem, but if there was a filter I could apply to the OpenAPI, I could create a notation, or even ignore properties of specific class types like exeception.

RenatoPacheco avatar Aug 16 '22 10:08 RenatoPacheco

Can you give an example because we do support models that reference themselves?

darrelmiller avatar Sep 27 '22 13:09 darrelmiller

I have a class that among its properties I store an exception. The problem is that the Exception class (System.Exception) has an InnerException property, which is of type Exception, and when Swagger uses OpenAPI to analyze the class, it works in a loop.

RenatoPacheco avatar Oct 31 '23 14:10 RenatoPacheco