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

Support play for java and scala server. #3057

Open
clasnake opened this issue Jun 6, 2016 · 10 comments
Open

Support play for java and scala server. #3057

clasnake opened this issue Jun 6, 2016 · 10 comments

Comments

@clasnake
Copy link
Contributor

clasnake commented Jun 6, 2016

Description

Seems no support for play now.
Shall we support play for java and scala server, so that server-side code based on the play framework can be auto-generated according to the rest spec.

@wing328
Copy link
Contributor

wing328 commented Jun 6, 2016

@clasnake we would definitely welcome contribution for a play framework server stub generator.

Here is a good starting point: https://github.com/swagger-api/swagger-codegen/wiki/How-to-add-a-generator-for-a-new-language-or-framework

@clasnake
Copy link
Contributor Author

clasnake commented Jun 6, 2016

@wing328 I'll take a look at this one. And shall we add label Server: Scala as well?

@clasnake
Copy link
Contributor Author

clasnake commented Jun 6, 2016

@wing328 Well I see the play integration at https://github.com/swagger-api/swagger-play as a separate repo and https://github.com/zalando/play-swagger to generate play code from the spec. So I guess no need to add it into swagger-codegen?

@wing328
Copy link
Contributor

wing328 commented Jun 6, 2016

cc @ePaul

@ePaul
Copy link
Contributor

ePaul commented Jun 6, 2016

@wing328 Thanks for pinging me.

Although that project (zalando/play-swagger) is from my company, I didn't use it until now (my team is using neither Play nor Scala).

Looking at the README, it seems to have a bit different approach than Swagger-Codegen. It is integrated in the Scala Build tool, generating both managed code (i.e. code which is generated in the target folder, which you shouldn't edit) and unmanaged code (code which you can edit, and which might get modified later by the plugin, keeping your edits). I'm not sure if the latter one would be possible at all with Swagger-Codegen's current architecture.

(Swagger-Play seems to be the Scala/Play version corresponding to Java's Swagger-annotations, generating Swagger/OpenAPI from Play code. This would be the inverse approach to play-swagger, though both names should be swapped to describe what they are doing.)

@clasnake Please check if the play-swagger generator works for you (and report any issues back to that repository's tracker). If it doesn't, having more ways to support end-to-end type safety (which is one of the reasons I want to have Swagger-generation) is always good, so you are welcome to contribute a generator here (though I can't really comment much on it, knowing Scala only very superficially – I don't like the syntax).

@wing328 wing328 modified the milestones: v2.3.0, v2.2.0 Jul 7, 2016
@wing328 wing328 modified the milestones: v2.2.1, v2.2.2 Aug 8, 2016
@JFCote
Copy link
Contributor

JFCote commented Jan 11, 2017

Hi, is there something started for play framework codegen export? We would be interested in such feature and maybe we could contribute if something is already started. The alternative stated above are good but don't use the codegen and don't follow the process we would want to use. Let me know! Thanks

@wing328
Copy link
Contributor

wing328 commented Jan 12, 2017

@JFCote there's a sample for Swagger Play framework sample app (Petstore) at https://github.com/swagger-api/swagger-play-sample-app (which was created 5 years ago)

One approach is to reverse engineer the output (the sample play app) back into the mustache template.

Let me know if you're interested in the work and we can work together to create the Play generator.

@JFCote
Copy link
Contributor

JFCote commented Jan 12, 2017

@wing328 : I'm VERY new to Swagger, I still need to understand a lots of thing before doing something like that. But right now I can tell you:

  • This sample is VERY old. Play Framework is now at version 2.5.10. So the first thing should be to update the sample to the latest version (or create a new one?).
  • Shoud we support multiple version of play or just the latest? (Each version have breaking changes)
  • Should we support Java and Scala codegen for Play? I know the Java part but don't have any experience is Scala.
  • What is a mustache template? :)

I need to learn a bit more about swagger, I'll keep you updated.

@wing328
Copy link
Contributor

wing328 commented Jan 12, 2017

Shoud we support multiple version of play or just the latest? (Each version have breaking changes)

Let's start with the latest stable version (2.5.10) to being with.

Should we support Java and Scala codegen for Play? I know the Java part but don't have any experience is Scala.

Let's start with Java 😄

What is a mustache template? :)

An example is https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/main/resources/Java/pojo.mustache#L79, which will be used by the Java generator when generating the models and {{...}} (e.g. {{name}}) are variables in the mustache template.

@JFCote
Copy link
Contributor

JFCote commented Mar 6, 2017

@clasnake : You'll be happy to know I've created a pull request for Java Play Framework: #4943
If it's merged, you will have all you need to generate a complete Java server with Play Framework.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants