forked from loafle/openapi-generator-original
* Oas3: Remove swagger2 ApiModel and ApiModelProperty from imports when oas3 is true. * Oas3: Use either swagger v2 or v3; add test config * Oas3: allowableValues and defaultValues belong to the Schema annotation * Oas3: use swagger-core.version property in all pom.xml * gh-11165 remove io.swagger.v3.oas.annotations.parameters.RequestBody * gh-11168 add import for io.swagger.v3.oas.annotations.Hidden * Fix formParams.mustache, add dedicated test scripts for the spring generator using oas3. * Run ./bin/generate-samples.sh * Run ./bin/generate-samples.sh - new samples * fix indentation * Revert to threetenbp 2.9.10 because customInstantDeserializer.mustache is not compatible with threetenbp > 2.9.10. * apiController.mustache: pull in osa3 imports. * apiDelegate.mustache: remove io.swagger.annotations.* import * Remove Hidden (import and usage). Wrap atApiIgnore with useSpringfox. * fully qualify org.springframework.data.domain.Pageable because endorExtensions.x-spring-paginated is not set during import processing. * align spring-cloud and spring-boot pom.mustache regarding springfox and oas versions. * introduce dateTimeParam.mustache * Apply DateTimeFormat consistently across different parameter types * revert to springfox 2.9.2 * add newline after parameter * fix atSchema annotation (use empty description) * add more spring-*-oas3 test configs * Update bin/config/spring* test samples * Fix implicitHeader.mustache - add import, generate use paramDoc. * rename spring-boot-implicitHeaders-oal3.yaml to spring-boot-implicitHeaders-oas3.yaml * Add spring oas3 configs to samples.circleci profiles module list * Use groupId 'org.openapitools.openapi3' for oas3 configs * Run all spring test configs. * In OAS3, allowableValues is a String[] array. * formParams.mustache: Align spacing and newlines with other param templates * Support @Parameter(hidden = true) instead of ApiIgnore, Formatting: One parameter per line. * Format method level annotations in api.mustache * Introduce samples.circleci.spring profile * Generate all spring samples
27 lines
912 B
Markdown
27 lines
912 B
Markdown
# 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 {
|
|
|
|
}
|
|
```
|