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

Allow to get the body as String #28

Closed magro closed 3 years ago

magro commented 3 years ago

We need to calculate a signature of the body (String), which is not possible today because on successful validation the body is deserialized with jackson. Consuming the body additionally is not straight forward, therefore it makes sense that the validator allows to handle the consumed body as String.

To support this case, it's now possible to specify

This solution gives some flexibility on how to transform the String to the desired value passed to the handler - there may be other cases than just getting the String.

An alternative solution to support this case would be to handle the get-string-body case very specifically, but then for other cases other solutions might have to be introduced. Therefore the more flexible solution is preferred.

magro commented 3 years ago

Hi @cdimascio, any chance to get that reviewed/merged/released soonish?

magro commented 3 years ago

ping @cdimascio

cdimascio commented 3 years ago

@magro apologies. somehow i missed this. reviewing

magro commented 3 years ago

@cdimascio Ha, now it took me some time :-) I updated the README now...

Update: while going through the README I also noticed that java support is needed ;-) Therefore I removed the default argument and added a separate/overloading method instead...

magro commented 3 years ago

Ping @cdimascio again :-)

cdimascio commented 3 years ago

@magro apologies for the delay. bintray discontinued there service on may 1. i had used them to manage publication to mavencentral and jcenter. i need to find a new mechanism.

in the meantime, i published a new package version (with your change) to github packages. for now, you can pull the latest version from there

https://github.com/cdimascio/openapi-spring-webflux-validator/packages/806006

magro commented 3 years ago

Thanks for merging and publishing via github!

You can publish to maven central via sonatype, once the setup is done it's quite easy. https://central.sonatype.org/publish/publish-guide/

cdimascio commented 3 years ago

thanks a lot! i just published to sonatype. the staging event has not yet started. this used to take up to a few hours when using bintray. the same may be the case here.

cdimascio commented 3 years ago

it's successfully published to sonatype, i believe it should make it to mavencentral shortly

image

cdimascio commented 3 years ago

should be on mavencentral now

magro commented 3 years ago

Awesome, thanks! :+1: