Skip to content

Commit 08fb590

Browse files
authored
Removes secondaryParam and hasMore (#7882)
* Removes secondaryParam and hasMore * Fixes tests * Only uses bodyParam in groovy template
1 parent 0551504 commit 08fb590

File tree

483 files changed

+1547
-1979
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

483 files changed

+1547
-1979
lines changed

docs/new-generator.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ Method | HTTP request | Description
264264
{{#operation}}
265265
<a name="{{operationId}}"></a>
266266
# **{{operationId}}**
267-
> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}({{#allParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
267+
> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}})
268268
269269
{{summary}}{{#notes}}
270270
@@ -287,8 +287,8 @@ Name | Type | Description | Notes
287287
288288
### HTTP request headers
289289
290-
- **Content-Type**: {{#consumes}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}}
291-
- **Accept**: {{#produces}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}}
290+
- **Content-Type**: {{#consumes}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/consumes}}{{^consumes}}Not defined{{/consumes}}
291+
- **Accept**: {{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}{{^produces}}Not defined{{/produces}}
292292
293293
{{/operation}}
294294
{{/operations}}

docs/templating.md

+1-9
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ index 49b17c7..16ee191 100644
173173
@Deprecated
174174
{{/isDeprecated}}
175175
+ @Loggable(Loggable.INFO)
176-
public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException {
176+
public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException {
177177
Object {{localVariablePrefix}}localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}new Object(){{/bodyParam}};
178178
{{#allParams}}{{#required}}
179179

@@ -610,9 +610,7 @@ A `Pet` model with three properties will provide a _lot_ of information about th
610610
"jsonSchema" : "{\n \"type\" : \"integer\",\n \"format\" : \"int64\"\n}",
611611
"exclusiveMinimum" : false,
612612
"exclusiveMaximum" : false,
613-
"hasMore" : true,
614613
"required" : true,
615-
"secondaryParam" : false,
616614
"hasMoreNonReadOnly" : true,
617615
"isPrimitiveType" : true,
618616
"isModel" : false,
@@ -662,9 +660,7 @@ A `Pet` model with three properties will provide a _lot_ of information about th
662660
"jsonSchema" : "{\n \"type\" : \"string\"\n}",
663661
"exclusiveMinimum" : false,
664662
"exclusiveMaximum" : false,
665-
"hasMore" : true,
666663
"required" : true,
667-
"secondaryParam" : false,
668664
"hasMoreNonReadOnly" : true,
669665
"isPrimitiveType" : true,
670666
"isModel" : false,
@@ -714,9 +710,7 @@ A `Pet` model with three properties will provide a _lot_ of information about th
714710
"jsonSchema" : "{\n \"type\" : \"string\"\n}",
715711
"exclusiveMinimum" : false,
716712
"exclusiveMaximum" : false,
717-
"hasMore" : false,
718713
"required" : false,
719-
"secondaryParam" : false,
720714
"hasMoreNonReadOnly" : false,
721715
"isPrimitiveType" : true,
722716
"isModel" : false,
@@ -954,10 +948,8 @@ definitions:
954948
colDataTypeArguments:
955949
- argumentValue: 16
956950
isString: false
957-
hasMore: true
958951
- argumentValue: 4
959952
isString: false
960-
hasMore: false
961953
colUnsigned: true
962954
colNotNull: true
963955
colDefault:

modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenCallback.java

+4-6
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,11 @@
2121

2222
public class CodegenCallback {
2323
public String name;
24-
public boolean hasMore;
2524
public List<Url> urls = new ArrayList<>();
2625
public Map<String, Object> vendorExtensions = new HashMap<>();
2726

2827
public static class Url {
2928
public String expression;
30-
public boolean hasMore;
3129
public List<CodegenOperation> requests = new ArrayList<>();
3230
public Map<String, Object> vendorExtensions = new HashMap<>();
3331

@@ -37,12 +35,12 @@ public boolean equals(Object o) {
3735
if (o == null || getClass() != o.getClass()) return false;
3836

3937
Url that = (Url) o;
40-
return Objects.equals(that.expression, expression) && Objects.equals(that.hasMore, hasMore) &&
38+
return Objects.equals(that.expression, expression) &&
4139
Objects.equals(that.requests, requests) && Objects.equals(that.vendorExtensions, vendorExtensions);
4240
}
4341
@Override
4442
public int hashCode() {
45-
return Objects.hash(expression, hasMore, requests, vendorExtensions);
43+
return Objects.hash(expression, requests, vendorExtensions);
4644
}
4745

4846
@Override
@@ -62,13 +60,13 @@ public boolean equals(Object o) {
6260
if (o == null || getClass() != o.getClass()) return false;
6361

6462
CodegenCallback that = (CodegenCallback) o;
65-
return Objects.equals(that.name, name) && Objects.equals(that.hasMore, hasMore) &&
63+
return Objects.equals(that.name, name) &&
6664
Objects.equals(that.urls, urls) && Objects.equals(that.vendorExtensions, vendorExtensions);
6765
}
6866

6967
@Override
7068
public int hashCode() {
71-
return Objects.hash(name, hasMore, urls, vendorExtensions);
69+
return Objects.hash(name, urls, vendorExtensions);
7270
}
7371

7472
@Override

modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java

+1-25
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@ public void setEmptyVars(boolean emptyVars) {
909909
}
910910

911911
/**
912-
* Remove duplicated properties in all variable list and update "hasMore"
912+
* Remove duplicated properties in all variable list
913913
*/
914914
public void removeAllDuplicatedProperty() {
915915
// remove duplicated properties
@@ -920,15 +920,6 @@ public void removeAllDuplicatedProperty() {
920920
allVars = removeDuplicatedProperty(allVars);
921921
readOnlyVars = removeDuplicatedProperty(readOnlyVars);
922922
readWriteVars = removeDuplicatedProperty(readWriteVars);
923-
924-
// update property list's "hasMore"
925-
updatePropertyListHasMore(vars);
926-
updatePropertyListHasMore(optionalVars);
927-
updatePropertyListHasMore(requiredVars);
928-
updatePropertyListHasMore(parentVars);
929-
updatePropertyListHasMore(allVars);
930-
updatePropertyListHasMore(readOnlyVars);
931-
updatePropertyListHasMore(readWriteVars);
932923
}
933924

934925
private List<CodegenProperty> removeDuplicatedProperty(List<CodegenProperty> vars) {
@@ -956,21 +947,6 @@ private List<CodegenProperty> removeDuplicatedProperty(List<CodegenProperty> var
956947
return newList;
957948
}
958949

959-
/**
960-
* Clone the element and update "hasMore" in the list of codegen properties
961-
*/
962-
private void updatePropertyListHasMore(List<CodegenProperty> vars) {
963-
if (vars != null) {
964-
for (int i = 0; i < vars.size(); i++) {
965-
if (i < vars.size() - 1) {
966-
vars.get(i).hasMore = true;
967-
} else { // last element
968-
vars.get(i).hasMore = false;
969-
}
970-
}
971-
}
972-
}
973-
974950
/**
975951
* Remove self reference import
976952
*/

modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenOperation.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class CodegenOperation {
2626
public final List<CodegenProperty> responseHeaders = new ArrayList<CodegenProperty>();
2727
public boolean hasAuthMethods, hasConsumes, hasProduces, hasParams, hasOptionalParams, hasRequiredParams,
2828
returnTypeIsPrimitive, returnSimpleType, subresourceOperation, isMap,
29-
isArray, isMultipart, hasMore = true,
29+
isArray, isMultipart,
3030
isResponseBinary = false, isResponseFile = false, hasReference = false,
3131
isRestfulIndex, isRestfulShow, isRestfulCreate, isRestfulUpdate, isRestfulDestroy,
3232
isRestful, isDeprecated, isCallbackRequest, uniqueItems;
@@ -258,7 +258,6 @@ public String toString() {
258258
sb.append(", isMap=").append(isMap);
259259
sb.append(", isArray=").append(isArray);
260260
sb.append(", isMultipart=").append(isMultipart);
261-
sb.append(", hasMore=").append(hasMore);
262261
sb.append(", isResponseBinary=").append(isResponseBinary);
263262
sb.append(", isResponseFile=").append(isResponseFile);
264263
sb.append(", hasReference=").append(hasReference);
@@ -332,7 +331,6 @@ public boolean equals(Object o) {
332331
isMap == that.isMap &&
333332
isArray == that.isArray &&
334333
isMultipart == that.isMultipart &&
335-
hasMore == that.hasMore &&
336334
isResponseBinary == that.isResponseBinary &&
337335
isResponseFile == that.isResponseFile &&
338336
hasReference == that.hasReference &&
@@ -393,7 +391,7 @@ public int hashCode() {
393391

394392
return Objects.hash(responseHeaders, hasAuthMethods, hasConsumes, hasProduces, hasParams, hasOptionalParams,
395393
hasRequiredParams, returnTypeIsPrimitive, returnSimpleType, subresourceOperation, isMap,
396-
isArray, isMultipart, hasMore, isResponseBinary, isResponseFile, hasReference, isRestfulIndex,
394+
isArray, isMultipart, isResponseBinary, isResponseFile, hasReference, isRestfulIndex,
397395
isRestfulShow, isRestfulCreate, isRestfulUpdate, isRestfulDestroy, isRestful, isDeprecated,
398396
isCallbackRequest, uniqueItems, path, operationId, returnType, httpMethod, returnBaseType,
399397
returnContainer, summary, unescapedNotes, notes, baseName, defaultResponse, discriminator, consumes,

modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java

+3-9
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
*/
2727
public class CodegenParameter implements IJsonSchemaValidationProperties {
2828
public boolean isFormParam, isQueryParam, isPathParam, isHeaderParam,
29-
isCookieParam, isBodyParam, hasMore, isContainer,
30-
secondaryParam, isCollectionFormatMulti, isPrimitiveType, isModel, isExplode;
29+
isCookieParam, isBodyParam, isContainer,
30+
isCollectionFormatMulti, isPrimitiveType, isModel, isExplode;
3131
public String baseName, paramName, dataType, datatypeWithEnum, dataFormat, contentType,
3232
collectionFormat, description, unescapedDescription, baseType, defaultValue, enumName, style;
3333

@@ -105,9 +105,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
105105
public CodegenParameter copy() {
106106
CodegenParameter output = new CodegenParameter();
107107
output.isFile = this.isFile;
108-
output.hasMore = this.hasMore;
109108
output.isContainer = this.isContainer;
110-
output.secondaryParam = this.secondaryParam;
111109
output.baseName = this.baseName;
112110
output.paramName = this.paramName;
113111
output.dataType = this.dataType;
@@ -202,7 +200,7 @@ public CodegenParameter copy() {
202200

203201
@Override
204202
public int hashCode() {
205-
return Objects.hash(isFormParam, isQueryParam, isPathParam, isHeaderParam, isCookieParam, isBodyParam, hasMore, isContainer, secondaryParam, isCollectionFormatMulti, isPrimitiveType, isModel, isExplode, baseName, paramName, dataType, datatypeWithEnum, dataFormat, collectionFormat, description, unescapedDescription, baseType, defaultValue, enumName, style, example, jsonSchema, isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBinary, isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isFreeFormObject, isAnyType, isArray, isMap, isFile, isEnum, _enum, allowableValues, items, mostInnerItems, additionalProperties, vars, requiredVars, vendorExtensions, hasValidation, getMaxProperties(), getMinProperties(), isNullable, required, getMaximum(), getExclusiveMaximum(), getMinimum(), getExclusiveMinimum(), getMaxLength(), getMinLength(), getPattern(), getMaxItems(), getMinItems(), getUniqueItems(), contentType, multipleOf);
203+
return Objects.hash(isFormParam, isQueryParam, isPathParam, isHeaderParam, isCookieParam, isBodyParam, isContainer, isCollectionFormatMulti, isPrimitiveType, isModel, isExplode, baseName, paramName, dataType, datatypeWithEnum, dataFormat, collectionFormat, description, unescapedDescription, baseType, defaultValue, enumName, style, example, jsonSchema, isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBinary, isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isFreeFormObject, isAnyType, isArray, isMap, isFile, isEnum, _enum, allowableValues, items, mostInnerItems, additionalProperties, vars, requiredVars, vendorExtensions, hasValidation, getMaxProperties(), getMinProperties(), isNullable, required, getMaximum(), getExclusiveMaximum(), getMinimum(), getExclusiveMinimum(), getMaxLength(), getMinLength(), getPattern(), getMaxItems(), getMinItems(), getUniqueItems(), contentType, multipleOf);
206204
}
207205

208206
@Override
@@ -216,9 +214,7 @@ public boolean equals(Object o) {
216214
isHeaderParam == that.isHeaderParam &&
217215
isCookieParam == that.isCookieParam &&
218216
isBodyParam == that.isBodyParam &&
219-
hasMore == that.hasMore &&
220217
isContainer == that.isContainer &&
221-
secondaryParam == that.secondaryParam &&
222218
isCollectionFormatMulti == that.isCollectionFormatMulti &&
223219
isPrimitiveType == that.isPrimitiveType &&
224220
isModel == that.isModel &&
@@ -295,9 +291,7 @@ public String toString() {
295291
sb.append(", isHeaderParam=").append(isHeaderParam);
296292
sb.append(", isCookieParam=").append(isCookieParam);
297293
sb.append(", isBodyParam=").append(isBodyParam);
298-
sb.append(", hasMore=").append(hasMore);
299294
sb.append(", isContainer=").append(isContainer);
300-
sb.append(", secondaryParam=").append(secondaryParam);
301295
sb.append(", isCollectionFormatMulti=").append(isCollectionFormatMulti);
302296
sb.append(", isPrimitiveType=").append(isPrimitiveType);
303297
sb.append(", isModel=").append(isModel);

modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java

+1-15
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,8 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
103103
* The value of "exclusiveMaximum" MUST be number, representing an exclusive upper limit for a numeric instance.
104104
*/
105105
public boolean exclusiveMaximum;
106-
public boolean hasMore;
107106
public boolean required;
108107
public boolean deprecated;
109-
public boolean secondaryParam;
110108
public boolean hasMoreNonReadOnly; // for model constructor, true if next property is not readonly
111109
public boolean isPrimitiveType;
112110
public boolean isModel;
@@ -431,14 +429,6 @@ public void setRequired(boolean required) {
431429
this.required = required;
432430
}
433431

434-
public boolean getSecondaryParam() {
435-
return secondaryParam;
436-
}
437-
438-
public void setSecondaryParam(boolean secondaryParam) {
439-
this.secondaryParam = secondaryParam;
440-
}
441-
442432
public List<String> get_enum() {
443433
return _enum;
444434
}
@@ -716,10 +706,8 @@ public String toString() {
716706
sb.append(", maximum='").append(maximum).append('\'');
717707
sb.append(", exclusiveMinimum=").append(exclusiveMinimum);
718708
sb.append(", exclusiveMaximum=").append(exclusiveMaximum);
719-
sb.append(", hasMore=").append(hasMore);
720709
sb.append(", required=").append(required);
721710
sb.append(", deprecated=").append(deprecated);
722-
sb.append(", secondaryParam=").append(secondaryParam);
723711
sb.append(", hasMoreNonReadOnly=").append(hasMoreNonReadOnly);
724712
sb.append(", isPrimitiveType=").append(isPrimitiveType);
725713
sb.append(", isModel=").append(isModel);
@@ -787,10 +775,8 @@ public boolean equals(Object o) {
787775
CodegenProperty that = (CodegenProperty) o;
788776
return exclusiveMinimum == that.exclusiveMinimum &&
789777
exclusiveMaximum == that.exclusiveMaximum &&
790-
hasMore == that.hasMore &&
791778
required == that.required &&
792779
deprecated == that.deprecated &&
793-
secondaryParam == that.secondaryParam &&
794780
hasMoreNonReadOnly == that.hasMoreNonReadOnly &&
795781
isPrimitiveType == that.isPrimitiveType &&
796782
isModel == that.isModel &&
@@ -878,7 +864,7 @@ public int hashCode() {
878864
dataType, datatypeWithEnum, dataFormat, name, min, max, defaultValue,
879865
defaultValueWithParam, baseType, containerType, title, unescapedDescription,
880866
maxLength, minLength, pattern, example, jsonSchema, minimum, maximum,
881-
exclusiveMinimum, exclusiveMaximum, hasMore, required, deprecated, secondaryParam,
867+
exclusiveMinimum, exclusiveMaximum, required, deprecated,
882868
hasMoreNonReadOnly, isPrimitiveType, isModel, isContainer, isString, isNumeric,
883869
isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBinary, isFile,
884870
isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isFreeFormObject,

modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java

+2-5
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
2828
public boolean is4xx;
2929
public boolean is5xx;
3030
public String message;
31-
public boolean hasMore;
3231
public List<Map<String, Object>> examples;
3332
public String dataType;
3433
public String baseType;
@@ -81,7 +80,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
8180

8281
@Override
8382
public int hashCode() {
84-
return Objects.hash(headers, code, message, hasMore, examples, dataType, baseType, containerType, hasHeaders,
83+
return Objects.hash(headers, code, message, examples, dataType, baseType, containerType, hasHeaders,
8584
isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBoolean, isDate,
8685
isDateTime, isUuid, isEmail, isModel, isFreeFormObject, isAnyType, isDefault, simpleType, primitiveType,
8786
isMap, isArray, isBinary, isFile, schema, jsonSchema, vendorExtensions, items, additionalProperties,
@@ -95,8 +94,7 @@ public boolean equals(Object o) {
9594
if (this == o) return true;
9695
if (!(o instanceof CodegenResponse)) return false;
9796
CodegenResponse that = (CodegenResponse) o;
98-
return hasMore == that.hasMore &&
99-
hasHeaders == that.hasHeaders &&
97+
return hasHeaders == that.hasHeaders &&
10098
isString == that.isString &&
10199
isNumeric == that.isNumeric &&
102100
isInteger == that.isInteger &&
@@ -365,7 +363,6 @@ public String toString() {
365363
sb.append("headers=").append(headers);
366364
sb.append(", code='").append(code).append('\'');
367365
sb.append(", message='").append(message).append('\'');
368-
sb.append(", hasMore=").append(hasMore);
369366
sb.append(", examples=").append(examples);
370367
sb.append(", dataType='").append(dataType).append('\'');
371368
sb.append(", baseType='").append(baseType).append('\'');

0 commit comments

Comments
 (0)