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

Allow inherited lists as reference types #642

Open
wants to merge 1 commit into
base: v2
Choose a base branch
from
Open

Conversation

Dresel
Copy link

@Dresel Dresel commented Jan 24, 2024

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
Copy link
Author

Dresel commented Jan 24, 2024

Let me fix those tests first 😄

@Qualizorg
Copy link

Can we accelerate this?

@Rick-van-Dam
Copy link

Any progress on this bug? We just got hit by this and seems to be pretty serious this is not working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants