GithubHelp home page GithubHelp logo

leandreck / spring-typescript-services Goto Github PK

View Code? Open in Web Editor NEW
29.0 29.0 16.0 411 KB

Generate typescript services and type interfaces from spring annotated restcontrollers.

License: Apache License 2.0

Java 56.04% FreeMarker 16.59% Groovy 27.38%

spring-typescript-services's People

Contributors

bmustiata avatar dependabot-support avatar jscharett avatar robyed avatar snyk-bot avatar waffle-iron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

spring-typescript-services's Issues

lombok support

It would be nice to get support for lombok so that when defining model, I can just annotate the class as @DaTa and not have to specify all the getters and setters.

manage abstract crud methods

Lets say you have a rest controller that extends an abstract crud controller (for the common crud endpoints) the annotation doesn't detect those

Getting more done in GitHub with ZenHub

Hola! @mkowalzik has created a ZenHub account for the mkowalzik organization. ZenHub is the only project management tool integrated natively in GitHub – created specifically for fast-moving, software-driven teams.


How do I use ZenHub?

To get set up with ZenHub, all you have to do is download the browser extension and log in with your GitHub account. Once you do, you’ll get access to ZenHub’s complete feature-set immediately.

What can ZenHub do?

ZenHub adds a series of enhancements directly inside the GitHub UI:

  • Real-time, customizable task boards for GitHub issues;
  • Multi-Repository burndown charts, estimates, and velocity tracking based on GitHub Milestones;
  • Personal to-do lists and task prioritization;
  • Time-saving shortcuts – like a quick repo switcher, a “Move issue” button, and much more.

Add ZenHub to GitHub

Still curious? See more ZenHub features or read user reviews. This issue was written by your friendly ZenHub bot, posted by request from @mkowalzik.

ZenHub Board

Wrong signature in handleError

According to the rxjs spec for catch, it needs to return an Observable. Trying to consume the generated output is throwing an error

ERROR in C:/Users/.../target/generated-sources/annotations/udrrestcontroller.generated.ts (27,20): Argument of type '(error: Response) => void' is not assignable to parameter of type '(err: any, caught: Observable<UserRule[]>) => ObservableInput<{}>'.

Compilation error with generics

Getting the an error when trying to use Generics in a return type like so:

@Data
@NoArgsConstructor
public class PagedContent<T>{
	private T content;
	private int totalRecords;
}

public PagedContent<ImportList> getImportList(...
[ERROR] Unkown Error occured, please file a Bug https://github.com/leandreck/spring-typescript-services/issues
[ERROR]   java.lang.ClassCastException: com.sun.tools.javac.code.Symbol$TypeVariableSymbol cannot be cast to javax.lang.model.element.TypeElement
[ERROR]         at org.leandreck.endpoints.processor.model.TypeNodeFactory.getDefiningClassElement(TypeNodeFactory.java:187)
[ERROR]         at org.leandreck.endpoints.processor.model.TypeNodeFactory.initType(TypeNodeFactory.java:151)
[ERROR]         at org.leandreck.endpoints.processor.model.TypeNodeFactory.createTypeNode(TypeNodeFactory.java:136)
[ERROR]         at org.leandreck.endpoints.processor.model.TypeNodeFactory.lambda$defineChildren$13(TypeNodeFactory.java:243)
[ERROR]         at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
[ERROR]         at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
[ERROR]         at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
[ERROR]         at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
[ERROR]         at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374)
[ERROR]         at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
[ERROR]         at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
[ERROR]         at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
[ERROR]         at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
[ERROR]         at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
[ERROR]         at org.leandreck.endpoints.processor.model.TypeNodeFactory.defineChildren(TypeNodeFactory.java:244)
[ERROR]         at org.leandreck.endpoints.processor.model.TypeNodeFactory.initType(TypeNodeFactory.java:158)
[ERROR]         at org.leandreck.endpoints.processor.model.TypeNodeFactory.createTypeNode(TypeNodeFactory.java:109)
[ERROR]         at org.leandreck.endpoints.processor.model.MethodNodeFactory.defineReturnType(MethodNodeFactory.java:76)
[ERROR]         at org.leandreck.endpoints.processor.model.MethodNodeFactory.createMethodNode(MethodNodeFactory.java:64)
[ERROR]         at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
[ERROR]         at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374)
[ERROR]         at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
[ERROR]         at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
[ERROR]         at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
[ERROR]         at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
[ERROR]         at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
[ERROR]         at org.leandreck.endpoints.processor.model.EndpointNodeFactory.defineMethods(EndpointNodeFactory.java:61)
[ERROR]         at org.leandreck.endpoints.processor.model.EndpointNodeFactory.createEndpointNode(EndpointNodeFactory.java:52)
[ERROR]         at org.leandreck.endpoints.processor.TypeScriptEndpointProcessor.processEndpoints(TypeScriptEndpointProcessor.java:120)
[ERROR]         at org.leandreck.endpoints.processor.TypeScriptEndpointProcessor.process(TypeScriptEndpointProcessor.java:96)
[ERROR]         at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:794)
[ERROR]         at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:705)
[ERROR]         at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1800(JavacProcessingEnvironment.java:91)
[ERROR]         at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1035)
[ERROR]         at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1176)
[ERROR]         at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1170)
[ERROR]         at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:856)
[ERROR]         at com.sun.tools.javac.main.Main.compile(Main.java:523)
[ERROR]         at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129)
[ERROR]         at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138)
[ERROR]         at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:126)
[ERROR]         at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:174)
[ERROR]         at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:1075)
[ERROR]         at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:168)
[ERROR]         at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
[ERROR]         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
[ERROR]         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
[ERROR]         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
[ERROR]         at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
[ERROR]         at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
[ERROR]         at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
[ERROR]         at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
[ERROR]         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
[ERROR]         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
[ERROR]         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
[ERROR]         at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
[ERROR]         at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
[ERROR]         at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
[ERROR]         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR]         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR]         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR]         at java.lang.reflect.Method.invoke(Method.java:498)
[ERROR]         at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
[ERROR]         at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
[ERROR]         at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
[ERROR]         at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

