Merge remote-tracking branch 'origin' into 7.0.x

This commit is contained in:
William Cheng
2023-03-03 21:52:50 +08:00
10595 changed files with 418520 additions and 73194 deletions

View File

@@ -11,7 +11,7 @@
<maven.compiler.target>${java.version}</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<springfox.version>2.9.2</springfox.version>
<swagger-ui.version>4.10.3</swagger-ui.version>
<swagger-ui.version>4.15.5</swagger-ui.version>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>

View File

@@ -4,9 +4,16 @@ 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.context.annotation.FilterType;
import org.springframework.context.annotation.FullyQualifiedAnnotationBeanNameGenerator;
@SpringBootApplication
@ComponentScan(basePackages = {"org.openapitools", "org.openapitools.api" , "org.openapitools.configuration"})
@SpringBootApplication(
nameGenerator = FullyQualifiedAnnotationBeanNameGenerator.class
)
@ComponentScan(
basePackages = {"org.openapitools", "org.openapitools.api" , "org.openapitools.configuration"},
nameGenerator = FullyQualifiedAnnotationBeanNameGenerator.class
)
public class OpenApiGeneratorApplication {
public static void main(String[] args) {

View File

@@ -24,7 +24,7 @@ import javax.annotation.Generated;
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated
@Api(value = "another-fake", description = "the another-fake API")
@Api(value = "$another-fake?", description = "the $another-fake? API")
public interface AnotherFakeApi {
default Optional<NativeWebRequest> getRequest() {

View File

@@ -395,7 +395,7 @@ public interface FakeApi {
@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue = "-efg") String enumQueryString,
@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @Valid @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,
@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1.1, -1.2") @Valid @RequestParam(value = "enum_query_double", required = false) Double enumQueryDouble,
@ApiParam(value = "Form parameter enum test (string array)", allowableValues = ">, $", defaultValue = "$") @Valid @RequestParam(value = "enum_form_string_array", required = false) List<String> enumFormStringArray,
@ApiParam(value = "Form parameter enum test (string array)", allowableValues = ">, $", defaultValue = "$") @Valid @RequestPart(value = "enum_form_string_array", required = false) List<String> enumFormStringArray,
@ApiParam(value = "Form parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_form_string", required = false) String enumFormString
) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
@@ -413,7 +413,7 @@ public interface FakeApi {
* @param stringGroup String in group parameters (optional)
* @param booleanGroup Boolean in group parameters (optional)
* @param int64Group Integer in group parameters (optional)
* @return Someting wrong (status code 400)
* @return Something wrong (status code 400)
*/
@ApiOperation(
tags = { "fake" },
@@ -422,7 +422,7 @@ public interface FakeApi {
notes = "Fake endpoint to test group parameters (optional)"
)
@ApiResponses({
@ApiResponse(code = 400, message = "Someting wrong")
@ApiResponse(code = 400, message = "Something wrong")
})
@RequestMapping(
method = RequestMethod.DELETE,

View File

@@ -24,7 +24,7 @@ import javax.annotation.Generated;
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated
@Api(value = "fake_classname_test", description = "the fake_classname_test API")
@Api(value = "fake_classname_tags 123#$%^", description = "the fake_classname_tags 123#$%^ API")
public interface FakeClassnameTestApi {
default Optional<NativeWebRequest> getRequest() {

View File

@@ -143,12 +143,12 @@ public interface PetApi {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" }";
String exampleString = "[ { \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" }, { \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" } ]";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
String exampleString = "<Pet> <id>123456789</id> <name>doggie</name> <photoUrls> <photoUrls>aeiou</photoUrls> </photoUrls> <tags> </tags> <status>aeiou</status> </Pet>";
String exampleString = "<Pet> <id>123456789</id> <Category> <id>123456789</id> <name>aeiou</name> </Category> <name>doggie</name> <photoUrls> <photoUrls>aeiou</photoUrls> </photoUrls> <tags> <Tag> <id>123456789</id> <name>aeiou</name> </Tag> </tags> <status>aeiou</status> </Pet>";
ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
@@ -198,12 +198,12 @@ public interface PetApi {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
String exampleString = "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" }";
String exampleString = "[ { \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" }, { \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" } ]";
ApiUtil.setExampleResponse(request, "application/json", exampleString);
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
String exampleString = "<Pet> <id>123456789</id> <name>doggie</name> <photoUrls> <photoUrls>aeiou</photoUrls> </photoUrls> <tags> </tags> <status>aeiou</status> </Pet>";
String exampleString = "<Pet> <id>123456789</id> <Category> <id>123456789</id> <name>aeiou</name> </Category> <name>doggie</name> <photoUrls> <photoUrls>aeiou</photoUrls> </photoUrls> <tags> <Tag> <id>123456789</id> <name>aeiou</name> </Tag> </tags> <status>aeiou</status> </Pet>";
ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}
@@ -254,7 +254,7 @@ public interface PetApi {
break;
}
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
String exampleString = "<Pet> <id>123456789</id> <name>doggie</name> <photoUrls> <photoUrls>aeiou</photoUrls> </photoUrls> <tags> </tags> <status>aeiou</status> </Pet>";
String exampleString = "<Pet> <id>123456789</id> <Category> <id>123456789</id> <name>aeiou</name> </Category> <name>doggie</name> <photoUrls> <photoUrls>aeiou</photoUrls> </photoUrls> <tags> <Tag> <id>123456789</id> <name>aeiou</name> </Tag> </tags> <status>aeiou</status> </Pet>";
ApiUtil.setExampleResponse(request, "application/xml", exampleString);
break;
}

View File

@@ -97,7 +97,7 @@ public interface StoreApi {
/**
* GET /store/order/{order_id} : Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generate exceptions
*
* @param orderId ID of pet that needs to be fetched (required)
* @return successful operation (status code 200)
@@ -108,7 +108,7 @@ public interface StoreApi {
tags = { "store" },
value = "Find purchase order by ID",
nickname = "getOrderById",
notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions",
notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions",
response = Order.class
)
@ApiResponses({

View File

@@ -10,7 +10,7 @@ import org.springframework.core.convert.converter.Converter;
@Configuration
public class EnumConverterConfiguration {
@Bean
@Bean(name = "org.openapitools.configuration.EnumConverterConfiguration.enumClassConverter")
Converter<String, EnumClass> enumClassConverter() {
return new Converter<String, EnumClass>() {
@Override
@@ -19,7 +19,7 @@ public class EnumConverterConfiguration {
}
};
}
@Bean
@Bean(name = "org.openapitools.configuration.EnumConverterConfiguration.outerEnumConverter")
Converter<String, OuterEnum> outerEnumConverter() {
return new Converter<String, OuterEnum>() {
@Override

View File

@@ -44,6 +44,22 @@ public class Animal {
@JsonProperty("color")
private String color = "red";
/**
* Default constructor
* @deprecated Use {@link Animal#Animal(String)}
*/
@Deprecated
public Animal() {
super();
}
/**
* Constructor with only required parameters
*/
public Animal(String className) {
this.className = className;
}
public Animal className(String className) {
this.className = className;
return this;

View File

@@ -95,7 +95,7 @@ public class ArrayTest {
return this;
}
public ArrayTest addArrayArrayOfModelItem(List<ReadOnlyFirst> arrayArrayOfModelItem) {
public ArrayTest addArrayArrayOfModelItem(List<@Valid ReadOnlyFirst> arrayArrayOfModelItem) {
if (this.arrayArrayOfModel == null) {
this.arrayArrayOfModel = new ArrayList<>();
}

View File

@@ -69,6 +69,22 @@ public class BigCat extends Cat {
@JsonProperty("kind")
private KindEnum kind;
/**
* Default constructor
* @deprecated Use {@link BigCat#BigCat(String)}
*/
@Deprecated
public BigCat() {
super();
}
/**
* Constructor with only required parameters
*/
public BigCat(String className) {
super(className);
}
public BigCat kind(KindEnum kind) {
this.kind = kind;
return this;

View File

@@ -38,6 +38,22 @@ public class Cat extends Animal {
@JsonProperty("declawed")
private Boolean declawed;
/**
* Default constructor
* @deprecated Use {@link Cat#Cat(String)}
*/
@Deprecated
public Cat() {
super();
}
/**
* Constructor with only required parameters
*/
public Cat(String className) {
super(className);
}
public Cat declawed(Boolean declawed) {
this.declawed = declawed;
return this;

View File

@@ -27,6 +27,22 @@ public class Category {
@JsonProperty("name")
private String name = "default-name";
/**
* Default constructor
* @deprecated Use {@link Category#Category(String)}
*/
@Deprecated
public Category() {
super();
}
/**
* Constructor with only required parameters
*/
public Category(String name) {
this.name = name;
}
public Category id(Long id) {
this.id = id;
return this;

View File

@@ -29,6 +29,22 @@ public class Dog extends Animal {
@JsonProperty("breed")
private String breed;
/**
* Default constructor
* @deprecated Use {@link Dog#Dog(String)}
*/
@Deprecated
public Dog() {
super();
}
/**
* Constructor with only required parameters
*/
public Dog(String className) {
super(className);
}
public Dog breed(String breed) {
this.breed = breed;
return this;

View File

@@ -184,6 +184,22 @@ public class EnumTest {
@JsonProperty("outerEnum")
private OuterEnum outerEnum;
/**
* Default constructor
* @deprecated Use {@link EnumTest#EnumTest(EnumStringRequiredEnum)}
*/
@Deprecated
public EnumTest() {
super();
}
/**
* Constructor with only required parameters
*/
public EnumTest(EnumStringRequiredEnum enumStringRequired) {
this.enumStringRequired = enumStringRequired;
}
public EnumTest enumString(EnumStringEnum enumString) {
this.enumString = enumString;
return this;

View File

@@ -29,7 +29,7 @@ public class FileSchemaTestClass {
@JsonProperty("files")
@Valid
private List<File> files = null;
private List<@Valid File> files = null;
public FileSchemaTestClass file(File file) {
this.file = file;
@@ -50,7 +50,7 @@ public class FileSchemaTestClass {
this.file = file;
}
public FileSchemaTestClass files(List<File> files) {
public FileSchemaTestClass files(List<@Valid File> files) {
this.files = files;
return this;
}
@@ -69,11 +69,11 @@ public class FileSchemaTestClass {
*/
@Valid
@ApiModelProperty(value = "")
public List<File> getFiles() {
public List<@Valid File> getFiles() {
return files;
}
public void setFiles(List<File> files) {
public void setFiles(List<@Valid File> files) {
this.files = files;
}

View File

@@ -73,6 +73,25 @@ public class FormatTest {
@JsonProperty("BigDecimal")
private BigDecimal bigDecimal;
/**
* Default constructor
* @deprecated Use {@link FormatTest#FormatTest(BigDecimal, byte[], LocalDate, String)}
*/
@Deprecated
public FormatTest() {
super();
}
/**
* Constructor with only required parameters
*/
public FormatTest(BigDecimal number, byte[] _byte, LocalDate date, String password) {
this.number = number;
this._byte = _byte;
this.date = date;
this.password = password;
}
public FormatTest integer(Integer integer) {
this.integer = integer;
return this;

View File

@@ -34,6 +34,22 @@ public class Name {
@JsonProperty("123Number")
private Integer _123number;
/**
* Default constructor
* @deprecated Use {@link Name#Name(Integer)}
*/
@Deprecated
public Name() {
super();
}
/**
* Constructor with only required parameters
*/
public Name(Integer name) {
this.name = name;
}
public Name name(Integer name) {
this.name = name;
return this;

View File

@@ -44,7 +44,7 @@ public class Pet {
@JsonProperty("tags")
@Valid
private List<Tag> tags = null;
private List<@Valid Tag> tags = null;
/**
* pet status in the store
@@ -86,6 +86,23 @@ public class Pet {
@JsonProperty("status")
private StatusEnum status;
/**
* Default constructor
* @deprecated Use {@link Pet#Pet(String, Set<String>)}
*/
@Deprecated
public Pet() {
super();
}
/**
* Constructor with only required parameters
*/
public Pet(String name, Set<String> photoUrls) {
this.name = name;
this.photoUrls = photoUrls;
}
public Pet id(Long id) {
this.id = id;
return this;
@@ -171,7 +188,7 @@ public class Pet {
this.photoUrls = photoUrls;
}
public Pet tags(List<Tag> tags) {
public Pet tags(List<@Valid Tag> tags) {
this.tags = tags;
return this;
}
@@ -190,11 +207,11 @@ public class Pet {
*/
@Valid
@ApiModelProperty(value = "")
public List<Tag> getTags() {
public List<@Valid Tag> getTags() {
return tags;
}
public void setTags(List<Tag> tags) {
public void setTags(List<@Valid Tag> tags) {
this.tags = tags;
}

View File

@@ -40,6 +40,26 @@ public class TypeHolderDefault {
@Valid
private List<Integer> arrayItem = new ArrayList<>();
/**
* Default constructor
* @deprecated Use {@link TypeHolderDefault#TypeHolderDefault(String, BigDecimal, Integer, Boolean, List<Integer>)}
*/
@Deprecated
public TypeHolderDefault() {
super();
}
/**
* Constructor with only required parameters
*/
public TypeHolderDefault(String stringItem, BigDecimal numberItem, Integer integerItem, Boolean boolItem, List<Integer> arrayItem) {
this.stringItem = stringItem;
this.numberItem = numberItem;
this.integerItem = integerItem;
this.boolItem = boolItem;
this.arrayItem = arrayItem;
}
public TypeHolderDefault stringItem(String stringItem) {
this.stringItem = stringItem;
return this;

View File

@@ -43,6 +43,27 @@ public class TypeHolderExample {
@Valid
private List<Integer> arrayItem = new ArrayList<>();
/**
* Default constructor
* @deprecated Use {@link TypeHolderExample#TypeHolderExample(String, BigDecimal, Float, Integer, Boolean, List<Integer>)}
*/
@Deprecated
public TypeHolderExample() {
super();
}
/**
* Constructor with only required parameters
*/
public TypeHolderExample(String stringItem, BigDecimal numberItem, Float floatItem, Integer integerItem, Boolean boolItem, List<Integer> arrayItem) {
this.stringItem = stringItem;
this.numberItem = numberItem;
this.floatItem = floatItem;
this.integerItem = integerItem;
this.boolItem = boolItem;
this.arrayItem = arrayItem;
}
public TypeHolderExample stringItem(String stringItem) {
this.stringItem = stringItem;
return this;

View File

@@ -392,7 +392,7 @@ paths:
- tag: store
get:
description: For valid response try integer IDs with value <= 5 or > 10. Other
values will generated exceptions
values will generate exceptions
operationId: getOrderById
parameters:
- description: ID of pet that needs to be fetched
@@ -714,7 +714,7 @@ paths:
responses:
"400":
content: {}
description: Someting wrong
description: Something wrong
summary: Fake endpoint to test group parameters (optional)
tags:
- fake