tribune
tribune copied to clipboard
spike for spring example
Hi, and first kudos for adding these handlers (for Ktor) !
This may not yet be complete.. just to start somewhere with a spring example. Obviously, the spring specifics will have to move to a new module "tribune-spring" (in the works).
So what do you think ?
At some point, when arrow-proofs (Kotlin must have a stable IR) is ready, I'd alos like to explore that route. Plain Kotlin context receivers may be a valuable addition too, but I am still exploring that (that's why I left the compiler arg for it in the grable build)
I like it.
We should make the tribune-spring module you mentioned. Do you want me to merge this first ?
Hi, no merge yet. I will fix some quirks and add the spring module first....
just commented my todo's in spring.kt
I don't see any todos ?
I used Github Mobile App and commented in source spring.kt, never mind..I will commit later
Sam @.***> schrieb am Mi., 24. Aug. 2022, 09:55:
I don't see any todos ?
— Reply to this email directly, view it on GitHub https://github.com/sksamuel/tribune/pull/17#issuecomment-1225334965, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABBKMW7VDK42HIH2PQPXH5TV2XIOTANCNFSM57M65N7A . You are receiving this because you modified the open/close state.Message ID: @.***>
:( @JsonUnwrapped doesn't seem to work with Kotlin, noooooo......!
What's json unwrapped do ?
It would not serialize a field of a complex type, instead it would just directly serialize the complex type.
For my spring endpoint example, I would like to return a properly typed result, and neither ResponseEntity<Any>
nor implement a custom Validated serializer.
So my generic Response type should cover the 2 cases of Validated, but should not pollute the json with its properties.
The good guys from arrow-kt have a Jackson lib, which covers several arrow types. So devs can use that, if they actually want to return "wrapped" responses.
Ultimately, tribune-spring should be flexibel and offer ways to respond according to APIs needs
So essentially you were trying to create the spring version of my ktor "handler" ?
Almost.. your Handler ha unit return type, which is not possible with Spring RestController methods.
@sksamuel Issue with JsonUnwrapped resolved, I'll try to polish this PR soon
Cool
On Mon, 29 Aug 2022 at 10:55, clojj @.***> wrote:
@sksamuel https://github.com/sksamuel Issue with JsonUnwrapped resolved, I'll try to polish this PR soon
— Reply to this email directly, view it on GitHub https://github.com/sksamuel/tribune/pull/17#issuecomment-1230506610, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFVSGXVHC73D63D4SLHXI3V3TMORANCNFSM57M65N7A . You are receiving this because you were mentioned.Message ID: @.***>
Apart from being an example/teaser for spring folks, the basic question seems what real-world features such a handler can bring to the table: if it should serve as a generic "protection layer" in API controllers, return type and configurability stand out to me...
@sksamuel first shot at trubune-spring module
Would this return a 200 for both error and success?
Would this return a 200 for both error and success?
no, the jsonResponseHandler will return 404
I am really struggling with gradle-multiplatform... weird messages in IntelliJ, restart fixes them, gives me the feeling of 'only works on my machine' Get the message "...missing wrapper" should/must I add a /gradle/wrapper subdir for tribune-spring ?
Just refactored the handler to make it more generic
there probably is a better alternative to having nullable parameters for each parse-outcome, but hey.. it's Kotlin :)
got rid of that nullables + fixed response code
There should also probably be a reactive-spring example later, as we are preferrably in suspend land :)
@sksamuel I think this is could be ready for merge, what do you think ?
I'll check it out.
On Sun, 4 Sept 2022 at 12:09, clojj @.***> wrote:
@sksamuel https://github.com/sksamuel I think this is could be ready for merge, what do you think ?
— Reply to this email directly, view it on GitHub https://github.com/sksamuel/tribune/pull/17#issuecomment-1236381332, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFVSGWTOM3XO55D7SIGAGDV4TJV5ANCNFSM57M65N7A . You are receiving this because you were mentioned.Message ID: @.***>
This is nice. Pity we need the wrapper json but otherwise slick.
Ok cool.
On Wed, 24 Aug 2022 at 01:19, clojj @.***> wrote:
Hi, no merge yet. I will fix some quirks and add the spring module first....
— Reply to this email directly, view it on GitHub https://github.com/sksamuel/tribune/pull/17#issuecomment-1225249491, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFVSGVGAJFRI2OTH4XEECTV2W5FJANCNFSM57M65N7A . You are receiving this because you commented.Message ID: @.***>