Allow for TypeScriptEndpoints to be interfaces

The TypeScriptEndpointProcessor process method seems to filter to endpoints of type 'class'. It would be nice to allow for interfaces as well. This would allow for abstracting the api from the actual services. The services project would then implement the various interfaces. This allows for the UI and the Services to nail down a concrete api independent of either project, and then consume.

research how to integrate groovy-classes into javadoc

MethodNodeFactory references two groovy-Classes (RequestMappingFactory and RequestMapping)
this leads to Javadoc Warnings:
[WARNING] ...\annotations\src\main\java\org\leandreck\endpoints\processor\model\MethodNodeFactory.java:38: error: cannot find symbol
[WARNING] private final RequestMappingFactory requestMappingFactory;

remove unnecessary source folders

There are source folders generated by runnning tests and packaged into annotations-source.jar.
This should not happen, so they must be removed after the testrun.

Make method suffixes configurable

When mapping the JAVA api to Typescript, the services.ftl adds a suffix to each public method for the HTTP type. It would be nice to turn this off, as its not wanted in our case. I can work around it in the meantime by using a custom template, but seem like it should be removed or made configurable.

Example of what I'm seeing is public List<Rule> getRules(... results in controller.getRulesGet(.

TypeScript only supports index parameters types string and number

print error while compiling endpoints with illegal declarations
TS1023:An index signature parameter type must be 'string' or 'number'
this is illegal:
private Map mapValue; private Map mapKey;

is generated to:
mapValue: { [index: any]: MapValueType };
mapKey: { [index: MapKeyType]: any };

add a node api module

something like:

import { NgModule } from '@angular/core';

import { } from './';

@NgModule({
imports: [
],
providers: [



],
})
export class APIModule { }

Allow configurable prefix for serviceBaseURL

The serviceBaseURL does not allow for configuring of a "context", so all services are expected to be on the root domain. It would be nice to be able to configure a base path for the service, likely in TypeScript land, as it doesn't really make sense for the services project to know what context its going to run in. Maybe something like the following?

@NgModule({})
export class APIModule { 
    static forRoot(serviceConfig: ServiceConfig = {context: '/'}): ModuleWithProviders {
        return {
            ngModule: APIModule,
            providers: [
                {provide: ServiceConfig, useValue: serviceConfig},
                AController
            ]
        };
    }
}

@Injectable()
export class AController {
    private serviceBaseURL = 'a';
    constructor(private httpClient: HttpClient, private serviceConfig: ServiceConfig) { }

    public getA(): Observable<string> {
        const url = this.serviceConfig.context + this.serviceBaseUrl + '/A';
        ...
    }
}

This is just a quick example, but would be nice to be able to set the context in some fashion.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.