Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package {{package}};
import org.springframework.cloud.netflix.feign.FeignClient;
import {{configPackage}}.ClientConfiguration;

@FeignClient(name="${ {{{title}}}.name:{{{title}}}}", url="${ {{{title}}}.url:{{{basePath}}}}", configuration = ClientConfiguration.class)
{{=<% %>=}}
@FeignClient(name="${<%title%>.name:<%title%>}", url="${<%title%>.url:<%basePath%>}", configuration = ClientConfiguration.class)
<%={{ }}=%>
public interface {{classname}}Client extends {{classname}} {
}
9 changes: 9 additions & 0 deletions samples/client/petstore/spring-cloud/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# swagger-petstore-spring-cloud

Spring cloud (Feign) client can be generated using the below command :
```shell
swagger-codegen-cli generate \
-l spring \
-i http://petstore.swagger.io/v2/swagger.json \
-DhideGenerationTimestamp=true
```
example is [here](https://github.com/swagger-api/swagger-codegen/blob/master/bin/spring-cloud-feign-petstore.sh)

## Requirements

Building the API client library requires [Maven](https://maven.apache.org/) to be installed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
import org.springframework.cloud.netflix.feign.FeignClient;
import io.swagger.configuration.ClientConfiguration;

@FeignClient(name="${ swaggerPetstore.name:swaggerPetstore}", url="${ swaggerPetstore.url:http://petstore.swagger.io/v2}", configuration = ClientConfiguration.class)
@FeignClient(name="${swaggerPetstore.name:swaggerPetstore}", url="${swaggerPetstore.url:http://petstore.swagger.io/v2}", configuration = ClientConfiguration.class)
public interface PetApiClient extends PetApi {
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
import org.springframework.cloud.netflix.feign.FeignClient;
import io.swagger.configuration.ClientConfiguration;

@FeignClient(name="${ swaggerPetstore.name:swaggerPetstore}", url="${ swaggerPetstore.url:http://petstore.swagger.io/v2}", configuration = ClientConfiguration.class)
@FeignClient(name="${swaggerPetstore.name:swaggerPetstore}", url="${swaggerPetstore.url:http://petstore.swagger.io/v2}", configuration = ClientConfiguration.class)
public interface StoreApiClient extends StoreApi {
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
import org.springframework.cloud.netflix.feign.FeignClient;
import io.swagger.configuration.ClientConfiguration;

@FeignClient(name="${ swaggerPetstore.name:swaggerPetstore}", url="${ swaggerPetstore.url:http://petstore.swagger.io/v2}", configuration = ClientConfiguration.class)
@FeignClient(name="${swaggerPetstore.name:swaggerPetstore}", url="${swaggerPetstore.url:http://petstore.swagger.io/v2}", configuration = ClientConfiguration.class)
public interface UserApiClient extends UserApi {
}
11 changes: 10 additions & 1 deletion samples/client/petstore/spring-stubs/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@

# Swagger generated API stub

Spring stub can be generated using the below command :
```shell
swagger-codegen-cli generate \
-l spring \
-i http://petstore.swagger.io/v2/swagger.json \
-DinterfaceOnly=true,singleContentTypes=true,hideGenerationTimestamp=true
```
example is [here](https://github.com/swagger-api/swagger-codegen/blob/master/bin/spring-stubs.sh)


Spring Framework stub


Expand Down