I posted this question in StackOverflow
We are using Swagger to write our REST API. We have a POST service which should accept an XML file in the request body. This is our request definition:
/services/invoke: post: tags: - invoke summary: A request invocation operationId: invokeUsingPOST consumes: - application/xml produces: - application/xml parameters: - name: User-Token in: header description: The user token required: false type: string - in: body name: request description: invoke request XML required: false schema: type: string responses: '200': description: OK schema: type: string '400': description: Bad Operation '401': description: Unauthorized
However, when we generate a Java client code using swagger-codegen, the generated method looks like:
public String invokeUsingPOST (String userToken, Request request)And the Request class is generated as:
@ApiModel(description = "")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-25T18:45:31.524+02:00")
public class Request {
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Request {\n");
sb.append("}");
return sb.toString();
}
}How do I use it to send my XML? Do I have to derive from it and override the toString() method, or is there a better way to do it?