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

Fix: Avoid caching AnnotationIntrospector to support custom module loading #4728

Conversation

sahil-ramagiri
Copy link
Contributor

@sahil-ramagiri sahil-ramagiri commented Sep 1, 2024

Do not cache the value of '_intr' because users can load custom modules later after swagger is configured, and we want to utilize their annotation inspection, just like jackson would do.

@sahil-ramagiri
Copy link
Contributor Author

Hi @frantuma,

I’d like to draw your attention to an issue regarding the binding of the annotation introspector.

Issue: Currently, binding the annotation introspector to _intr causes a divergence in functionality between Swagger's annotation introspector and Jackson's annotation introspector. This could lead to inconsistencies, especially when users extend Jackson with custom modules that perform custom annotation introspection.

Solution: To address this, I propose that we avoid binding the introspector directly and instead retrieve the current annotation introspector from _mapper. This approach ensures that both Swagger and Jackson utilize the same introspector, maintaining functionality and consistency across the system.

Use Case: This change is particularly beneficial for users implementing custom annotation introspection

I have referenced an implementation that demonstrates adding sealed class support without @JsonSubtype annotations.

Please let me know your thoughts or if you need any additional information.

Best regards.

@sahil-ramagiri
Copy link
Contributor Author

Hello @micryc, can I bring your attention to this PR. I believe this PR bring net positive value to the project, thoughts?

…ading

We do not cache the value of '_intr' because users can load custom modules later after swagger is configured, and we want to utilize their annotation inspection, just like jackson would do.
@frantuma frantuma force-pushed the fix/annotation-introspector-caching branch from 9223330 to 388f4ca Compare January 2, 2025 10:30
@frantuma frantuma merged commit 9279ae3 into swagger-api:master Jan 2, 2025
6 checks passed
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.

2 participants