Skip to content

Commit eb17bd9

Browse files
authored
fix(cts): friendly error message when a paremeter is not recognized (#978)
1 parent 945d39b commit eb17bd9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,10 @@ private void handleModel(
318318
entry.getKey() +
319319
"' not found in '" +
320320
paramName +
321-
"'. You might have a type conflict in the spec for '" +
321+
"'. Available properties are: " +
322+
spec.getVars().stream().map(v -> v.baseName).collect(Collectors.joining(", ")) +
323+
(spec.getAdditionalPropertiesIsAnyType() ? " (and any additional properties)" : "") +
324+
". Or you might have a type conflict in the spec for '" +
322325
baseType +
323326
"'"
324327
);
@@ -545,6 +548,7 @@ private IJsonSchemaValidationProperties findMatchingOneOf(Object param, CodegenM
545548

546549
// Somehow this is not yet enough
547550
if (oneOf != null && !oneOf.isEmpty()) {
551+
System.out.println("Choosing the first oneOf by default: " + oneOf.get(0).name + " (this won't stay correct forever)");
548552
return oneOf.get(0);
549553
}
550554
}

0 commit comments

Comments
 (0)