swagger-api / swagger-codegen

swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
http://swagger.io
Apache License 2.0
16.91k stars 6.03k forks source link

[Spring] Add hibernate validator annotations #7152

Open elion opened 6 years ago

elion commented 6 years ago
Description

Spring server generator should add hibernate.validator annotations like org.hibernate.validator.constraints.Email to generated model class fields.

For Spring the Hibernate Validator is included in spring-boot-starter-web dependencies and there is no reason not to use it. Could add the feature to other Java generators too.

Swagger-codegen version

2.3.0-SNAPSHOT

Swagger declaration file content

email: type: string format: "email"

holzerch commented 6 years ago

+1