forked from vojtechhabarta/typescript-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Spring support, refactoring (vojtechhabarta#253)
- `typescript-generator-spring` module - configuration parameters: - generateSpringApplicationInterface - generateSpringApplicationClient - scanSpringApplication - restNamespacing (deprecating jaxrsNamespacing) - restNamespacingAnnotation (deprecating jaxrsNamespacingAnnotation) - changed how parsers are instantiated and theirs `TypeProcessor`s are combined - renamed several `Jaxrs*` classes to `Rest*` - deleted `cz.habarta.typescript.generator.util.Predicate` class - `sample-maven-spring`, `sample-gradle-spring` example modules
- Loading branch information
1 parent
63ee545
commit afeeab1
Showing
39 changed files
with
1,424 additions
and
341 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
|
||
apply plugin: 'java' | ||
apply plugin: 'cz.habarta.typescript-generator' | ||
|
||
version = '2.0' | ||
sourceCompatibility = 1.8 | ||
targetCompatibility = 1.8 | ||
|
||
repositories { | ||
jcenter() | ||
} | ||
|
||
dependencies { | ||
compile 'org.springframework.boot:spring-boot-starter-web:2.1.1.RELEASE' | ||
} | ||
|
||
buildscript { | ||
repositories { | ||
mavenLocal() | ||
jcenter() | ||
} | ||
|
||
dependencies { | ||
classpath 'cz.habarta.typescript-generator:typescript-generator-gradle-plugin:2.12-SNAPSHOT' | ||
classpath 'cz.habarta.typescript-generator:typescript-generator-spring:2.12-SNAPSHOT' | ||
} | ||
} | ||
|
||
generateTypeScript { | ||
classes = [ | ||
'cz.habarta.typescript.generator.sample.spring.SpringTestApplication' | ||
] | ||
outputFileType = 'implementationFile' | ||
jsonLibrary = 'jackson2' | ||
outputKind = 'module' | ||
scanSpringApplication = true | ||
generateSpringApplicationClient = true | ||
} | ||
|
||
build.dependsOn generateTypeScript |
51 changes: 51 additions & 0 deletions
51
...ng/src/main/java/cz/habarta/typescript/generator/sample/spring/SpringTestApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
|
||
package cz.habarta.typescript.generator.sample.spring; | ||
|
||
import java.util.concurrent.atomic.AtomicLong; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
|
||
@SpringBootApplication | ||
public class SpringTestApplication { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(SpringTestApplication.class, args); | ||
} | ||
|
||
@RestController | ||
public static class GreetingController { | ||
|
||
private static final String template = "Hello, %s!"; | ||
private final AtomicLong counter = new AtomicLong(); | ||
|
||
@RequestMapping("/greeting") | ||
public Greeting greeting(@RequestParam(value="name", defaultValue="World") String name) { | ||
return new Greeting(counter.incrementAndGet(), String.format(template, name)); | ||
} | ||
|
||
} | ||
|
||
public static class Greeting { | ||
|
||
private final long id; | ||
private final String content; | ||
|
||
public Greeting(long id, String content) { | ||
this.id = id; | ||
this.content = content; | ||
} | ||
|
||
public long getId() { | ||
return id; | ||
} | ||
|
||
public String getContent() { | ||
return content; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>cz.habarta.typescript-generator</groupId> | ||
<artifactId>sample-maven-spring</artifactId> | ||
<version>2.0-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
<name>sample-maven-spring</name> | ||
|
||
<properties> | ||
<typescript-generator.version>2.12-SNAPSHOT</typescript-generator.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
<version>2.1.1.RELEASE</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.7.0</version> | ||
<configuration> | ||
<source>1.8</source> | ||
<target>1.8</target> | ||
<compilerArgs> | ||
<arg>-parameters</arg> | ||
</compilerArgs> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>cz.habarta.typescript-generator</groupId> | ||
<artifactId>typescript-generator-maven-plugin</artifactId> | ||
<version>${typescript-generator.version}</version> | ||
<executions> | ||
<execution> | ||
<id>generate</id> | ||
<goals> | ||
<goal>generate</goal> | ||
</goals> | ||
<phase>process-classes</phase> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<jsonLibrary>jackson2</jsonLibrary> | ||
<outputFileType>implementationFile</outputFileType> | ||
<outputKind>module</outputKind> | ||
<classes> | ||
<class>cz.habarta.typescript.generator.sample.spring.SpringTestApplication</class> | ||
</classes> | ||
<scanSpringApplication>true</scanSpringApplication> | ||
<generateSpringApplicationClient>true</generateSpringApplicationClient> | ||
<extensions> | ||
<extension>cz.habarta.typescript.generator.ext.AxiosClientExtension</extension> | ||
</extensions> | ||
</configuration> | ||
<dependencies> | ||
<dependency> | ||
<groupId>cz.habarta.typescript-generator</groupId> | ||
<artifactId>typescript-generator-spring</artifactId> | ||
<version>${typescript-generator.version}</version> | ||
</dependency> | ||
</dependencies> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
51 changes: 51 additions & 0 deletions
51
...ng/src/main/java/cz/habarta/typescript/generator/sample/spring/SpringTestApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
|
||
package cz.habarta.typescript.generator.sample.spring; | ||
|
||
import java.util.concurrent.atomic.AtomicLong; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
|
||
@SpringBootApplication | ||
public class SpringTestApplication { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(SpringTestApplication.class, args); | ||
} | ||
|
||
@RestController | ||
public static class GreetingController { | ||
|
||
private static final String template = "Hello, %s!"; | ||
private final AtomicLong counter = new AtomicLong(); | ||
|
||
@RequestMapping("/greeting") | ||
public Greeting greeting(@RequestParam(value="name", defaultValue="World") String name) { | ||
return new Greeting(counter.incrementAndGet(), String.format(template, name)); | ||
} | ||
|
||
} | ||
|
||
public static class Greeting { | ||
|
||
private final long id; | ||
private final String content; | ||
|
||
public Greeting(long id, String content) { | ||
this.id = id; | ||
this.content = content; | ||
} | ||
|
||
public long getId() { | ||
return id; | ||
} | ||
|
||
public String getContent() { | ||
return content; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...-generator-core/src/main/java/cz/habarta/typescript/generator/ExcludingTypeProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.