forked from loafle/openapi-generator-original
Replaced isSuccessCode with is2xx
This commit is contained in:
@@ -28,7 +28,6 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
||||
public boolean is4xx;
|
||||
public boolean is5xx;
|
||||
public String message;
|
||||
public boolean isSuccessCode;
|
||||
public boolean hasMore;
|
||||
public List<Map<String, Object>> examples;
|
||||
public String dataType;
|
||||
|
||||
@@ -3800,7 +3800,6 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
default:
|
||||
throw new RuntimeException("Invalid response code " + responseCode);
|
||||
}
|
||||
r.isSuccessCode = r.code.startsWith("2");
|
||||
}
|
||||
Schema responseSchema;
|
||||
if (this.openAPI != null && this.openAPI.getComponents() != null) {
|
||||
|
||||
@@ -318,7 +318,7 @@ public class TypeScriptClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
boolean addVoid = false;
|
||||
for (CodegenResponse response: responses) {
|
||||
// TODO: we should probably catch an exception here
|
||||
if (response.isSuccessCode) {
|
||||
if (response.is2xx) {
|
||||
if (response.dataType != null) {
|
||||
if (!firstReturnType) {
|
||||
returnType.append(" | ");
|
||||
|
||||
@@ -166,20 +166,20 @@ export class {{classname}}ResponseProcessor {
|
||||
"{{{dataType}}}", "{{returnFormat}}"
|
||||
) as {{{dataType}}};
|
||||
{{/isBinary}}
|
||||
{{#isSuccessCode}}
|
||||
{{#is2xx}}
|
||||
return body;
|
||||
{{/isSuccessCode}}
|
||||
{{^isSuccessCode}}
|
||||
{{/is2xx}}
|
||||
{{^is2xx}}
|
||||
throw new ApiException<{{{dataType}}}>({{code}}, body);
|
||||
{{/isSuccessCode}}
|
||||
{{/is2xx}}
|
||||
{{/dataType}}
|
||||
{{^dataType}}
|
||||
{{#isSuccessCode}}
|
||||
{{#is2xx}}
|
||||
return;
|
||||
{{/isSuccessCode}}
|
||||
{{^isSuccessCode}}
|
||||
{{/is2xx}}
|
||||
{{^is2xx}}
|
||||
throw new ApiException<string>(response.httpStatusCode, "{{message}}");
|
||||
{{/isSuccessCode}}
|
||||
{{/is2xx}}
|
||||
{{/dataType}}
|
||||
}
|
||||
{{/responses}}
|
||||
|
||||
Reference in New Issue
Block a user