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

@@ -10,13 +10,13 @@
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<springdoc.version>1.6.8</springdoc.version>
<swagger-ui.version>4.10.3</swagger-ui.version>
<springdoc.version>1.6.14</springdoc.version>
<swagger-ui.version>4.15.5</swagger-ui.version>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.0</version>
<version>2.7.6</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<build>
@@ -54,7 +54,7 @@
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
<version>0.2.2</version>
<version>0.2.6</version>
</dependency>
<!-- Bean Validation API support -->
<dependency>

View File

@@ -7,14 +7,17 @@ package org.openapitools.api;
import org.openapitools.model.ModelApiResponse;
import org.openapitools.model.Pet;
import io.swagger.v3.oas.annotations.ExternalDocumentation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.media.ArraySchema;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
@@ -85,8 +88,8 @@ public interface PetApi {
value = "/pet/{petId}"
)
ResponseEntity<Void> deletePet(
@Parameter(name = "petId", description = "Pet id to delete", required = true) @PathVariable("petId") Long petId,
@Parameter(name = "api_key", description = "") @RequestHeader(value = "api_key", required = false) String apiKey
@Parameter(name = "petId", description = "Pet id to delete", required = true, in = ParameterIn.PATH) @PathVariable("petId") Long petId,
@Parameter(name = "api_key", description = "", in = ParameterIn.HEADER) @RequestHeader(value = "api_key", required = false) String apiKey
) throws Exception;
@@ -101,11 +104,12 @@ public interface PetApi {
@Operation(
operationId = "findPetsByStatus",
summary = "Finds Pets by status",
description = "Multiple status values can be provided with comma separated strings",
tags = { "pet" },
responses = {
@ApiResponse(responseCode = "200", description = "successful operation", content = {
@Content(mediaType = "application/xml", schema = @Schema(implementation = Pet.class)),
@Content(mediaType = "application/json", schema = @Schema(implementation = Pet.class))
@Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = Pet.class))),
@Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = Pet.class)))
}),
@ApiResponse(responseCode = "400", description = "Invalid status value")
},
@@ -119,7 +123,7 @@ public interface PetApi {
produces = "application/json"
)
ResponseEntity<List<Pet>> findPetsByStatus(
@NotNull @Parameter(name = "status", description = "Status values that need to be considered for filter", required = true) @Valid @RequestParam(value = "status", required = true) List<String> status
@NotNull @Parameter(name = "status", description = "Status values that need to be considered for filter", required = true, in = ParameterIn.QUERY) @Valid @RequestParam(value = "status", required = true) List<String> status
) throws Exception;
@@ -136,11 +140,12 @@ public interface PetApi {
@Operation(
operationId = "findPetsByTags",
summary = "Finds Pets by tags",
description = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.",
tags = { "pet" },
responses = {
@ApiResponse(responseCode = "200", description = "successful operation", content = {
@Content(mediaType = "application/xml", schema = @Schema(implementation = Pet.class)),
@Content(mediaType = "application/json", schema = @Schema(implementation = Pet.class))
@Content(mediaType = "application/xml", array = @ArraySchema(schema = @Schema(implementation = Pet.class))),
@Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = Pet.class)))
}),
@ApiResponse(responseCode = "400", description = "Invalid tag value")
},
@@ -154,7 +159,7 @@ public interface PetApi {
produces = "application/json"
)
ResponseEntity<List<Pet>> findPetsByTags(
@NotNull @Parameter(name = "tags", description = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List<String> tags
@NotNull @Parameter(name = "tags", description = "Tags to filter by", required = true, in = ParameterIn.QUERY) @Valid @RequestParam(value = "tags", required = true) List<String> tags
) throws Exception;
@@ -170,6 +175,7 @@ public interface PetApi {
@Operation(
operationId = "getPetById",
summary = "Find pet by ID",
description = "Returns a single pet",
tags = { "pet" },
responses = {
@ApiResponse(responseCode = "200", description = "successful operation", content = {
@@ -189,7 +195,7 @@ public interface PetApi {
produces = "application/json"
)
ResponseEntity<Pet> getPetById(
@Parameter(name = "petId", description = "ID of pet to return", required = true) @PathVariable("petId") Long petId
@Parameter(name = "petId", description = "ID of pet to return", required = true, in = ParameterIn.PATH) @PathVariable("petId") Long petId
) throws Exception;
@@ -249,7 +255,7 @@ public interface PetApi {
consumes = "application/x-www-form-urlencoded"
)
ResponseEntity<Void> updatePetWithForm(
@Parameter(name = "petId", description = "ID of pet that needs to be updated", required = true) @PathVariable("petId") Long petId,
@Parameter(name = "petId", description = "ID of pet that needs to be updated", required = true, in = ParameterIn.PATH) @PathVariable("petId") Long petId,
@Parameter(name = "name", description = "Updated name of the pet") @Valid @RequestParam(value = "name", required = false) String name,
@Parameter(name = "status", description = "Updated status of the pet") @Valid @RequestParam(value = "status", required = false) String status
) throws Exception;
@@ -283,7 +289,7 @@ public interface PetApi {
consumes = "multipart/form-data"
)
ResponseEntity<ModelApiResponse> uploadFile(
@Parameter(name = "petId", description = "ID of pet to update", required = true) @PathVariable("petId") Long petId,
@Parameter(name = "petId", description = "ID of pet to update", required = true, in = ParameterIn.PATH) @PathVariable("petId") Long petId,
@Parameter(name = "additionalMetadata", description = "Additional data to pass to server") @Valid @RequestParam(value = "additionalMetadata", required = false) String additionalMetadata,
@Parameter(name = "file", description = "file to upload") @RequestPart(value = "file", required = false) MultipartFile file
) throws Exception;

View File

@@ -7,14 +7,17 @@ package org.openapitools.api;
import java.util.Map;
import org.openapitools.model.Order;
import io.swagger.v3.oas.annotations.ExternalDocumentation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.media.ArraySchema;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
@@ -46,6 +49,7 @@ public interface StoreApi {
@Operation(
operationId = "deleteOrder",
summary = "Delete purchase order by ID",
description = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors",
tags = { "store" },
responses = {
@ApiResponse(responseCode = "400", description = "Invalid ID supplied"),
@@ -57,7 +61,7 @@ public interface StoreApi {
value = "/store/order/{orderId}"
)
ResponseEntity<Void> deleteOrder(
@Parameter(name = "orderId", description = "ID of the order that needs to be deleted", required = true) @PathVariable("orderId") String orderId
@Parameter(name = "orderId", description = "ID of the order that needs to be deleted", required = true, in = ParameterIn.PATH) @PathVariable("orderId") String orderId
) throws Exception;
@@ -70,6 +74,7 @@ public interface StoreApi {
@Operation(
operationId = "getInventory",
summary = "Returns pet inventories by status",
description = "Returns a map of status codes to quantities",
tags = { "store" },
responses = {
@ApiResponse(responseCode = "200", description = "successful operation", content = {
@@ -92,7 +97,7 @@ public interface StoreApi {
/**
* GET /store/order/{orderId} : 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)
@@ -102,6 +107,7 @@ public interface StoreApi {
@Operation(
operationId = "getOrderById",
summary = "Find purchase order by ID",
description = "For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions",
tags = { "store" },
responses = {
@ApiResponse(responseCode = "200", description = "successful operation", content = {
@@ -118,7 +124,7 @@ public interface StoreApi {
produces = "application/json"
)
ResponseEntity<Order> getOrderById(
@Min(1L) @Max(5L) @Parameter(name = "orderId", description = "ID of pet that needs to be fetched", required = true) @PathVariable("orderId") Long orderId
@Min(1L) @Max(5L) @Parameter(name = "orderId", description = "ID of pet that needs to be fetched", required = true, in = ParameterIn.PATH) @PathVariable("orderId") Long orderId
) throws Exception;

View File

@@ -8,14 +8,17 @@ package org.openapitools.api;
import java.util.List;
import java.time.OffsetDateTime;
import org.openapitools.model.User;
import io.swagger.v3.oas.annotations.ExternalDocumentation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.media.ArraySchema;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
@@ -46,9 +49,10 @@ public interface UserApi {
@Operation(
operationId = "createUser",
summary = "Create user",
description = "This can only be done by the logged in user.",
tags = { "user" },
responses = {
@ApiResponse(responseCode = "200", description = "successful operation")
@ApiResponse(responseCode = "default", description = "successful operation")
}
)
@RequestMapping(
@@ -71,7 +75,7 @@ public interface UserApi {
summary = "Creates list of users with given input array",
tags = { "user" },
responses = {
@ApiResponse(responseCode = "200", description = "successful operation")
@ApiResponse(responseCode = "default", description = "successful operation")
}
)
@RequestMapping(
@@ -94,7 +98,7 @@ public interface UserApi {
summary = "Creates list of users with given input array",
tags = { "user" },
responses = {
@ApiResponse(responseCode = "200", description = "successful operation")
@ApiResponse(responseCode = "default", description = "successful operation")
}
)
@RequestMapping(
@@ -117,6 +121,7 @@ public interface UserApi {
@Operation(
operationId = "deleteUser",
summary = "Delete user",
description = "This can only be done by the logged in user.",
tags = { "user" },
responses = {
@ApiResponse(responseCode = "400", description = "Invalid username supplied"),
@@ -128,7 +133,7 @@ public interface UserApi {
value = "/user/{username}"
)
ResponseEntity<Void> deleteUser(
@Parameter(name = "username", description = "The name that needs to be deleted", required = true) @PathVariable("username") String username
@Parameter(name = "username", description = "The name that needs to be deleted", required = true, in = ParameterIn.PATH) @PathVariable("username") String username
) throws Exception;
@@ -159,7 +164,7 @@ public interface UserApi {
produces = "application/json"
)
ResponseEntity<User> getUserByName(
@Parameter(name = "username", description = "The name that needs to be fetched. Use user1 for testing.", required = true) @PathVariable("username") String username
@Parameter(name = "username", description = "The name that needs to be fetched. Use user1 for testing.", required = true, in = ParameterIn.PATH) @PathVariable("username") String username
) throws Exception;
@@ -189,8 +194,8 @@ public interface UserApi {
produces = "application/json"
)
ResponseEntity<String> loginUser(
@NotNull @Parameter(name = "username", description = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) String username,
@NotNull @Parameter(name = "password", description = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) String password
@NotNull @Parameter(name = "username", description = "The user name for login", required = true, in = ParameterIn.QUERY) @Valid @RequestParam(value = "username", required = true) String username,
@NotNull @Parameter(name = "password", description = "The password for login in clear text", required = true, in = ParameterIn.QUERY) @Valid @RequestParam(value = "password", required = true) String password
) throws Exception;
@@ -204,7 +209,7 @@ public interface UserApi {
summary = "Logs out current logged in user session",
tags = { "user" },
responses = {
@ApiResponse(responseCode = "200", description = "successful operation")
@ApiResponse(responseCode = "default", description = "successful operation")
}
)
@RequestMapping(
@@ -228,6 +233,7 @@ public interface UserApi {
@Operation(
operationId = "updateUser",
summary = "Updated user",
description = "This can only be done by the logged in user.",
tags = { "user" },
responses = {
@ApiResponse(responseCode = "400", description = "Invalid user supplied"),
@@ -239,7 +245,7 @@ public interface UserApi {
value = "/user/{username}"
)
ResponseEntity<Void> updateUser(
@Parameter(name = "username", description = "name that need to be deleted", required = true) @PathVariable("username") String username,
@Parameter(name = "username", description = "name that need to be deleted", required = true, in = ParameterIn.PATH) @PathVariable("username") String username,
@Parameter(name = "body", description = "Updated user object", required = true) @Valid @RequestBody User body
) throws Exception;

View File

@@ -38,7 +38,7 @@ public class Category {
* @return id
*/
@Schema(name = "id", required = false)
@Schema(name = "id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public Long getId() {
return id;
}
@@ -57,7 +57,7 @@ public class Category {
* @return name
*/
@Schema(name = "name", required = false)
@Schema(name = "name", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public String getName() {
return name;
}

View File

@@ -43,7 +43,7 @@ public class ModelApiResponse {
* @return code
*/
@Schema(name = "code", required = false)
@Schema(name = "code", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public Integer getCode() {
return code;
}
@@ -62,7 +62,7 @@ public class ModelApiResponse {
* @return type
*/
@Schema(name = "type", required = false)
@Schema(name = "type", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public String getType() {
return type;
}
@@ -81,7 +81,7 @@ public class ModelApiResponse {
* @return message
*/
@Schema(name = "message", required = false)
@Schema(name = "message", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public String getMessage() {
return message;
}

View File

@@ -91,7 +91,7 @@ public class Order {
* @return id
*/
@Schema(name = "id", required = false)
@Schema(name = "id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public Long getId() {
return id;
}
@@ -110,7 +110,7 @@ public class Order {
* @return petId
*/
@Schema(name = "petId", required = false)
@Schema(name = "petId", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public Long getPetId() {
return petId;
}
@@ -129,7 +129,7 @@ public class Order {
* @return quantity
*/
@Schema(name = "quantity", required = false)
@Schema(name = "quantity", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public Integer getQuantity() {
return quantity;
}
@@ -148,7 +148,7 @@ public class Order {
* @return shipDate
*/
@Valid
@Schema(name = "shipDate", required = false)
@Schema(name = "shipDate", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public OffsetDateTime getShipDate() {
return shipDate;
}
@@ -167,7 +167,7 @@ public class Order {
* @return status
*/
@Schema(name = "status", description = "Order Status", required = false)
@Schema(name = "status", description = "Order Status", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public StatusEnum getStatus() {
return status;
}
@@ -186,7 +186,7 @@ public class Order {
* @return complete
*/
@Schema(name = "complete", required = false)
@Schema(name = "complete", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public Boolean getComplete() {
return complete;
}

View File

@@ -42,7 +42,7 @@ public class Pet {
@JsonProperty("tags")
@Valid
private List<Tag> tags = null;
private List<@Valid Tag> tags = null;
/**
* pet status in the store
@@ -84,6 +84,23 @@ public class Pet {
@JsonProperty("status")
private StatusEnum status;
/**
* Default constructor
* @deprecated Use {@link Pet#Pet(String, List<String>)}
*/
@Deprecated
public Pet() {
super();
}
/**
* Constructor with only required parameters
*/
public Pet(String name, List<String> photoUrls) {
this.name = name;
this.photoUrls = photoUrls;
}
public Pet id(Long id) {
this.id = id;
return this;
@@ -94,7 +111,7 @@ public class Pet {
* @return id
*/
@Schema(name = "id", required = false)
@Schema(name = "id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public Long getId() {
return id;
}
@@ -113,7 +130,7 @@ public class Pet {
* @return category
*/
@Valid
@Schema(name = "category", required = false)
@Schema(name = "category", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public Category getCategory() {
return category;
}
@@ -132,7 +149,7 @@ public class Pet {
* @return name
*/
@NotNull
@Schema(name = "name", example = "doggie", required = true)
@Schema(name = "name", example = "doggie", requiredMode = Schema.RequiredMode.REQUIRED)
public String getName() {
return name;
}
@@ -156,7 +173,7 @@ public class Pet {
* @return photoUrls
*/
@NotNull
@Schema(name = "photoUrls", required = true)
@Schema(name = "photoUrls", requiredMode = Schema.RequiredMode.REQUIRED)
public List<String> getPhotoUrls() {
return photoUrls;
}
@@ -165,7 +182,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;
}
@@ -183,12 +200,12 @@ public class Pet {
* @return tags
*/
@Valid
@Schema(name = "tags", required = false)
public List<Tag> getTags() {
@Schema(name = "tags", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public List<@Valid Tag> getTags() {
return tags;
}
public void setTags(List<Tag> tags) {
public void setTags(List<@Valid Tag> tags) {
this.tags = tags;
}
@@ -202,7 +219,7 @@ public class Pet {
* @return status
*/
@Schema(name = "status", description = "pet status in the store", required = false)
@Schema(name = "status", description = "pet status in the store", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public StatusEnum getStatus() {
return status;
}

View File

@@ -38,7 +38,7 @@ public class Tag {
* @return id
*/
@Schema(name = "id", required = false)
@Schema(name = "id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public Long getId() {
return id;
}
@@ -57,7 +57,7 @@ public class Tag {
* @return name
*/
@Schema(name = "name", required = false)
@Schema(name = "name", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public String getName() {
return name;
}

View File

@@ -56,7 +56,7 @@ public class User {
* @return id
*/
@Schema(name = "id", required = false)
@Schema(name = "id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public Long getId() {
return id;
}
@@ -75,7 +75,7 @@ public class User {
* @return username
*/
@Schema(name = "username", required = false)
@Schema(name = "username", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public String getUsername() {
return username;
}
@@ -94,7 +94,7 @@ public class User {
* @return firstName
*/
@Schema(name = "firstName", required = false)
@Schema(name = "firstName", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public String getFirstName() {
return firstName;
}
@@ -113,7 +113,7 @@ public class User {
* @return lastName
*/
@Schema(name = "lastName", required = false)
@Schema(name = "lastName", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public String getLastName() {
return lastName;
}
@@ -132,7 +132,7 @@ public class User {
* @return email
*/
@Schema(name = "email", required = false)
@Schema(name = "email", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public String getEmail() {
return email;
}
@@ -151,7 +151,7 @@ public class User {
* @return password
*/
@Schema(name = "password", required = false)
@Schema(name = "password", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public String getPassword() {
return password;
}
@@ -170,7 +170,7 @@ public class User {
* @return phone
*/
@Schema(name = "phone", required = false)
@Schema(name = "phone", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public String getPhone() {
return phone;
}
@@ -189,7 +189,7 @@ public class User {
* @return userStatus
*/
@Schema(name = "userStatus", description = "User Status", required = false)
@Schema(name = "userStatus", description = "User Status", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public Integer getUserStatus() {
return userStatus;
}