Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sbt plugin to generate a swagger api spec as part of the build pipeline #97

Merged
merged 1 commit into from
Aug 9, 2016

Conversation

mosche
Copy link
Contributor

@mosche mosche commented Aug 4, 2016

Hey,
here's a proposal for the plugin. Happy to get some feedback!
See the comments below for remaining issues.
Regards, Moritz

val file = target.value / "swagger" / "swagger.json"
val args = file.absolutePath +: swaggerDomainNameSpaces.value
val swaggerClasspath = data((fullClasspath in Runtime).value) ++ update.value.select(configurationFilter(swaggerConfig.name))
runner.value.run("com.iheart.playSwagger.SwaggerSpecRunner", swaggerClasspath, args, streams.value.log)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error handling is missing in case generation of the spec fails

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So does it blow up the sbt session? Does it at least display the error?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case of errors the build will now fail ...

@kailuowang
Copy link
Member

First of all thank you so much @mosche ! This will make play-swagger so much better.

@@ -16,7 +16,9 @@ libraryDependencies ++=

Publish.settings

lazy val playSwagger = project in file(".")
lazy val playSwagger = project in file(".") aggregate sbtPlugin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about we move current plays-swagger to a core folder and create new root project that aggregate the play-swagger project and the sbt plugin project?
Here is an example of what I am thinking.
https://github.com/iheartradio/kanaloa/blob/master/build.sbt#L21-L38

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, that would be my preference as well... didn't wanna start moving files around before discussing with you guys

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

restructured the whole project / build as you suggested, should be much cleaner now

@kailuowang kailuowang added this to the 1.0-RC1 milestone Aug 4, 2016
name := "sbt-play-swagger",
sbtPlugin := true,
scalaVersion := "2.10.6",
resourceGenerators in Compile <+= Versioning.writeVersionFile("com/iheart/play-swagger.version"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense. I was thinking sbt-buildInfo but that'll probably be an overkill.

@kailuowang
Copy link
Member

👍 This is fantastic. I left one trivial comment on redundant publishLocal on travis. @joprice you have time to double check?

import sbt.ScriptedPlugin._
import sbt._

object ScriptedTesting {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could use an AutoPlugin here.

@kailuowang
Copy link
Member

@mosche thanks again, It looks to me that this is ready to merge (we can address the minor comment from @joprice in another PR). You still have a 'WIP' label on it, is there anything else you want to add?

@mosche
Copy link
Contributor Author

mosche commented Aug 9, 2016

Hi @kailuowang,
sorry, been some busy two weeks and I got a bit distracted... Let me just squash the commits here and it should be ready to go! :)

…api specs as part of the build pipeline.

in favor of a multiproject build the play-swagger core library moved into the corresponding directory
@mosche mosche changed the title WIP sbt plugin to generate a swagger api spec as part of the build pipeline sbt plugin to generate a swagger api spec as part of the build pipeline Aug 9, 2016
@kailuowang
Copy link
Member

Thanks very much! @mosche merging in.

@kailuowang kailuowang merged commit f48900a into iheartradio:master Aug 9, 2016
@mosche mosche deleted the SbtPlaySwagger branch August 10, 2016 07:06
Javakky-pxv added a commit to scala-steward/play-swagger that referenced this pull request Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants