ng-swagger-gen
ng-swagger-gen copied to clipboard
Text plain type generated as json
Hi,
I would like to ask why text plain media type is generated as a json? Or maybe there is something wrong with it. I have this class:
@Path("/translations")
@Api(value = "/translations", produces = MediaType.TEXT_PLAIN)
public interface TranslationRestService {
@GET
@Path("/")
@Produces(MediaType.TEXT_PLAIN)
@ApiOperation(produces = MediaType.TEXT_PLAIN, value = "Get translations by language", code = 200)
Response getTranslations(@QueryParam("lang") String lang);
}
And when running ng-swagger-gen it generates like that:
// rest of generated service
{
headers: __headers,
params: __params,
responseType: 'json'
});
In swagger it's normally available as text/plain. I'm using the newest version.
It depends on your source swagger definition. Posting it can help...
@luisfpg Sorry for the delay... I've totally forgot about it...
{
"swagger" : "2.0",
"info" : {
"description" : "This document contains the Rest service definition\n\t\t\t\t\t\t\t\t\tfor XXX application",
"version" : "1.0.0",
"title" : "XXX RESTful Service",
"license" : {
"name" : "XXX"
}
},
"basePath" : "/XXX/zzz/",
"tags" : [ {
"name" : "translations"
} ],
"schemes" : [ "http", "https" ],
"paths" : {
"/translations" : {
"get" : {
"tags" : [ "translations" ],
"summary" : "Get translations by language",
"description" : "",
"operationId" : "getTranslations",
"produces" : [ "text/plain" ],
"parameters" : [ {
"name" : "lang",
"in" : "query",
"required" : false,
"type" : "string"
} ],
"responses" : {
"default" : {
"description" : "successful operation"
}
}
}
},
},
}