forked from OpenAPITools/openapi-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] Pageable & ApiIgnore imports depend on config
- Loading branch information
Showing
75 changed files
with
8,881 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
generatorName: spring | ||
outputDir: samples/server/petstore/springboot-no-pagination | ||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml | ||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring | ||
additionalProperties: | ||
artifactId: springboot-no-pagination | ||
hideGenerationTimestamp: "true" | ||
usePagination: "false" |
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
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
23 changes: 23 additions & 0 deletions
23
samples/server/petstore/springboot-no-pagination/.openapi-generator-ignore
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,23 @@ | ||
# OpenAPI Generator Ignore | ||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator | ||
|
||
# Use this file to prevent files from being overwritten by the generator. | ||
# The patterns follow closely to .gitignore or .dockerignore. | ||
|
||
# As an example, the C# client generator defines ApiClient.cs. | ||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: | ||
#ApiClient.cs | ||
|
||
# You can match any string of characters against a directory, file or extension with a single asterisk (*): | ||
#foo/*/qux | ||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux | ||
|
||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**): | ||
#foo/**/qux | ||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux | ||
|
||
# You can also negate patterns with an exclamation (!). | ||
# For example, you can ignore all files in a docs folder with the file extension .md: | ||
#docs/*.md | ||
# Then explicitly reverse the ignore rule for a single file: | ||
#!docs/README.md |
66 changes: 66 additions & 0 deletions
66
samples/server/petstore/springboot-no-pagination/.openapi-generator/FILES
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,66 @@ | ||
README.md | ||
pom.xml | ||
src/main/java/org/openapitools/OpenAPI2SpringBoot.java | ||
src/main/java/org/openapitools/RFC3339DateFormat.java | ||
src/main/java/org/openapitools/api/AnotherFakeApi.java | ||
src/main/java/org/openapitools/api/AnotherFakeApiController.java | ||
src/main/java/org/openapitools/api/ApiUtil.java | ||
src/main/java/org/openapitools/api/FakeApi.java | ||
src/main/java/org/openapitools/api/FakeApiController.java | ||
src/main/java/org/openapitools/api/FakeClassnameTestApi.java | ||
src/main/java/org/openapitools/api/FakeClassnameTestApiController.java | ||
src/main/java/org/openapitools/api/PetApi.java | ||
src/main/java/org/openapitools/api/PetApiController.java | ||
src/main/java/org/openapitools/api/StoreApi.java | ||
src/main/java/org/openapitools/api/StoreApiController.java | ||
src/main/java/org/openapitools/api/UserApi.java | ||
src/main/java/org/openapitools/api/UserApiController.java | ||
src/main/java/org/openapitools/configuration/HomeController.java | ||
src/main/java/org/openapitools/configuration/OpenAPIDocumentationConfig.java | ||
src/main/java/org/openapitools/model/AdditionalPropertiesAnyType.java | ||
src/main/java/org/openapitools/model/AdditionalPropertiesArray.java | ||
src/main/java/org/openapitools/model/AdditionalPropertiesBoolean.java | ||
src/main/java/org/openapitools/model/AdditionalPropertiesClass.java | ||
src/main/java/org/openapitools/model/AdditionalPropertiesInteger.java | ||
src/main/java/org/openapitools/model/AdditionalPropertiesNumber.java | ||
src/main/java/org/openapitools/model/AdditionalPropertiesObject.java | ||
src/main/java/org/openapitools/model/AdditionalPropertiesString.java | ||
src/main/java/org/openapitools/model/Animal.java | ||
src/main/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java | ||
src/main/java/org/openapitools/model/ArrayOfNumberOnly.java | ||
src/main/java/org/openapitools/model/ArrayTest.java | ||
src/main/java/org/openapitools/model/BigCat.java | ||
src/main/java/org/openapitools/model/BigCatAllOf.java | ||
src/main/java/org/openapitools/model/Capitalization.java | ||
src/main/java/org/openapitools/model/Cat.java | ||
src/main/java/org/openapitools/model/CatAllOf.java | ||
src/main/java/org/openapitools/model/Category.java | ||
src/main/java/org/openapitools/model/ClassModel.java | ||
src/main/java/org/openapitools/model/Client.java | ||
src/main/java/org/openapitools/model/Dog.java | ||
src/main/java/org/openapitools/model/DogAllOf.java | ||
src/main/java/org/openapitools/model/EnumArrays.java | ||
src/main/java/org/openapitools/model/EnumClass.java | ||
src/main/java/org/openapitools/model/EnumTest.java | ||
src/main/java/org/openapitools/model/FileSchemaTestClass.java | ||
src/main/java/org/openapitools/model/FormatTest.java | ||
src/main/java/org/openapitools/model/HasOnlyReadOnly.java | ||
src/main/java/org/openapitools/model/MapTest.java | ||
src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java | ||
src/main/java/org/openapitools/model/Model200Response.java | ||
src/main/java/org/openapitools/model/ModelApiResponse.java | ||
src/main/java/org/openapitools/model/ModelReturn.java | ||
src/main/java/org/openapitools/model/Name.java | ||
src/main/java/org/openapitools/model/NumberOnly.java | ||
src/main/java/org/openapitools/model/Order.java | ||
src/main/java/org/openapitools/model/OuterComposite.java | ||
src/main/java/org/openapitools/model/OuterEnum.java | ||
src/main/java/org/openapitools/model/Pet.java | ||
src/main/java/org/openapitools/model/ReadOnlyFirst.java | ||
src/main/java/org/openapitools/model/SpecialModelName.java | ||
src/main/java/org/openapitools/model/Tag.java | ||
src/main/java/org/openapitools/model/TypeHolderDefault.java | ||
src/main/java/org/openapitools/model/TypeHolderExample.java | ||
src/main/java/org/openapitools/model/User.java | ||
src/main/java/org/openapitools/model/XmlItem.java | ||
src/main/resources/application.properties |
1 change: 1 addition & 0 deletions
1
samples/server/petstore/springboot-no-pagination/.openapi-generator/VERSION
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 @@ | ||
5.1.0-SNAPSHOT |
18 changes: 18 additions & 0 deletions
18
samples/server/petstore/springboot-no-pagination/README.md
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,18 @@ | ||
# OpenAPI generated server | ||
|
||
Spring Boot Server | ||
|
||
|
||
## Overview | ||
This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. | ||
By using the [OpenAPI-Spec](https://openapis.org), you can easily generate a server stub. | ||
This is an example of building a OpenAPI-enabled server in Java using the SpringBoot framework. | ||
|
||
The underlying library integrating OpenAPI to SpringBoot is [springfox](https://github.com/springfox/springfox) | ||
|
||
Start your server as a simple java application | ||
|
||
You can view the api documentation in swagger-ui by pointing to | ||
http://localhost:80/ | ||
|
||
Change default port value in application.properties |
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,79 @@ | ||
<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>org.openapitools</groupId> | ||
<artifactId>springboot-no-pagination</artifactId> | ||
<packaging>jar</packaging> | ||
<name>springboot-no-pagination</name> | ||
<version>1.0.0</version> | ||
<properties> | ||
<java.version>1.8</java.version> | ||
<maven.compiler.source>${java.version}</maven.compiler.source> | ||
<maven.compiler.target>${java.version}</maven.compiler.target> | ||
<springfox-version>2.9.2</springfox-version> | ||
</properties> | ||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>2.3.3.RELEASE</version> | ||
</parent> | ||
<build> | ||
<sourceDirectory>src/main/java</sourceDirectory> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>repackage</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.data</groupId> | ||
<artifactId>spring-data-commons</artifactId> | ||
</dependency> | ||
<!--SpringFox dependencies --> | ||
<dependency> | ||
<groupId>io.springfox</groupId> | ||
<artifactId>springfox-swagger2</artifactId> | ||
<version>${springfox-version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.springfox</groupId> | ||
<artifactId>springfox-swagger-ui</artifactId> | ||
<version>${springfox-version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>javax.xml.bind</groupId> | ||
<artifactId>jaxb-api</artifactId> | ||
<version>2.3.1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.datatype</groupId> | ||
<artifactId>jackson-datatype-jsr310</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.openapitools</groupId> | ||
<artifactId>jackson-databind-nullable</artifactId> | ||
<version>0.2.1</version> | ||
</dependency> | ||
<!-- Bean Validation API support --> | ||
<dependency> | ||
<groupId>javax.validation</groupId> | ||
<artifactId>validation-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-databind</artifactId> | ||
</dependency> | ||
</dependencies> | ||
</project> |
57 changes: 57 additions & 0 deletions
57
.../petstore/springboot-no-pagination/src/main/java/org/openapitools/OpenAPI2SpringBoot.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,57 @@ | ||
package org.openapitools; | ||
|
||
import com.fasterxml.jackson.databind.Module; | ||
import org.openapitools.jackson.nullable.JsonNullableModule; | ||
import org.springframework.boot.CommandLineRunner; | ||
import org.springframework.boot.ExitCodeGenerator; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.ComponentScan; | ||
import org.springframework.web.servlet.config.annotation.CorsRegistry; | ||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | ||
|
||
@SpringBootApplication | ||
@ComponentScan(basePackages = {"org.openapitools", "org.openapitools.api" , "org.openapitools.configuration"}) | ||
public class OpenAPI2SpringBoot implements CommandLineRunner { | ||
|
||
@Override | ||
public void run(String... arg0) throws Exception { | ||
if (arg0.length > 0 && arg0[0].equals("exitcode")) { | ||
throw new ExitException(); | ||
} | ||
} | ||
|
||
public static void main(String[] args) throws Exception { | ||
new SpringApplication(OpenAPI2SpringBoot.class).run(args); | ||
} | ||
|
||
static class ExitException extends RuntimeException implements ExitCodeGenerator { | ||
private static final long serialVersionUID = 1L; | ||
|
||
@Override | ||
public int getExitCode() { | ||
return 10; | ||
} | ||
|
||
} | ||
|
||
@Bean | ||
public WebMvcConfigurer webConfigurer() { | ||
return new WebMvcConfigurer() { | ||
/*@Override | ||
public void addCorsMappings(CorsRegistry registry) { | ||
registry.addMapping("/**") | ||
.allowedOrigins("*") | ||
.allowedMethods("*") | ||
.allowedHeaders("Content-Type"); | ||
}*/ | ||
}; | ||
} | ||
|
||
@Bean | ||
public Module jsonNullableModule() { | ||
return new JsonNullableModule(); | ||
} | ||
|
||
} |
Oops, something went wrong.