forked from loafle/openapi-generator-original
Add isRange in CodegenResponse (#7854)
* add isRange * undo changes to spec
This commit is contained in:
parent
4984f9c3d5
commit
33f4827a06
@ -86,7 +86,8 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
|||||||
isMap, isArray, isBinary, isFile, schema, jsonSchema, vendorExtensions, items, additionalProperties,
|
isMap, isArray, isBinary, isFile, schema, jsonSchema, vendorExtensions, items, additionalProperties,
|
||||||
vars, requiredVars,
|
vars, requiredVars,
|
||||||
getMaxProperties(), getMinProperties(), uniqueItems, getMaxItems(), getMinItems(), getMaxLength(),
|
getMaxProperties(), getMinProperties(), uniqueItems, getMaxItems(), getMinItems(), getMaxLength(),
|
||||||
getMinLength(), exclusiveMinimum, exclusiveMaximum, getMinimum(), getMaximum(), getPattern());
|
getMinLength(), exclusiveMinimum, exclusiveMaximum, getMinimum(), getMaximum(), getPattern(),
|
||||||
|
is1xx, is2xx, is3xx, is4xx, is5xx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -121,6 +122,11 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
|||||||
isFile == that.isFile &&
|
isFile == that.isFile &&
|
||||||
items == that.items &&
|
items == that.items &&
|
||||||
additionalProperties == that.additionalProperties &&
|
additionalProperties == that.additionalProperties &&
|
||||||
|
is1xx == that.is1xx &&
|
||||||
|
is2xx == that.is2xx &&
|
||||||
|
is3xx == that.is3xx &&
|
||||||
|
is4xx == that.is4xx &&
|
||||||
|
is5xx == that.is5xx &&
|
||||||
Objects.equals(vars, that.vars) &&
|
Objects.equals(vars, that.vars) &&
|
||||||
Objects.equals(requiredVars, that.requiredVars) &&
|
Objects.equals(requiredVars, that.requiredVars) &&
|
||||||
Objects.equals(headers, that.headers) &&
|
Objects.equals(headers, that.headers) &&
|
||||||
@ -362,6 +368,11 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
|||||||
final StringBuilder sb = new StringBuilder("CodegenResponse{");
|
final StringBuilder sb = new StringBuilder("CodegenResponse{");
|
||||||
sb.append("headers=").append(headers);
|
sb.append("headers=").append(headers);
|
||||||
sb.append(", code='").append(code).append('\'');
|
sb.append(", code='").append(code).append('\'');
|
||||||
|
sb.append(", is1xx='").append(is1xx).append('\'');
|
||||||
|
sb.append(", is2xx='").append(is2xx).append('\'');
|
||||||
|
sb.append(", is3xx='").append(is3xx).append('\'');
|
||||||
|
sb.append(", is4xx='").append(is4xx).append('\'');
|
||||||
|
sb.append(", is5xx='").append(is5xx).append('\'');
|
||||||
sb.append(", message='").append(message).append('\'');
|
sb.append(", message='").append(message).append('\'');
|
||||||
sb.append(", examples=").append(examples);
|
sb.append(", examples=").append(examples);
|
||||||
sb.append(", dataType='").append(dataType).append('\'');
|
sb.append(", dataType='").append(dataType).append('\'');
|
||||||
@ -421,4 +432,15 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
|||||||
public boolean isWildcard() {
|
public boolean isWildcard() {
|
||||||
return "0".equals(code) || "default".equals(code);
|
return "0".equals(code) || "default".equals(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Boolean value indicating whether the status code is a range
|
||||||
|
*
|
||||||
|
* @return True if the status code is a range (e.g. 2XX)
|
||||||
|
*/
|
||||||
|
public boolean isRange() {
|
||||||
|
if (code != null && code.length() == 3 && "XX".equalsIgnoreCase(code.substring(1)))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4011,6 +4011,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
throw new RuntimeException("Invalid response code " + responseCode);
|
throw new RuntimeException("Invalid response code " + responseCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Schema responseSchema;
|
Schema responseSchema;
|
||||||
if (this.openAPI != null && this.openAPI.getComponents() != null) {
|
if (this.openAPI != null && this.openAPI.getComponents() != null) {
|
||||||
responseSchema = unaliasSchema(ModelUtils.getSchemaFromResponse(response), importMapping);
|
responseSchema = unaliasSchema(ModelUtils.getSchemaFromResponse(response), importMapping);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user