[FIX] remove accept type when void return
This commit is contained in:
parent
17664f1c2f
commit
6ebb9eb395
@ -319,11 +319,15 @@ public class TsApiGeneration {
|
|||||||
if (produces.size() > 1) {
|
if (produces.size() > 1) {
|
||||||
data.append("\n\t\t\t\taccept: produce,");
|
data.append("\n\t\t\t\taccept: produce,");
|
||||||
} else {
|
} else {
|
||||||
for (final String elem : produces) {
|
final String returnType = generateClassModelsTypescript(interfaceElement.returnTypes, tsGroup,
|
||||||
if (MediaType.APPLICATION_JSON.equals(elem)) {
|
imports, false);
|
||||||
data.append("\n\t\t\t\taccept: HTTPMimeType.JSON,");
|
if (!"void".equals(returnType)) {
|
||||||
toolImports.add("HTTPMimeType");
|
for (final String elem : produces) {
|
||||||
break;
|
if (MediaType.APPLICATION_JSON.equals(elem)) {
|
||||||
|
data.append("\n\t\t\t\taccept: HTTPMimeType.JSON,");
|
||||||
|
toolImports.add("HTTPMimeType");
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,6 +64,9 @@ public class ApiModel {
|
|||||||
this.returnTypes.add(previousModel.add(clazz));
|
this.returnTypes.add(previousModel.add(clazz));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (this.returnTypes.size() == 0) {
|
||||||
|
this.produces.clear();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,6 +94,9 @@ public class ApiModel {
|
|||||||
for (final ClassModel elem : this.returnTypes) {
|
for (final ClassModel elem : this.returnTypes) {
|
||||||
LOGGER.warn(" - {}", elem);
|
LOGGER.warn(" - {}", elem);
|
||||||
}
|
}
|
||||||
|
if (this.returnTypes.size() == 0) {
|
||||||
|
this.produces.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApiModel(final Class<?> clazz, final Method method, final String baseRestEndPoint,
|
public ApiModel(final Class<?> clazz, final Method method, final String baseRestEndPoint,
|
||||||
@ -166,6 +172,5 @@ public class ApiModel {
|
|||||||
if (this.unnamedElement.size() > 1) {
|
if (this.unnamedElement.size() > 1) {
|
||||||
throw new IOException("Can not parse the API, enmpty element is more than 1 in " + this.name);
|
throw new IOException("Can not parse the API, enmpty element is more than 1 in " + this.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user