-
Notifications
You must be signed in to change notification settings - Fork 93
Open
Description
YAML extension files containing parameterConsistency in variadic function definitions fail to load with the error:
Unrecognized field "parameterConsistency" (class ImmutableSimpleExtension$VariadicBehavior$Json),
not marked as ignorable (2 known properties: "min", "max"])
As a minimal test case to demonstrate the failure:
@Test
public void testParameterConsistencyLoading() {
String yamlContent =
"urn: extension:test:example\n"
+ "scalar_functions:\n"
+ " - name: test_func\n"
+ " impls:\n"
+ " - args:\n"
+ " - name: arg1\n"
+ " value: string\n"
+ " variadic:\n"
+ " min: 1\n"
+ " parameterConsistency: CONSISTENT\n"
+ " return: string\n";
SimpleExtension.ExtensionCollection collection =
SimpleExtension.load("test://example", yamlContent);
assertEquals(
SimpleExtension.VariadicBehavior.ParameterConsistency.CONSISTENT,
collection.scalarFunctions().get(0).variadic().get().parameterConsistency());
}This can be fixed by adding the @Value.Default annotation to the VariadicBehavior.parameterConsistency() method. Without it, the Immutables library cannot recognize it as a deserializable field.
This will need one extra step, which is to actually thread the parameterConsistency info through to the function validation to ensure that the parameterConsistency is actually enforced.
Metadata
Metadata
Assignees
Labels
No labels