我的合同描述符中有以下模型
BaseGroup:
type: object
properties:
name:
type: string
pattern: '^\p{Alnum}+$'
maxLength: 50它会生成
public class BaseGroupDto {
@JsonProperty("name")
private String name;
/**
* Get name
* @return name
*/
@ApiModelProperty(required = true, value = "")
@NotNull
@Pattern(regexp="^\\p{Alnum}+$")
@Size(max=50)
public String getName() {
return name;
}
...
}有没有可能以某种方式将openapi生成器配置为使用@Max而不是@Size进行长度检查?
我使用这个maven插件来生成DTO。
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>3.3.4</version>
</plugin>发布于 2019-06-24 18:48:16
使用javax验证@max表示最大值,而不是最大大小
https://stackoverflow.com/questions/56734922
复制相似问题