Body validation does not work?
See original GitHub issueI’m trying to get validator to work on the body of this route:
'/filtered':
put:
summary: blah
parameters:
- in: body
name: body
required: true
schema:
type: object
required:
- filtered
properties:
filtered:
description: status of ssid
type: boolean
here are my request parameters:
{ uri: 'http://127.0.0.1/apiv2/filtered', headers: { 'x-api-key': 'blah' }, json: { test: 'test' } }
I expect openapi-express to return 400, because body should be an object with filtered prop. Yet I get 200 response. Swaggerize express worked fine with this one. Am I doing something wrong here? I’ll edit this to make it more reproducible after lunch…
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Spring boot @Valid on requestBody in controller method not ...
Validations are working correctly on primitive variable in request (on age in below example) but not working on pojo request body.
Read more >Validate Request Body and Parameter in Spring Boot
In this tutorial, we will see how to use Spring features to validate the request body and request parameters.
Read more >Validate Request Body and Parameter in Spring Boot - Medium
When Spring finds an argument annotated with @Valid, it automatically validates the argument and throws an exception if the validation fails. Run the ......
Read more >Validation with Spring Boot - the Complete Guide - Reflectoring
Very basically, Bean Validation works by defining constraints to the fields of a class by annotating them with certain annotations. Common ...
Read more >JSR-303 @Valid validation is not invoked for @RequestBody ...
If an argument to a Spring MVC Controller method is annotated with both the @RequestBody and @Valid annotations, the argument should be passed...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks, you’re awesome. Looks like I’ll be able to replace swaggerize-express lib with this one after all.
You’re welcome! Happy to have you! Don’t hesitate to report issues here.