blue-veery-gmbh / spring-rest-2-ts

spring rest 2 ts is typescript generator which produces data model and services in typescript based on Spring MVC annotations. It supports generation for Angular and React
MIT License
64 stars 17 forks source link

Motivation compared to similar solutions #19

Closed raDiesle closed 3 years ago

raDiesle commented 3 years ago

Hello, nice to stumbled upon your solution.

It would be interesting to understand the motivation compared to similar frameworks, so its easier to understand which fits to my purposes, such as https://github.com/vojtechhabarta/typescript-generator or https://github.com/raphaeljolivet/java2typescript

tomasz-wozniak75 commented 3 years ago

Hey To explain our motivation, historical background is important. There was a beginning of 2017 and we wanted in the company typescript generator which will generate not only type definitions but also real implementations which will be able to call rest services created in Spring MVC. None of mentioned project supported implementation generation for Spring if at all they supported at this time implementation generation. So we started from supporting Spring REST services and we added later JAX-RS support. This was a main driver for us but we also wanted to have:

  1. configuration in code (not in maven) because many elements of our solution is interface based which allowed us to customize code generation between projects (eg name mappings from Java to TS, module mappings, Java classes inclusions/exclusions for code generations) in short if our generic solution doesn't meet Your specific needs you can change it in the configuration without needs to wait for next release of your selected code generator.
  2. we wanted to have possibility to keep generated code in many modules, not in one big chunk of generated code on which everything in your FE code have dependencies and it is not easy cos generator must generate also imports. Our is doing that
  3. Java generics mapping to TS generics
  4. As we are Spring REST native we have support for spring Data in Rest services
  5. we wanted to have generated code which calls REST services to have "native" look and feel for selected FE framework so we have two different implementation generators, one for angular and second for projects based on promises like ReactJs/AngularJs. Third could be yours because code generator are also based on interfaces and you can inject your implementation in the configuration but implementation generators are the hardest part :)

This was situation four years ago if you have larger project probably it would be the best to evaluate all options but I hope that I helped You with the decisions

regards Tomek

raDiesle commented 3 years ago

Thank you! Helps a lot