-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
How to add a ModelConverter in a Spring project ? #1528
Comments
Springfox has a different way of acheiving this. You need to use the |
Thanks for your answer. |
Hi Guys, I am having a problem related to ModelConverters. My Swagger.json contains a generic class in the expanded form like below: "JsonNode": { Now this is definitely what I don't want. In fact what I want is to prevent this specific class (com.fasterxml.jackson.databind.JsonNode) (and any other of my choice) to be ever expanded. So in order to do this I used the inbuilt function provided in the io.swagger.converter.ModelConverters class shown below: public void addClassToSkip(String cls) { Now having done this I can't seem to figure out where to actually inject the ModelConverters class, as I tried to add it to list of providers along with others but to no result. Can someone please help me with this. I have been looking for the answer for almost 3 days now. |
Use a custom converter, this is a bug per my analysis, you can copy ModelResolver to your own code and do something like this.
Further in the ModelResolver modify following resolve method
It's a hack, issue is same as https://github.com/swagger-api/swagger-core/issues/2260 |
I have a project with Spring MVC and Spring boot.
I use Swagger springfox to document my json service. I have a class with java.sql.Time and java.util.Date attributes.
When I call the api, the class appears like this :
In swagger UI, the Model Schema is like this :
I want to display the "change_time" like "15:31".
To do this, I think I need to use a ModelConverter. So I create a custom converter class based on this example : https://github.com/swagger-api/swagger-core/blob/master/modules/swagger-core/src/test/java/io/swagger/model/override/CustomConverterTest.java
But I don't find how to use it.
Here is my class :
Now I need to add my converter to the ModelConverters.
I did not find any documentation about where to put this code.
Where did I need to put this ?
The text was updated successfully, but these errors were encountered: