I am working with Java 21 & Springboot 3.3 and I create controller using open-api-generator gradle plugin.
The controller generated is
default ResponseEntity<CardinalityDTO> getService(
@Valid @RequestParam(value = "param", required = false) List<String> param
)
The param could contains comma and to avoid to split with comma, I have a initBinder like
@InitBinder(value = "param")
public void initBinder(PropertyEditorRegistry binder) {
binder.registerCustomEditor(String[].class, new StringArrayPropertyEditor(null));
}
The problem is initbinder works with String[] param, I have try a binder like
binder.registerCustomEditor(List.class, new StringArrayPropertyEditor(null));
But it’s doesn’t work because it merge all param and I get ?param=value,value2¶m=value3,value4 I get param=value,value2,value3,value3
So, I would like to generate String[] instead of List for param or a working solution to manage correctly comma with List