Generator: Java generator

Created on 25 Sep 2019  路  15Comments  路  Source: asyncapi/generator

I'm trying to use the java generator.

I converted my yaml to 2.0, it works with html & markedown but when i try to generate with java-spring, the files generated are juste an empty template.

Something is wrong with the generator ?

bug

Most helpful comment

Hey thread, i'm glad to say that java-spring-template is now support spec 2.0 and also has some lovely features.
@fmvilas @derberg maybe we could close this issue and deny PR #188 (i checked, current functionality exceed it)

All 15 comments

Hey @AlexTwX. Yes, apparently there's a problem. @rmelian is going to work on fixing it as I'm not very proficient in Java. Also, any guidance or clues you may find are very welcome. Thanks for reporting it!

hi @AlexTwX can you please share your specification or some part of it so I can test. I'm happy to help you here

You can try with the example in the java-spring readme.
https://github.com/asyncapi/generator/tree/master/templates/java-spring
Before and after converted it with https://github.com/asyncapi/converter

any news here? this is pretty much unusable at the moment..

Not yet. We'll soon work on this but can't tell you what soon exactly means yet. In any case, any contribution would be greatly appreciated :)

Running into the same issue, going to have a peek at the code and see if anything obvious is happening to muck with the templates.

Ah so I think the root of it is that the Java generator was not updated for the 2.0.0 schema. I'll share my work over here as I go: nickspacek/generator@02c2d1a

So I'm mostly finished what I wanted to accomplish; the templates that exist are turning into Java code now. Would like to do a round of cleanup with lessons learned as I went through.

What is supposed to be happening with server definitions and server variables when processed by the templates? For example, a URL that has a port, and the port exists as a server variable. Is that supposed to remain a placeholder in the template, or should the generator itself or the templating code be filling in the port with the defaultValue()?

Hey @nickspacek! This is great stuff. Currently, we're not processing server variables yet. It's been reported here. A good first step would be to just connect to the raw url string, without performing any replacement. One thing we're doing on the Node.js template is to make the server param mandatory. This way, you only have to deal with a single server in the generated code.

As a later improvement, we can implement support for multiple servers and protocols and server variables. What do you think?

Ah cool, I hadn't seen that ticket but that is the same thing the Java template currently does. I did mandate the server param, presently the generated code doesn't build/successfully test because the Spring framework for Java is trying to initialize the application using the generated configuration file and one class or another chokes on the strange connection strings that are being generated with {port} inside. I may build in a .hook for now that cleans it up conditionally when present in the URL and leave it in the template so that if it is addressed in the core down the road it will (maybe) Just Work.

I understand. That sounds good :+1:

@wolfey I'd be interested to see it generate something besides the example schema so if you find time to take it for a spin I'd appreciate your feedback.

Hi guys! I'm taking a look at this issue. I'll come up with a PR to discuss the approach in the coming weeks.

Hey thread, i'm glad to say that java-spring-template is now support spec 2.0 and also has some lovely features.
@fmvilas @derberg maybe we could close this issue and deny PR #188 (i checked, current functionality exceed it)

Indeed! I also closed #188. Thanks, @Tenischev! 馃檶

Was this page helpful?
0 / 5 - 0 ratings

Related issues

derberg picture derberg  路  8Comments

jdall picture jdall  路  5Comments

ymarillet picture ymarillet  路  9Comments

jonaslagoni picture jonaslagoni  路  4Comments

derberg picture derberg  路  8Comments