forked from loafle/openapi-generator-original
[Codegen] Add hasDefaultResponse property (#9203)
Check if there's a default response in the specs.
This commit is contained in:
parent
83adc064a4
commit
057c1080f8
@ -29,7 +29,7 @@ public class CodegenOperation {
|
|||||||
isArray, isMultipart,
|
isArray, isMultipart,
|
||||||
isResponseBinary = false, isResponseFile = false, hasReference = false,
|
isResponseBinary = false, isResponseFile = false, hasReference = false,
|
||||||
isRestfulIndex, isRestfulShow, isRestfulCreate, isRestfulUpdate, isRestfulDestroy,
|
isRestfulIndex, isRestfulShow, isRestfulCreate, isRestfulUpdate, isRestfulDestroy,
|
||||||
isRestful, isDeprecated, isCallbackRequest, uniqueItems;
|
isRestful, isDeprecated, isCallbackRequest, uniqueItems, hasDefaultResponse = false;
|
||||||
public String path, operationId, returnType, returnFormat, httpMethod, returnBaseType,
|
public String path, operationId, returnType, returnFormat, httpMethod, returnBaseType,
|
||||||
returnContainer, summary, unescapedNotes, notes, baseName, defaultResponse;
|
returnContainer, summary, unescapedNotes, notes, baseName, defaultResponse;
|
||||||
public CodegenDiscriminator discriminator;
|
public CodegenDiscriminator discriminator;
|
||||||
@ -168,6 +168,15 @@ public class CodegenOperation {
|
|||||||
return nonempty(examples);
|
return nonempty(examples);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if there's a default response
|
||||||
|
*
|
||||||
|
* @return true if responses contain a default response, false otherwise
|
||||||
|
*/
|
||||||
|
public boolean getHasDefaultResponse() {
|
||||||
|
return responses.stream().filter(response -> response.isDefault).findFirst().isPresent();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if act as Restful index method
|
* Check if act as Restful index method
|
||||||
*
|
*
|
||||||
@ -270,6 +279,7 @@ public class CodegenOperation {
|
|||||||
sb.append(", isResponseBinary=").append(isResponseBinary);
|
sb.append(", isResponseBinary=").append(isResponseBinary);
|
||||||
sb.append(", isResponseFile=").append(isResponseFile);
|
sb.append(", isResponseFile=").append(isResponseFile);
|
||||||
sb.append(", hasReference=").append(hasReference);
|
sb.append(", hasReference=").append(hasReference);
|
||||||
|
sb.append(", hasDefaultResponse=").append(hasDefaultResponse);
|
||||||
sb.append(", isRestfulIndex=").append(isRestfulIndex);
|
sb.append(", isRestfulIndex=").append(isRestfulIndex);
|
||||||
sb.append(", isRestfulShow=").append(isRestfulShow);
|
sb.append(", isRestfulShow=").append(isRestfulShow);
|
||||||
sb.append(", isRestfulCreate=").append(isRestfulCreate);
|
sb.append(", isRestfulCreate=").append(isRestfulCreate);
|
||||||
@ -343,6 +353,7 @@ public class CodegenOperation {
|
|||||||
isResponseBinary == that.isResponseBinary &&
|
isResponseBinary == that.isResponseBinary &&
|
||||||
isResponseFile == that.isResponseFile &&
|
isResponseFile == that.isResponseFile &&
|
||||||
hasReference == that.hasReference &&
|
hasReference == that.hasReference &&
|
||||||
|
hasDefaultResponse == that.hasDefaultResponse &&
|
||||||
isRestfulIndex == that.isRestfulIndex &&
|
isRestfulIndex == that.isRestfulIndex &&
|
||||||
isRestfulShow == that.isRestfulShow &&
|
isRestfulShow == that.isRestfulShow &&
|
||||||
isRestfulCreate == that.isRestfulCreate &&
|
isRestfulCreate == that.isRestfulCreate &&
|
||||||
@ -400,7 +411,7 @@ public class CodegenOperation {
|
|||||||
|
|
||||||
return Objects.hash(responseHeaders, hasAuthMethods, hasConsumes, hasProduces, hasParams, hasOptionalParams,
|
return Objects.hash(responseHeaders, hasAuthMethods, hasConsumes, hasProduces, hasParams, hasOptionalParams,
|
||||||
hasRequiredParams, returnTypeIsPrimitive, returnSimpleType, subresourceOperation, isMap,
|
hasRequiredParams, returnTypeIsPrimitive, returnSimpleType, subresourceOperation, isMap,
|
||||||
isArray, isMultipart, isResponseBinary, isResponseFile, hasReference, isRestfulIndex,
|
isArray, isMultipart, isResponseBinary, isResponseFile, hasReference, hasDefaultResponse, isRestfulIndex,
|
||||||
isRestfulShow, isRestfulCreate, isRestfulUpdate, isRestfulDestroy, isRestful, isDeprecated,
|
isRestfulShow, isRestfulCreate, isRestfulUpdate, isRestfulDestroy, isRestful, isDeprecated,
|
||||||
isCallbackRequest, uniqueItems, path, operationId, returnType, httpMethod, returnBaseType,
|
isCallbackRequest, uniqueItems, path, operationId, returnType, httpMethod, returnBaseType,
|
||||||
returnContainer, summary, unescapedNotes, notes, baseName, defaultResponse, discriminator, consumes,
|
returnContainer, summary, unescapedNotes, notes, baseName, defaultResponse, discriminator, consumes,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user