azure-functions-openapi-extension icon indicating copy to clipboard operation
azure-functions-openapi-extension copied to clipboard

Allow inherited lists as reference types

Open Dresel opened this issue 2 years ago • 3 comments

This addresses the issue that inherited lists (or custom implementations of IEnumerable<T>) cannot be used and will lead to runtime exceptions (e.g. #380).

Implementation Detail:

  • Distinguish between framework implementations of enumerable (checking via Namespace?.StartsWith("System")) and custom / inherited enumerable implementations
  • Extend the ListObjectTypeVisitor to produce a reference if a custom list is used (as an alternative we could implement another Visitor)
  • Adding IsReferencedOpenApiArray checks where necessary

I added additional unit / integration tests to cover this use case.

Let me know what you think and if you favor changes / a different implementation. If accepted this approach could be applied for dictionaries also (#313), see proof of concept branch Dresel:v2-dictionary-as-reference-types.

Dresel avatar Jan 24 '24 12:01 Dresel

Let me fix those tests first 😄

Dresel avatar Jan 24 '24 13:01 Dresel

Can we accelerate this?

Qualizorg avatar Mar 07 '24 08:03 Qualizorg