-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Kotlin-Spring] add Kotlin based Spring-cloud openfeign generator
- Loading branch information
Showing
34 changed files
with
1,902 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
generatorName: kotlin-spring | ||
outputDir: samples/client/petstore/kotlin-spring-cloud | ||
library: spring-cloud | ||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml | ||
templateDir: modules/openapi-generator/src/main/resources/kotlin-spring | ||
additionalProperties: | ||
documentationProvider: none | ||
annotationLibrary: none | ||
useSwaggerUI: "false" | ||
serializableModel: "true" | ||
beanValidations: "true" | ||
interfaceOnly: "true" |
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
83 changes: 83 additions & 0 deletions
83
...openapi-generator/src/main/resources/kotlin-spring/libraries/spring-cloud/README.mustache
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,83 @@ | ||
{{^interfaceOnly}} | ||
# {{artifactId}} | ||
|
||
## Requirements | ||
|
||
Building the API client library requires [Maven](https://maven.apache.org/) to be installed. | ||
|
||
## Installation | ||
|
||
To install the API client library to your local Maven repository, simply execute: | ||
|
||
```shell | ||
mvn install | ||
``` | ||
|
||
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: | ||
|
||
```shell | ||
mvn deploy | ||
``` | ||
|
||
Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information. | ||
|
||
### Maven users | ||
|
||
Add this dependency to your project's POM: | ||
|
||
```xml | ||
<dependency> | ||
<groupId>{{{groupId}}}</groupId> | ||
<artifactId>{{{artifactId}}}</artifactId> | ||
<version>{{{artifactVersion}}}</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
``` | ||
|
||
### Gradle users | ||
|
||
Add this dependency to your project's build file: | ||
|
||
```groovy | ||
compile "{{{groupId}}}:{{{artifactId}}}:{{{artifactVersion}}}" | ||
``` | ||
|
||
### Others | ||
|
||
At first generate the JAR by executing: | ||
|
||
mvn package | ||
|
||
Then manually install the following JARs: | ||
|
||
* target/{{{artifactId}}}-{{{artifactVersion}}}.jar | ||
* target/lib/*.jar | ||
{{/interfaceOnly}} | ||
{{#interfaceOnly}} | ||
# OpenAPI generated API stub | ||
|
||
Spring Framework stub | ||
|
||
|
||
## Overview | ||
This code was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. | ||
By using the [OpenAPI-Spec](https://openapis.org), you can easily generate an API stub. | ||
This is an example of building API stub interfaces in Java using the Spring framework. | ||
|
||
The stubs generated can be used in your existing Spring-MVC or Spring-Boot application to create controller endpoints | ||
by adding ```@Controller``` classes that implement the interface. Eg: | ||
```java | ||
@Controller | ||
public class PetController implements PetApi { | ||
// implement all PetApi methods | ||
} | ||
``` | ||
|
||
You can also use the interface to create [Spring-Cloud Feign clients](http://projects.spring.io/spring-cloud/spring-cloud.html#spring-cloud-feign-inheritance).Eg: | ||
```java | ||
@FeignClient(name="pet", url="http://petstore.swagger.io/v2") | ||
public interface PetClient extends PetApi { | ||
} | ||
``` | ||
{{/interfaceOnly}} |
Oops, something went wrong.