Closed gaoyang-projects closed 2 years ago
What is the JSON output of this request?
JSON output structure is right on server.
just swagger cannot recognize problem.
swagger example response :
{
"_links": {
"empty": true
}
}
if method return parameterized object swagger example reponse:
@GetMapping("/")
public User someRequest(){}
{ id": "1", "enabled": false }
because return type is '?', responsebody structure cannot be found through reflection by swagger
OK, I understand what you mean. Sorry, but you cannot use Swagger reflection here. And as you see in your example, the response is not valid JSON:API at all, but HAL representation.
so in my case, i want use JSON:API structure and expand meta object or other property .
if JsonApiModelBuilder return parameterized RepresentationModel like
User user = new User(); JsonApiModel<User> build = JsonApiModelBuilder.jsonApiModel().model(user ).meta(...).build();
developer can see responsebody in swagger ui ,have any solutions?
Spring HATEOAS and swagger.
use case: put something like requestid, timestamp into meta .
when retuen RepresentationModel<?>, response body structure cannot be recognized by swagger