Context
Say you have:
public class Dto {
private String name;
private String List<String> customs;
// getters and setters...
}
and
public class Custom {
private String something;
private String else;
// getters and setters...
}
Your Spring MVC RestController receives a list of Dto:
@PostMapping
public String create(@RequestBody List<Dto> dtos) {
return myService.process(features);
}
Input
However, you know that the client-side service which will send data to your controller will send something like this:
[
{
"name": "Bob",
"customs": [
"{\n \"something\": \"yes\",\n \"else\": \"no\"\n }"
]
}
]
Notice how the String is a json representation of the Custom class. Please assume this cannot be changed on the client-side and we have to deal with it on the server-side.
Question
Is there an OpenAPI annotation which would allow me to designate Custom as being the object to be automagically converted to a String which would then be used as the example in the UI?
By "used as the example", I'm talking about this automatically generated json (please disregard the actual data shown there since it doesn't match the presented simplified problem):
I'm asking for an automatic set up because I would prefer not having to go back onto the String's specifics if we end up modifying the properties of the Custom class (removing the something attribute, for example).
We are using those Maven dependencies:
<!-- Swagger / OpenAPI -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.4.1</version>
</dependency>

springdocandspringfoxtogether?springfoxin my repo.