wwwlicious / servicestack-introspec

An introspection and specification plugin for ServiceStack
Other
14 stars 5 forks source link

ReflectionEnricher Stackoverflow exception #17

Open wwwlicious opened 7 years ago

wwwlicious commented 7 years ago

The reflectionenricher fails to detect circular type references in properties which leads to a stackoverflow exception.

Found this issue when trying to use ValidationResult as a property in a DtoResponse. It contains a property of IRequest which itself contains an IResponse property which contains an IRequest property and thus creates an infinite loop.

Need to add a check when using the property enricher that it does not process a type already in the parent tree and if so instead create a symbolic link in the spec (something we don't really have afaik)

wwwlicious commented 7 years ago

Example of circular reference which 'slays'. Perhaps a reference/linking syntax would be better for returned or nested items (see openApi for an example of this)

public class Thing {
  public More More {  get; set; }
}
public class More { 
  public Thing { get; set; }
}