Comments (10)
Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.
from jasyncapi.
@jarpz do you mean https://github.com/asyncapi/generator/?
from jasyncapi.
@jarpz do you mean https://github.com/asyncapi/generator/?
Yes, where did we find your templates, or how we implement our custom templates? I mean for instance in: https://github.com/OpenAPITools/openapi-generator
You can create your custom templates or extends existing ones.
Regards
from jasyncapi.
so AsyncAPI Generator is what you're looking for. It is a tool that allows you to write templates. We have some official templates like this and you can also write custom ones on your own. There is a sample that teaches all generator options. We also write a library that can in addition generate models for different languages, so when you write a template you focus on writing template for main app logic and do not have to care about templating models.
Makes sense?
from jasyncapi.
so AsyncAPI Generator is what you're looking for. It is a tool that allows you to write templates. We have some official templates like this and you can also write custom ones on your own. There is a sample that teaches all generator options. We also write a library that can in addition generate models for different languages, so when you write a template you focus on writing template for main app logic and do not have to care about templating models.
Makes sense?
No, I missunderstand this plugin allow me to use it just with maven. In the case of https://github.com/asyncapi/generator, you need to install npm and nodejs. We are looking for a plugin full java that allows code generation.
Any info about that?
Or if we can use your plugin.. any example? I can find any documentation about how to use it as maven plugin, config options.
Our approach is to generate code from the contract and put it in the target folder, use it at runtime.. we don't git models.
Regards
from jasyncapi.
@jarpz I know people are able to run npm
with maven
but I'm personally not java user so never tried it:
- https://gist.github.com/phillipgreenii/7c954e3c3911e5c32bd0
- https://auth0.com/blog/integrating-node-dot-js-build-tools-with-maven/
- https://github.com/eirslett/frontend-maven-plugin
have a look at those articles, once you get it running it would be super cool if you could contribute an instruction. Better to integrate npm with maven then write completely separate code generator
from jasyncapi.
@jarpz did you give it a try?
from jasyncapi.
@jarpz did you give it a try?
Yeah, that was my solution, but it is not elegant. As you know this method generated a complete scaffolding for an "empty" application, So When we used to put files in the target. the code is not recognized because generated java sources change the order of the folders (src,main). So, we had to use another plugin to add additional classpath classes.
The solution is like that:
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.12.0</version>
<executions>
<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
</execution>
<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>run generator</id>
<goals>
<goal>npm</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<arguments>run generate -- -p javaPackage=${package}</arguments>
</configuration>
</execution>
</executions>
<configuration>
<nodeVersion>v14.17.0</nodeVersion>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>target/generated-sources/asyncapi/src</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
That's why I'm looking for a java-native asyncapi plugin.
Regards
from jasyncapi.
@jarpz I think it is better to have just few lines of XML than writing an alternative generator in Java. Much less work, even if it doesn't look super elegant. Unless you mean That's why I'm looking for a java-native asyncapi plugin.
that it would be cool to have maven plugin just like frontend-maven-plugin
- this would be cool I think. Then please propose a solution here https://github.com/asyncapi/community/issues
As for your current configuration:
<execution>
<id>run generator</id>
<goals>
<goal>npm</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<arguments>run generate -- -p javaPackage=${package}</arguments>
</configuration>
</execution>
Do I get it right that you have a package JSON where you have a generator and the template set as dependencies. Probably to lock versions, right? Then it makes sense
from jasyncapi.
This issue has been automatically marked as stale because it has not had recent activity 😴
It will be closed in 60 days if no further activity occurs. To unstale this issue, add a comment with detailed explanation.
Thank you for your contributions ❤️
from jasyncapi.
Related Issues (20)
- Verify Kafka bindings
- Verify Mercure bindings
- Verify MQTT bindings
- Verify NATS bindings
- Verify Pulsar bindings
- Verify Redis bindings
- Verify SNS bindings
- Verify Solace bindings
- Verify SQS bindings
- Verify STOMP bindings
- Verify WebSockets bindings
- Choose binding from given version
- Parse correctly schemas different to AsyncAPI schema HOT 3
- Specification validation trough validation API HOT 1
- Ensure that 2.0.0 was implemented correctly
- [BUG] AsyncAPI v3.0.0 no longer serializable HOT 9
- [FEATURE] Expose custom bindings HOT 2
- [BUG] Missing compatibility with IntelliJ IDEA 2024.2.0.1 HOT 2
- [BUG] [asyncapi-core] lombok dependency should be marked as `provided`
- [FEATURE] jakarta validation-api JSR 303
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jasyncapi.