gradle build fails for java-spring-template generated code.
Closed this issue ยท 12 comments
Describe the bug
The generated code fails to build.
How to Reproduce
The code generated by ..
ag streetlights.yaml @asyncapi/java-spring-template -o generated/java-spring --force-write
fails to build using ...
gradle build
with the following errors ...
> Task :compileJava FAILED
/Users/johncatlin/Documents/asyncapi/generator/api/generated/java-spring/src/main/java/com/asyncapi/model/SentAt.java:30: error: illegal start of expression
}
^
/Users/johncatlin/Documents/asyncapi/generator/api/generated/java-spring/src/main/java/com/asyncapi/service/CommandLinePublisher.java:18: error: <identifier> expected
publisherService.("Hello World from event.lighting.measured");
^
/Users/johncatlin/Documents/asyncapi/generator/api/generated/java-spring/src/main/java/com/asyncapi/service/PublisherService.java:13: error: <identifier> expected
void (String data);
^
/Users/johncatlin/Documents/asyncapi/generator/api/generated/java-spring/src/main/java/com/asyncapi/service/MessageHandlerService.java:16: error: '(' expected
public void handleEvent.lighting.measured(Message<?> message) {
^
/Users/johncatlin/Documents/asyncapi/generator/api/generated/java-spring/src/main/java/com/asyncapi/service/MessageHandlerService.java:16: error: <identifier> expected
public void handleEvent.lighting.measured(Message<?> message) {
^
/Users/johncatlin/Documents/asyncapi/generator/api/generated/java-spring/src/main/java/com/asyncapi/infrastructure/Config.java:40: error: ';' expected
private String event.lighting.measuredTopic;
^
/Users/johncatlin/Documents/asyncapi/generator/api/generated/java-spring/src/main/java/com/asyncapi/infrastructure/Config.java:40: error: <identifier> expected
private String event.lighting.measuredTopic;
^
7 errors
FAILURE: Build failed with an exception.
Expected behavior
It should build without errors?
Welcome to AsyncAPI. Thanks a lot for reporting your first issue.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.
Similar outcome for this ...
ag https://raw.githubusercontent.com/asyncapi/generator/master/test/docs/dummy.yml @asyncapi/java-spring-template -o generated/java-spring --force-write
@Tenischev would you mind having a look?
@JohnRCatlin please provide used streetlights.yaml
file.
Also, please take into account amqp
support is not very stable.
Support of several servers with different protocols like in dummy.yml
is not supported very well yet.
Last days i worked on stable support of mqtt
#58
Based on some hints from mentioned errors fast fix for Kafka #59
I've attached as requested.
streetlights.yaml.zip
Thank you @JohnRCatlin another part of fix in #62
Please pay attention that in #58 operationId
was declared as MUST for each operation, otherwise it's difficult to give a method/variable name based on channel name.
Hey @JohnRCatlin , all PR closed, please check again.
Also, from my previous comment:
Please pay attention that in #58 operationId was declared as MUST for each operation, otherwise it's difficult to give a method/variable name based on channel name.
Hi @Tenischev
Sorry to be slow responding.
Thanks for looking at this I really appreciate it ๐
I've just discovered the spectral linter, which I'll now include in my 'pre-generate' procedure.
It should help stop this sort of 'user error' going forwards ๐ค
Hey @JohnRCatlin! It would be a great idea to make both work together but keep in mind that the error you faced here has nothing to do with AsyncAPI itself but with the template. This template makes the existence of operationId
mandatory. If you envision another way of making this work together, feel free to open an issue at github.com/asyncapi/parser-js. We would be happy to hear how to make it work :)
@Tenischev remember you can make your template fail when it doesn't find the operationId
field. This way you can send a more meaningful message to the user explaining that this field is required, and it will fail during the generation process.
This issue has been automatically marked as stale because it has not had recent activity ๐ด
It will be closed in 30 days if no further activity occurs. To unstale this issue, add a comment with detailed explanation.
Thank you for your contributions โค๏ธ