cdimascio / openapi-spring-webflux-validator

🌱 A friendly kotlin library to validate API endpoints using an OpenApi 3.0 and Swagger 2.0 specification
Other
97 stars 13 forks source link

Fix issue of returns success for empty body #4

Closed marcinziolo closed 5 years ago

cdimascio commented 5 years ago

Thanks for the PR. Question for you, when you define the OpenAPI specification for your route, did you set the request body as required: true e.g.

 /pets:
    post:
      summary: Add a new pet
      requestBody:
        description: Optional description in *Markdown*
        required: true .  # <------ do you have this set?
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Pet'
marcinziolo commented 5 years ago

Thanks for the PR. Question for you, when you define the OpenAPI specification for your route, did you set the request body as required: true

Yes I set the request body as required. I think problem is that if we send empty body, mono is empty and therefore swagger validation isn't invoked at all.

cdimascio commented 5 years ago

Thanks. merging. will roll a new jar and post to maven/jcenter shortly

cdimascio commented 5 years ago

v2.1.1 is now available. It may take a day or so to make it to maven central. It is available now on jcenter.

for gradle

repositories {
    maven {
        url  "https://dl.bintray.com/cdimascio/maven" 
    }
}
cdimascio commented 5 years ago

Thanks again for the PR! :)