The PR #4600 added support for beanvalidation annotations, which work fine, but generated annotations also support a message property to specify a custom error message if the validation for that annotation fails.
This can look like this:
@ApiModelProperty(example = "VGVzdA==", value = "")
@Pattern(regexp="^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$", message = "The provided String is not Base64 encoded")
public String getFoo() {
return foo;
}
Are there plans to add support for such a message? It might be possible to add it to the declaration file like:
foo:
type: string
pattern: "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$"
message: "The provided String is not Base64 encoded"
example: "VGVzdA=="
I guess this feature must be added in the beanValidationCore.mustache template (in swagger-codegen/src/main/java/resources/), but I'm not proficient enough with that template language to do that myself.
(I've tested the release version of 2.2.0 and the current master version, but both don't support these message properties)
The PR #4600 added support for beanvalidation annotations, which work fine, but generated annotations also support a
messageproperty to specify a custom error message if the validation for that annotation fails.This can look like this:
Are there plans to add support for such a message? It might be possible to add it to the declaration file like:
I guess this feature must be added in the
beanValidationCore.mustachetemplate (inswagger-codegen/src/main/java/resources/), but I'm not proficient enough with that template language to do that myself.(I've tested the release version of 2.2.0 and the current master version, but both don't support these message properties)