Adds return property to CodegenOperation (#12816)

* added nonNullableVars

* added return property to operation

* added return property to operation

* build samples

Co-authored-by: William Cheng <wing328hk@gmail.com>
This commit is contained in:
devhl-labs 2022-07-13 05:01:43 -04:00 committed by GitHub
parent 464da4a10f
commit 57bcb046d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -31,6 +31,7 @@ public class CodegenOperation {
isRestfulIndex, isRestfulShow, isRestfulCreate, isRestfulUpdate, isRestfulDestroy, isRestfulIndex, isRestfulShow, isRestfulCreate, isRestfulUpdate, isRestfulDestroy,
isRestful, isDeprecated, isCallbackRequest, uniqueItems, hasDefaultResponse = false, isRestful, isDeprecated, isCallbackRequest, uniqueItems, hasDefaultResponse = false,
hasErrorResponseObject; // if 4xx, 5xx responses have at least one error object defined hasErrorResponseObject; // if 4xx, 5xx responses have at least one error object defined
public CodegenProperty returnProperty;
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;
@ -298,6 +299,7 @@ public class CodegenOperation {
sb.append(", returnSimpleType=").append(returnSimpleType); sb.append(", returnSimpleType=").append(returnSimpleType);
sb.append(", subresourceOperation=").append(subresourceOperation); sb.append(", subresourceOperation=").append(subresourceOperation);
sb.append(", isMap=").append(isMap); sb.append(", isMap=").append(isMap);
sb.append(", returnProperty=").append(returnProperty);
sb.append(", isArray=").append(isArray); sb.append(", isArray=").append(isArray);
sb.append(", isMultipart=").append(isMultipart); sb.append(", isMultipart=").append(isMultipart);
sb.append(", isResponseBinary=").append(isResponseBinary); sb.append(", isResponseBinary=").append(isResponseBinary);
@ -391,6 +393,7 @@ public class CodegenOperation {
isDeprecated == that.isDeprecated && isDeprecated == that.isDeprecated &&
isCallbackRequest == that.isCallbackRequest && isCallbackRequest == that.isCallbackRequest &&
uniqueItems == that.uniqueItems && uniqueItems == that.uniqueItems &&
Objects.equals(returnProperty, that.returnProperty) &&
Objects.equals(responseHeaders, that.responseHeaders) && Objects.equals(responseHeaders, that.responseHeaders) &&
Objects.equals(path, that.path) && Objects.equals(path, that.path) &&
Objects.equals(operationId, that.operationId) && Objects.equals(operationId, that.operationId) &&
@ -444,7 +447,7 @@ public class CodegenOperation {
isRestful, isDeprecated, isCallbackRequest, uniqueItems, path, operationId, returnType, httpMethod, isRestful, isDeprecated, isCallbackRequest, uniqueItems, path, operationId, returnType, httpMethod,
returnBaseType, returnContainer, summary, unescapedNotes, notes, baseName, defaultResponse, returnBaseType, returnContainer, summary, unescapedNotes, notes, baseName, defaultResponse,
discriminator, consumes, produces, prioritizedContentTypes, servers, bodyParam, allParams, bodyParams, discriminator, consumes, produces, prioritizedContentTypes, servers, bodyParam, allParams, bodyParams,
pathParams, queryParams, headerParams, formParams, cookieParams, requiredParams, optionalParams, pathParams, queryParams, headerParams, formParams, cookieParams, requiredParams, returnProperty, optionalParams,
authMethods, tags, responses, callbacks, imports, examples, requestBodyExamples, externalDocs, authMethods, tags, responses, callbacks, imports, examples, requestBodyExamples, externalDocs,
vendorExtensions, nickname, operationIdOriginal, operationIdLowerCase, operationIdCamelCase, vendorExtensions, nickname, operationIdOriginal, operationIdLowerCase, operationIdCamelCase,
operationIdSnakeCase, hasErrorResponseObject); operationIdSnakeCase, hasErrorResponseObject);

View File

@ -4026,6 +4026,7 @@ public class DefaultCodegen implements CodegenConfig {
if (languageSpecificPrimitives().contains(op.returnBaseType) || op.returnBaseType == null) { if (languageSpecificPrimitives().contains(op.returnBaseType) || op.returnBaseType == null) {
op.returnTypeIsPrimitive = true; op.returnTypeIsPrimitive = true;
} }
op.returnProperty = cm;
} }
addHeaders(methodResponse, op.responseHeaders); addHeaders(methodResponse, op.responseHeaders);
} }