Skip to content

Commit c089d43

Browse files
committed
fix scala
1 parent e118bce commit c089d43

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

generators/src/main/java/com/algolia/codegen/cts/tests/ParametersWithDataType.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ private Map<String, Object> traverseParams(
146146
handleEnum(param, testOutput);
147147
} else if (spec.getIsModel() || isCodegenModel) {
148148
// recursive object
149-
handleModel(paramName, param, testOutput, spec, baseType, parent, depth, isParentFreeFormObject);
149+
handleModel(paramName, param, testOutput, spec, baseType, parent, depth, isParentFreeFormObject, isRequired != null && isRequired);
150150
} else if (baseType.equals("Object")) {
151151
// not var, no item, pure free form
152152
handleObject(paramName, param, testOutput, true, depth);
@@ -259,7 +259,8 @@ private void handleModel(
259259
String baseType,
260260
String parent,
261261
int depth,
262-
boolean isParentFreeFormObject
262+
boolean isParentFreeFormObject,
263+
boolean parentIsRequired
263264
) throws CTSException {
264265
if (!spec.getHasVars()) {
265266
// In this case we might have a complex `allOf`, we will first check if it exists
@@ -326,6 +327,8 @@ private void handleModel(
326327
oneOfModel.put("x-one-of-explicit-name", useExplicitName);
327328
oneOfModel.put("hasWrapper", isList || isString(current) || current.getIsNumber() || current.getIsBoolean());
328329
testOutput.put("oneOfModel", oneOfModel);
330+
// use required from the parent since oneOf don't have that property
331+
testOutput.put("required", parentIsRequired);
329332
return;
330333
}
331334

0 commit comments

Comments
 (0)