leandreck / spring-typescript-services Goto Github PK
View Code? Open in Web Editor NEWGenerate typescript services and type interfaces from spring annotated restcontrollers.
License: Apache License 2.0
Generate typescript services and type interfaces from spring annotated restcontrollers.
License: Apache License 2.0
create mock jsons for endpoints
It would seem that requestBody is not a requirement of a POST/PUT. We're running into this issue with respect to doing a file upload. The compiler fails as there is no requestBody.
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.
as of now only @PathVariable is supported
Lets say you have a rest controller that extends an abstract crud controller (for the common crud endpoints) the annotation doesn't detect those
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.
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.
ZenHub adds a series of enhancements directly inside the GitHub UI:
Still curious? See more ZenHub features or read user reviews. This issue was written by your friendly ZenHub bot, posted by request from @mkowalzik.
maybe TypeScriptEndpoint(timeout=200) or TypeScriptTimeout(200)
Not seeing any of the optional QueryString params being passed to my get calls. Can we get support?
it must be possible to configure defaults for all annotationvalues in a centralized config/annotation/whatever
@GetMapping
@PostMapping
...
@RequestMapping without method must generate get Method
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<{}>'.
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)
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.
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;
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.
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(
.
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 };
for enums and index.ts
the httpGet method outputs code using serviceUrl, which should just be url.
something like:
import { NgModule } from '@angular/core';
import { } from './';
@NgModule({
imports: [
],
providers: [
],
})
export class APIModule { }
Angualr 4.3 introduced HttpClient and Angular 5 has deprecated @angular/http
. Can we get support for these?
add support for javax validation annotations and include them as mapped decorators for example
pleerock/class-validator in the model and interface template
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.
Including groovy code in annotations is causing issues in consuming projects, so rewrite the code in java.
.model....
and .generated.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.