-
Notifications
You must be signed in to change notification settings - Fork 47
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 gradle plugin #15
Comments
Vote for that 👍 |
Hi, Pull requests are really welcome here, but I'm afraid that neither me nor the creator of this library (@raphaeljolivet) has personal use-case for it (and therefor lack of interest in personally developing that plugin). I've done a lot of development in this repository to fulfill my own project needs, but most of them are related to java2typescript-jackson subproject, as i'm not using JAX-RS or maven plugin. So while I'm using Gradle, i'm not interested in Gradle plugin, that works the same way as java2typescript-maven-plugin. |
For me it would be nice to simply transpile my POJO Java objects form some specific package to TS and put them in UI app folder on every build, so I could use them on UI... Is that sounds realistic ? :) |
@Kravs, so basically You just need a wrapper around java2typescript-jackson. I'm writing down some initial thoughts about this feature, that could become basis for configuration options. Main inputs:
Java2typescript-jackson has several configuration options:
Some of the configuration options are not just a matter of choosing smth out of given options, but setting an implementation for smth, for example naming strategy. Also one might want to prepend smth to the beginning of generated file (for example some comments to disable tslint rules for this file, instead of excluding the whole file) - probably plugin doesn't need to handle it. |
@atsu85 Well I'm not familiar with such deep details, but I'm open to provide help if needed.
I can see that "java2typescript-jackson" is in java so I suppose I could help. UPDATE: Sorry for confusing :) Now I'm walked through the code, and understand that this project generates only Data objects and enums (with different approaches) so that is useful for Client - service communication.... Also now I'm understand how to create gradle plugin for it (tests are the best documentation) .... I'm thinking if it is really needed for me, because I'd like to have methods implementation... |
@Kravs, I'm not sure, if after Your updates in comments You got the answers to Your questions or not, but I'll try to answer/comment some of them:
That is because Jackson is used to create to model that contains information about classes (fields, methods and even constants, if configured so) and enums.
That is because the classes, that You should feed into the "TypeScript declarations generator", should be POJOs - there is no room for the implementation, just the structure. TypeScript interfaces perfectly describe the structure of Java POJOs. I don't really understand where could You benefit from the implementation for generated TypeScript declarations?
Could You explain, what would be the use-case where You'll need the method implementations? |
Hi you, my use case is, that instead of using the mvn plugin (https://github.com/raphaeljolivet/java2typescript/tree/master/java2typescript-maven-plugin), |
@atsu85 I got answers, but thank you for explaining in details :) Use case for method implementation:
|
@raDiesle, do I understand correctly, that You are using JAX-RS to implement backend-api endpoints/controllers? |
@Kravs, I'm quoting You
This is exactly what java2typescript-jackson subproject does - creates TypeScript types based on POJOs (Java classes that don't serve any other special role nor implement interfaces of any of the Java frameworks, nothing related to implementation).
POJOs have nothing to do with implementation (except getting/setting the field value, and You don't need implementation for that when converting class to TypeScript - just structure of the Java class represented as TypeScript interface with fields).
This only makes sense, if You say, that in addition to what You said previously, You also want to generate JavaScript or TypeScript for api-client, that sends http requests to Your backend API. If this is the case, then You really want smth quite similar to java2typescript-maven-plugin, that uses both java2typescript-jackson and java2typescript-jaxrs (expects You have written Your backend API endpoints/controllers with JAX-RS). I hope I was able to clear some misunderstanding generated here meanwhile. So what do You actually need? |
supporting gradle plugin would be great
The text was updated successfully, but these errors were encountered: