From 3b37584c1f4820ca49f74537c0e3ff82b0ce3efd Mon Sep 17 00:00:00 2001 From: cbornet Date: Fri, 3 Jun 2016 15:37:06 +0200 Subject: [PATCH] update README --- .../resources/JavaSpringBoot/README.mustache | 31 +++++++++++++++-- .../client/petstore/spring-stubs/README.md | 33 ++++++++++++------- samples/server/petstore/springboot/README.md | 2 +- 3 files changed, 51 insertions(+), 15 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/README.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/README.mustache index 8f9855eedf9..02d932b8aca 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/README.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/README.mustache @@ -1,4 +1,4 @@ -# Swagger generated server +{{^interfaceOnly}}# Swagger generated server Spring Boot Server @@ -15,4 +15,31 @@ Start your server as an simple java application You can view the api documentation in swagger-ui by pointing to http://localhost:8080/ -Change default port value in application.properties \ No newline at end of file +Change default port value in application.properties{{/interfaceOnly}}{{#interfaceOnly}} +# Swagger generated API stub + +Spring Framework stub + + +## Overview +This code was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. +By using the [OpenAPI-Spec](https://github.com/swagger-api/swagger-core), 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}} \ No newline at end of file diff --git a/samples/client/petstore/spring-stubs/README.md b/samples/client/petstore/spring-stubs/README.md index 8f9855eedf9..99663f64082 100644 --- a/samples/client/petstore/spring-stubs/README.md +++ b/samples/client/petstore/spring-stubs/README.md @@ -1,18 +1,27 @@ -# Swagger generated server -Spring Boot Server +# Swagger generated API stub + +Spring Framework stub -## Overview -This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. -By using the [OpenAPI-Spec](https://github.com/swagger-api/swagger-core), you can easily generate a server stub. -This is an example of building a swagger-enabled server in Java using the SpringBoot framework. +## Overview +This code was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. +By using the [OpenAPI-Spec](https://github.com/swagger-api/swagger-core), you can easily generate an API stub. +This is an example of building API stub interfaces in Java using the Spring framework. -The underlying library integrating swagger to SpringBoot is [springfox](https://github.com/springfox/springfox) +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 +} +``` -Start your server as an simple java application +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 { -You can view the api documentation in swagger-ui by pointing to -http://localhost:8080/ - -Change default port value in application.properties \ No newline at end of file +} +``` diff --git a/samples/server/petstore/springboot/README.md b/samples/server/petstore/springboot/README.md index 8f9855eedf9..a2e8a9f7b84 100644 --- a/samples/server/petstore/springboot/README.md +++ b/samples/server/petstore/springboot/README.md @@ -15,4 +15,4 @@ Start your server as an simple java application You can view the api documentation in swagger-ui by pointing to http://localhost:8080/ -Change default port value in application.properties \ No newline at end of file +Change default port value in application.properties \ No newline at end of file