These are chat archives for zalando/play-swagger

13th
May 2016
slavaschmidt
@slavaschmidt
May 13 2016 07:43
@reactormonk where am I supposed to look to create a PR? I've tried with reactormonk/play-swagger but can only see the APIB-related stuff there
Simon Hafner
@reactormonk
May 13 2016 07:46
slavaschmidt, zalando/play-swagger#105 - ah darn, got conflicts again
slavaschmidt
@slavaschmidt
May 13 2016 07:46
ohhhhh
sorry, i wasn't aware that you placed both issues into the same PR
i'll take a look
i probably will have to cherry-pick ADT stuff from the PR as we want to handle APIb support differently
Simon Hafner
@reactormonk
May 13 2016 07:48
Go ahead, if you still want to produce the same data structure, it should be fairly simple.
slavaschmidt
@slavaschmidt
May 13 2016 07:49
yep, thanks
Simon Hafner
@reactormonk
May 13 2016 07:50
The parser parses into case classes, with most error checking in the decoers.
I have a few helper methods for the decoders, but otherwise it should be somewhat straightforward.
In the generator, I have def transform()... which might not have been the best naming idea, feel free to rename.
slavaschmidt
@slavaschmidt
May 13 2016 07:53
I hope it won't be needed :) can you remember the discussion about leaving every parser completely on it's own? I think what i will do is to extract swagger parser from the play-swagger and refactor the APIb parser so that it can live in your repo
but let me look at ADT first
Simon Hafner
@reactormonk
May 13 2016 07:54
Ah, might be the best idea.
I also pushed the writers to the caller site.
slavaschmidt
@slavaschmidt
May 13 2016 13:22
still need to figure out the disjoint type of the action result
currently it only works if an action can only return single ResultWrapper type, but that's not always the case
@reactormonk do you like to take a look or should i ?
Simon Hafner
@reactormonk
May 13 2016 13:25
slavaschmidt, that's by design. Where would you want multiple?
slavaschmidt
@slavaschmidt
May 13 2016 13:25
quite often
that's an example:
            if ("abracadabra" == token) tokenPost200(TokenPostResponses200("the name of the user", Seq("admin:org")))
            else tokenPost401("Wrong token")
different type parameters in single action
Simon Hafner
@reactormonk
May 13 2016 13:27
Then make it a path-dependent type instead imo
slavaschmidt
@slavaschmidt
May 13 2016 13:28
basically any action with more than one possible return code
Simon Hafner
@reactormonk
May 13 2016 13:28
Take a look at the EmptyReturn and NotImplementedYet
Simon Hafner
@reactormonk
May 13 2016 13:34
... in that case it should be unified to sealed trait tokenPost
Hm, even with ResultWrapper[_], it should still work, you're only interested in toResult after all.
slavaschmidt
@slavaschmidt
May 13 2016 13:39
nope, it does'n compile
for example this one:
            if ("abracadabra" == token) tokenPost200(TokenPostResponses200("the name of the user", Seq("admin:org")))
            else NotImplementedYet
produces
Error:(51, 25) no type parameters for method apply: (v1: TokenService.this.tokenPostActionType[T])play.api.mvc.Action[play.api.mvc.AnyContent] in trait Function1 exist so that it can be applied to arguments (de.zalando.play.controllers.Base64String => TokenService.this.tokenPostType[_ >: example.yaml.TokenPostResponses200 with play.api.mvc.Results.EmptyContent <: Product with Serializable] with Product with Serializable)
 --- because ---
argument expression's type is not compatible with formal parameter type;
 found   : de.zalando.play.controllers.Base64String => TokenService.this.tokenPostType[_ >: example.yaml.TokenPostResponses200 with play.api.mvc.Results.EmptyContent <: Product with Serializable] with Product with Serializable
 required: TokenService.this.tokenPostActionType[?T]
    (which expands to)  de.zalando.play.controllers.Base64String => TokenService.this.tokenPostType[?T]
        val tokenPost = tokenPostAction { (token: Base64String) =>  
                        ^


Error:(51, 65) type mismatch;
 found   : de.zalando.play.controllers.Base64String => TokenService.this.tokenPostType[_ >: example.yaml.TokenPostResponses200 with play.api.mvc.Results.EmptyContent <: Product with Serializable] with Product with Serializable
 required: TokenService.this.tokenPostActionType[T]
    (which expands to)  de.zalando.play.controllers.Base64String => TokenService.this.tokenPostType[T]
        val tokenPost = tokenPostAction { (token: Base64String) =>  
                                                                ^
thank God it's a weekend :)
Simon Hafner
@reactormonk
May 13 2016 13:42
trait ResultWrapper { type ResultT } <- maybe that version?
The compiler will most likely complain if you call result afterwards, but toResult should still work.
slavaschmidt
@slavaschmidt
May 13 2016 13:46
yep, I'll check