Closed hiddewie closed 4 years ago
Pull request has been updated for the new master commits
Swagger is actually using the Java ServiceLoader
mechanism to discover different things, e.g., ModelConverter
implementations. The missing support for this in the kongchen plugin was actually the primary reason for starting this plugin.
This implies that if you place a file in META-INF/services
with the name io.swagger.v3.core.converter.ModelConverter
which contains the fully qualified name of your model converter, then Swagger should pick this up and activate the model converter.
This also means that you can actually package model converter implementations inside separate jar files and re-use these across projects.
You can see the code for discovery in ModelConverters
@langecode Thanks for noticing that. I have been looking through the source code of Swagger Core, but did not find that ServiceLoader call. That seems to solve my issue. I will close this PR.
This enables the use of
ModelConverter
s from the plugin.Use case: a complex model which is represented as a simple type when used as a request parameter.