swagger-codegen icon indicating copy to clipboard operation
swagger-codegen copied to clipboard

custom validation message in bean validation annotations

Open Roopa-Riya opened this issue 6 years ago • 1 comments

Description [JAVA] When i try to generate the objects using the below , generate objects does not have message value . expected: @JsonProperty("inlineString") @Nullable @Size(max=100, message='validation message') public String getinlineString();

instead getting

@JsonProperty("inlineString") @Nullable @Size(max=100) public String getinlineString();

Test.yaml File efinitions: stringPattern: type: string minLength: 1 maxLength: 20 pattern: '^([a-zA-Z0-9])*$' decimalNumber: type: number minimum: 0 maximum: 9999999999999.99 multipleOf: 0.01 ApiRequest: type: object properties: stringPattern: $ref: '#/definitions/stringPattern' decimalNumber: $ref: '#/definitions/decimalNumber' inlineString: type: string minLength: 1 maxLength: 20 message :" max number should 20"

Swagger-codegen version

using swagger codegen version 2.4.5

Can you please suggest a way to pull the custom validation message in the yaml file and which in turn generates a object with the same messages.

Roopa-Riya avatar Jun 21 '19 18:06 Roopa-Riya

did you find any solution to this?

Sonam0123 avatar Mar 04 '24 18:03 Sonam0123