These are chat archives for zalando/play-swagger

1st
Jun 2016
slavaschmidt
@slavaschmidt
Jun 01 2016 17:46
@reactormonk hey, could I ask you to give me some apiary specification for integration testing?
Simon Hafner
@reactormonk
Jun 01 2016 18:48
I'll strip ours down real quick, how complex do you want it?
slavaschmidt
@slavaschmidt
Jun 01 2016 18:50
thanks! actually, as complex as you will fill comfortable with
I'm thinking about asking you to create a repo I'd create a PR to with the code of the Apib parser so that you are an owner of it
Shouldn't my fork work?
slavaschmidt
@slavaschmidt
Jun 01 2016 19:05
the idea is to make it a completely separate project/plugin
Simon Hafner
@reactormonk
Jun 01 2016 19:06
Ah, that way.
I'm currently using custom templates for e.g. class {{controller.controller}} @Inject()(val cache: CacheApi) extends {{controller.base}} - any way to get that into a non-vendored version?
Hm, how would you handle the sbt integration?
slavaschmidt
@slavaschmidt
Jun 01 2016 19:08
surprisingly, we are discussing exactly this right now on skype
Simon Hafner
@reactormonk
Jun 01 2016 19:08
classloader magic?
slavaschmidt
@slavaschmidt
Jun 01 2016 19:09
no, no need for that
Simon Hafner
@reactormonk
Jun 01 2016 19:10
Right, so I'd just list my swaggerDefinitions task in the readme?
slavaschmidt
@slavaschmidt
Jun 01 2016 19:10
yep
Simon Hafner
@reactormonk
Jun 01 2016 19:11
Got a solution for the second problem? Then I can finally kick the vendored in play-swagger.
slavaschmidt
@slavaschmidt
Jun 01 2016 19:12
Do you have an idea? We have a couple, but they are all equally bad :(
Simon Hafner
@reactormonk
Jun 01 2016 19:12
Define the path in sbt and add "use at your own risk" and maybe some of the parameters for finding the source in generated_controllers
nmc.borst
@nmcb
Jun 01 2016 19:12
@reactormonk Hi, and indeed, it looks like we have quite some strong coupling going on regarding the generation backend. What do you think?
Simon Hafner
@reactormonk
Jun 01 2016 19:13
I don't think you can actually decouple that, just because you need to find the source. Or write a better parser :-/
slavaschmidt
@slavaschmidt
Jun 01 2016 19:13
kinda a directory in the project to lookup for templates?
nmc.borst
@nmcb
Jun 01 2016 19:14
True, more light weight, a rule to use the provided generators by name and fall back on that directory?
Simon Hafner
@reactormonk
Jun 01 2016 19:14
I'd make each provided generator its own sbt entry
Or actually, make all of them depend on a swaggerTemplateDir setting, that should allow people to a) overwrite the directory b) overwrite individual files
slavaschmidt
@slavaschmidt
Jun 01 2016 19:16
yep, I'm talking about the latter aproach
because the first one would mean dependency on play-scala, which is not the only generator we want to have
nmc.borst
@nmcb
Jun 01 2016 19:17
sounds good, i'll make an issue for it.
Simon Hafner
@reactormonk
Jun 01 2016 19:17
Make settings in play-scala which depend onswaggerTemplateDir
slavaschmidt
@slavaschmidt
Jun 01 2016 19:18
+1
Simon Hafner
@reactormonk
Jun 01 2016 19:22
For the source parsing, I'd honestly put in a few more comment markers.
to make it a bit more stable. Might break old sources though :-(
slavaschmidt
@slavaschmidt
Jun 01 2016 19:24
have you seen a last version?
Simon Hafner
@reactormonk
Jun 01 2016 19:25
Nope, got our vendored version. I intend to upgrade after integration & everything.
slavaschmidt
@slavaschmidt
Jun 01 2016 19:25
it's breaking change indeed
but it's stable now
Simon Hafner
@reactormonk
Jun 01 2016 19:26
Ok, I'll start doing some git subtree magic tomorrow and make my own repo.
slavaschmidt
@slavaschmidt
Jun 01 2016 19:27
I almost finished your PR, only need to test it with "real" specification
Simon Hafner
@reactormonk
Jun 01 2016 19:28
So you'll pull it in, not my own repo instead? Or just a subproject?
slavaschmidt
@slavaschmidt
Jun 01 2016 19:28
I'd like to create a clean PR to your repo
so that you'll be the owner
Simon Hafner
@reactormonk
Jun 01 2016 19:29
So I should subtree out the apiary parser into my own repo?
slavaschmidt
@slavaschmidt
Jun 01 2016 19:29
I've done this, it's a separate module already
Simon Hafner
@reactormonk
Jun 01 2016 19:30
Just push it into a branch, I'll copy it over, and make a PR with the data from that branch.
slavaschmidt
@slavaschmidt
Jun 01 2016 19:30
ok, I'll test it and put it back
that's how it would be in the project then:
lazy val root = (project in file(".")).enablePlugins(PlayScala, ApiFirstCore, ApiFirstPlayScalaCodeGenerator, ApiFirstSwaggerParser, ApiFirstApiaryParser)

apiFirstParsers := Seq(ApiFirstSwaggerParser.swaggerSpec2Ast.value, ApiFirstApiaryParser.apiarySpec2Ast.value).flatten
Simon Hafner
@reactormonk
Jun 01 2016 19:34
Should work. I assume you moved the drafter caching stuff into the apiarySpec2Ast task?
Simon Hafner
@reactormonk
Jun 01 2016 19:39
How do you make intellij find the generated code?
The current solution involves a symlink, maybe there's a better version.