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

Java generator #134

Closed
AlexTwX opened this issue Sep 25, 2019 · 15 comments
Closed

Java generator #134

AlexTwX opened this issue Sep 25, 2019 · 15 comments
Labels
bug Something isn't working

Comments

@AlexTwX
Copy link

AlexTwX commented Sep 25, 2019

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 ?

@fmvilas
Copy link
Member

fmvilas commented Sep 25, 2019

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!

@fmvilas fmvilas added the bug Something isn't working label Sep 25, 2019
@rmelian
Copy link
Contributor

rmelian commented Sep 26, 2019

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

@AlexTwX
Copy link
Author

AlexTwX commented Oct 3, 2019

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

@rmelian rmelian self-assigned this Oct 6, 2019
@wolfey
Copy link

wolfey commented Nov 14, 2019

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

@fmvilas
Copy link
Member

fmvilas commented Nov 18, 2019

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 :)

@nickspacek
Copy link

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.

nickspacek pushed a commit to nickspacek/generator that referenced this issue Nov 29, 2019
Converts previous mapping of AsyncApi 1.0.0 topics to AsyncApi 2.0.0
channels in some basic form for the PublisherService.java template.

Bug: asyncapi#134
nickspacek pushed a commit to nickspacek/generator that referenced this issue Nov 29, 2019
Converts previous mapping of AsyncApi 1.0.0 topics to AsyncApi 2.0.0
channels in some basic form for the PublisherService.java template.

Bug: asyncapi#134
@nickspacek
Copy link

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

@nickspacek
Copy link

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()?

nickspacek added a commit to nickspacek/generator that referenced this issue Dec 2, 2019
Converts previous mapping of AsyncApi 1.0.0 topics to AsyncApi 2.0.0
channels in some basic form for the PublisherService.java template.

Bug: asyncapi#134
@fmvilas
Copy link
Member

fmvilas commented Dec 2, 2019

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?

@nickspacek
Copy link

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.

@fmvilas
Copy link
Member

fmvilas commented Dec 2, 2019

I understand. That sounds good 👍

@nickspacek
Copy link

@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.

@fnobilia
Copy link

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.

@Tenischev
Copy link
Member

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)

@fmvilas fmvilas closed this as completed Apr 27, 2020
@fmvilas
Copy link
Member

fmvilas commented Apr 27, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants