asyncapi/java-spring-template

type: string, "maxlength: 512" is not reflected to the generated Java code

Closed this issue · 2 comments

I'm using kafka for the protocol in my YAML.
The code conversion is great so far. Thanks.
I have a question of data validation in the generated Java code.
The data validation annotation is fine for type: integer.
However, in case of type: string, "maxlength: 512" is not reflected to the generated Java code.
Is this as expected? Or not yet supported?
Thanks for your advice.

# YAML
address1:
type: string
description: Address 1
maxlength: 512
example: "Suginami-ku, Tokyo, Japan"
# Generated Java Code
@JsonProperty("address1")@NotNull
public String getAddress1() {
    return address1;
}
public void setAddress1(String address1) {
    this.address1 = address1;
}

================================================
# YAML
ageApplicationDate:
type: integer
format: int32
description: Age
minimum: 20
maximum: 99
example: 38
# Generated Java Code
@JsonProperty("ageApplicationDate")@NotNull@Min(20)@max(99)
public Integer getAgeApplicationDate() {
return ageApplicationDate;
}
public void setAgeApplicationDate(Integer ageApplicationDate) {
this.ageApplicationDate = ageApplicationDate;

Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

Sorry, this is my YAML error.
maxlength should be maxLength.

I close this issue.

Thanks.