You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rather than creating a new ModelConverters, OpenAPI 3.1 should be enabled on the default implementation. Using version 3.1 is a global setting anyway. The ModelConverters class should not have any public constructor, as it is only meant to be used as a singleton. Keeping the constructor private should prevent such errors in the future.
The text was updated successfully, but these errors were encountered:
@papegaaij thanks for reporting and investigating this. You are right about the issue, this should be however solved by #4433 (just merged and released). Some more tweaks will follow but this should solve your immediate problem. Please reopen ticket if this is not the case.
As for the public constructor, PR above chooses another path, mainly to maintain API backward compatibility, even if reason of having public constructors is purely historical.
@frantuma this does indeed resolve the issue, thanks! Perhaps you can make the ModelConverters.getInstance method without the boolean deprecated? I still had some references to this method in our code, which caused issues.
When OpenAPI 3.1 is enabled,
ParameterProcessor
no longer uses the global singletonModelConverters.getInstance()
, but instead creates a new instance. This new instance obviously does not know about any custom model resolvers. The faulty code is here: https://github.com/swagger-api/swagger-core/blob/v2.2.12/modules/swagger-core/src/main/java/io/swagger/v3/core/util/ParameterProcessor.java#L70-L74 . The same problem exists inAnnotationsUtils.resolveSchemaFromType
. This breaks our OpenAPI generation completely if we try to switch to 3.1, because types are resolved with totally incorrect names.Rather than creating a new
ModelConverters
, OpenAPI 3.1 should be enabled on the default implementation. Using version 3.1 is a global setting anyway. TheModelConverters
class should not have any public constructor, as it is only meant to be used as a singleton. Keeping the constructor private should prevent such errors in the future.The text was updated successfully, but these errors were encountered: