'How to specify ServiceResponse of type object as response in Swagger specification file?

One of my API returns an object of type ServiceResponse<Pet>. I want to specify this as the response type for the 200 status code in my Swagger specification file.

API :

public interface api(){

    ServiceResponse<Pet> getPet()
        throws ServiceException;
}

Swagger specification :

...
  responses:
    200:
      description : OK
      schema: # what should i put here?
...

There is support for response types of simple arrays and objects but i'm having a hard time finding a solution for this. Please help!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source