cxf icon indicating copy to clipboard operation
cxf copied to clipboard

Add basic bean-validation (JSR-303) support + Swagger annotation support

Open jfiala opened this issue 9 years ago • 2 comments

Changes based on PR #146, but I needed to create a new PR because I cannot modify the source branch.

Added basic bean-validation and on example for Swagger annotation support to the WadlGenerator for parameters.

Parameters

Overview bean-validation support

  • [x] @NotNull
  • [x] @Size
  • [x] @Min
  • [x] @Max
  • [x] @Pattern

Overview Swagger annotation support

  • [x] @ApiParam
  • [ ] @ApiOperation
  • [ ] @ApiResponses / @ApiResponse
  • [ ] @ApiModel

Pls let me know if support is desired, then I'll add the others...

Open questions

  • add test cases
  • add switch for bean-valdation-support (?)
  • extract bean validation methods to separate BeanValidationUtil

Body Parameters

Open questions:

They have to be added after the JAXB processing, probably in getSchemaCollection(). How can the annotations of the objects be accessed there? Or can I hook somehow into the JAXB parsing (JAXBUtils.generateJaxbSchemas?)

jfiala avatar Nov 14 '16 12:11 jfiala

Johannes, please start from the latest email discussion and proceed from there, thanks. Lets put all this XML schema + Bean Validation on hold for now

sberyozkin avatar Nov 14 '16 13:11 sberyozkin

@sberyozkin Is there an approach suggested at the moment?

I'm using Jersey because of design constraints, but this tool helped me a lot on doing contract-first, generating my Java classes from an wadl, so it would be nice to have this feature.

As commented from others in the thread, cxf itself can benefit of using Beans Validation because it's easy to get better user friendly validation messages.

sergiomichels avatar Jan 27 '17 00:01 sergiomichels