contribution #6123: add spring support for SSE conform specs (#16543)

* add spring support for SSE conform specs

see https://github.com/OpenAPITools/openapi-generator/issues/6123 for the ongoing discussion

* extend generator option documentation

* applied review suggestions

* regenerated samples

* regenerated docu

* fix code style: removed tabs
This commit is contained in:
krasv
2023-09-21 11:08:24 +02:00
committed by GitHub
parent 254b359a56
commit 8f8fd85fd6
172 changed files with 1287 additions and 32 deletions

View File

@@ -54,6 +54,7 @@ public interface AnotherFakeApi {
produces = { "application/json" },
consumes = { "application/json" }
)
default ResponseEntity<Client> call123testSpecialTags(
@ApiParam(value = "client model", required = true) @Valid @RequestBody Client body
) {

View File

@@ -62,6 +62,7 @@ public interface FakeApi {
value = "/fake/create_xml_item",
consumes = { "application/xml", "application/xml; charset=utf-8", "application/xml; charset=utf-16", "text/xml", "text/xml; charset=utf-8", "text/xml; charset=utf-16" }
)
default ResponseEntity<Void> createXmlItem(
@ApiParam(value = "XmlItem Body", required = true) @Valid @RequestBody XmlItem xmlItem
) {
@@ -92,6 +93,7 @@ public interface FakeApi {
value = "/fake/outer/boolean",
produces = { "*/*" }
)
default ResponseEntity<Boolean> fakeOuterBooleanSerialize(
@ApiParam(value = "Input boolean as post body") @Valid @RequestBody(required = false) Boolean body
) {
@@ -122,6 +124,7 @@ public interface FakeApi {
value = "/fake/outer/composite",
produces = { "*/*" }
)
default ResponseEntity<OuterComposite> fakeOuterCompositeSerialize(
@ApiParam(value = "Input composite as post body") @Valid @RequestBody(required = false) OuterComposite body
) {
@@ -161,6 +164,7 @@ public interface FakeApi {
value = "/fake/outer/number",
produces = { "*/*" }
)
default ResponseEntity<BigDecimal> fakeOuterNumberSerialize(
@ApiParam(value = "Input number as post body") @Valid @RequestBody(required = false) BigDecimal body
) {
@@ -191,6 +195,7 @@ public interface FakeApi {
value = "/fake/outer/string",
produces = { "*/*" }
)
default ResponseEntity<String> fakeOuterStringSerialize(
@ApiParam(value = "Input string as post body") @Valid @RequestBody(required = false) String body
) {
@@ -220,6 +225,7 @@ public interface FakeApi {
value = "/fake/body-with-file-schema",
consumes = { "application/json" }
)
default ResponseEntity<Void> testBodyWithFileSchema(
@ApiParam(value = "", required = true) @Valid @RequestBody FileSchemaTestClass body
) {
@@ -249,6 +255,7 @@ public interface FakeApi {
value = "/fake/body-with-query-params",
consumes = { "application/json" }
)
default ResponseEntity<Void> testBodyWithQueryParams(
@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "query", required = true) String query,
@ApiParam(value = "", required = true) @Valid @RequestBody User body
@@ -281,6 +288,7 @@ public interface FakeApi {
produces = { "application/json" },
consumes = { "application/json" }
)
default ResponseEntity<Client> testClientModel(
@ApiParam(value = "client model", required = true) @Valid @RequestBody Client body
) {
@@ -337,6 +345,7 @@ public interface FakeApi {
value = "/fake",
consumes = { "application/x-www-form-urlencoded" }
)
default ResponseEntity<Void> testEndpointParameters(
@ApiParam(value = "None", required = true) @Valid @RequestParam(value = "number", required = true) BigDecimal number,
@ApiParam(value = "None", required = true) @Valid @RequestParam(value = "double", required = true) Double _double,
@@ -388,6 +397,7 @@ public interface FakeApi {
value = "/fake",
consumes = { "application/x-www-form-urlencoded" }
)
default ResponseEntity<Void> testEnumParameters(
@ApiParam(value = "Header parameter enum test (string array)", allowableValues = ">, $") @RequestHeader(value = "enum_header_string_array", required = false) List<String> enumHeaderStringArray,
@ApiParam(value = "Header parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestHeader(value = "enum_header_string", required = false, defaultValue = "-efg") String enumHeaderString,
@@ -428,6 +438,7 @@ public interface FakeApi {
method = RequestMethod.DELETE,
value = "/fake"
)
default ResponseEntity<Void> testGroupParameters(
@NotNull @ApiParam(value = "Required String in group parameters", required = true) @Valid @RequestParam(value = "required_string_group", required = true) Integer requiredStringGroup,
@NotNull @ApiParam(value = "Required Boolean in group parameters", required = true) @RequestHeader(value = "required_boolean_group", required = true) Boolean requiredBooleanGroup,
@@ -461,6 +472,7 @@ public interface FakeApi {
value = "/fake/inline-additionalProperties",
consumes = { "application/json" }
)
default ResponseEntity<Void> testInlineAdditionalProperties(
@ApiParam(value = "request body", required = true) @Valid @RequestBody Map<String, String> param
) {
@@ -490,6 +502,7 @@ public interface FakeApi {
value = "/fake/jsonFormData",
consumes = { "application/x-www-form-urlencoded" }
)
default ResponseEntity<Void> testJsonFormData(
@ApiParam(value = "field1", required = true) @Valid @RequestParam(value = "param", required = true) String param,
@ApiParam(value = "field2", required = true) @Valid @RequestParam(value = "param2", required = true) String param2
@@ -523,6 +536,7 @@ public interface FakeApi {
method = RequestMethod.PUT,
value = "/fake/test-query-parameters"
)
default ResponseEntity<Void> testQueryParameterCollectionFormat(
@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "pipe", required = true) List<String> pipe,
@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "ioutil", required = true) List<String> ioutil,
@@ -565,6 +579,7 @@ public interface FakeApi {
produces = { "application/json" },
consumes = { "multipart/form-data" }
)
default ResponseEntity<ModelApiResponse> uploadFileWithRequiredFile(
@ApiParam(value = "ID of pet to update", required = true) @PathVariable("petId") Long petId,
@ApiParam(value = "file to upload", required = true) @RequestPart(value = "requiredFile", required = true) MultipartFile requiredFile,

View File

@@ -57,6 +57,7 @@ public interface FakeClassnameTestApi {
produces = { "application/json" },
consumes = { "application/json" }
)
default ResponseEntity<Client> testClassname(
@ApiParam(value = "client model", required = true) @Valid @RequestBody Client body
) {

View File

@@ -62,6 +62,7 @@ public interface PetApi {
value = "/pet",
consumes = { "application/json", "application/xml" }
)
default ResponseEntity<Void> addPet(
@ApiParam(value = "Pet object that needs to be added to the store", required = true) @Valid @RequestBody Pet body
) {
@@ -98,6 +99,7 @@ public interface PetApi {
method = RequestMethod.DELETE,
value = "/pet/{petId}"
)
default ResponseEntity<Void> deletePet(
@ApiParam(value = "Pet id to delete", required = true) @PathVariable("petId") Long petId,
@ApiParam(value = "") @RequestHeader(value = "api_key", required = false) String apiKey
@@ -138,6 +140,7 @@ public interface PetApi {
value = "/pet/findByStatus",
produces = { "application/xml", "application/json" }
)
default ResponseEntity<List<Pet>> findPetsByStatus(
@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @Valid @RequestParam(value = "status", required = true) List<String> status,
@ApiIgnore final Pageable pageable
@@ -194,6 +197,7 @@ public interface PetApi {
value = "/pet/findByTags",
produces = { "application/xml", "application/json" }
)
default ResponseEntity<List<Pet>> findPetsByTags(
@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List<String> tags,
@ApiIgnore final Pageable pageable
@@ -246,6 +250,7 @@ public interface PetApi {
value = "/pet/{petId}",
produces = { "application/xml", "application/json" }
)
default ResponseEntity<Pet> getPetById(
@ApiParam(value = "ID of pet to return", required = true) @PathVariable("petId") Long petId
) {
@@ -297,6 +302,7 @@ public interface PetApi {
value = "/pet/all",
produces = { "application/xml", "application/json" }
)
default ResponseEntity<List<Pet>> listAllPets(
@ApiIgnore final Pageable pageable
) {
@@ -351,6 +357,7 @@ public interface PetApi {
value = "/pet",
consumes = { "application/json", "application/xml" }
)
default ResponseEntity<Void> updatePet(
@ApiParam(value = "Pet object that needs to be added to the store", required = true) @Valid @RequestBody Pet body
) {
@@ -387,6 +394,7 @@ public interface PetApi {
value = "/pet/{petId}",
consumes = { "application/x-www-form-urlencoded" }
)
default ResponseEntity<Void> updatePetWithForm(
@ApiParam(value = "ID of pet that needs to be updated", required = true) @PathVariable("petId") Long petId,
@ApiParam(value = "Updated name of the pet") @Valid @RequestParam(value = "name", required = false) String name,
@@ -427,6 +435,7 @@ public interface PetApi {
produces = { "application/json" },
consumes = { "multipart/form-data" }
)
default ResponseEntity<ModelApiResponse> uploadFile(
@ApiParam(value = "ID of pet to update", required = true) @PathVariable("petId") Long petId,
@ApiParam(value = "Additional data to pass to server") @Valid @RequestParam(value = "additionalMetadata", required = false) String additionalMetadata,

View File

@@ -54,6 +54,7 @@ public interface StoreApi {
method = RequestMethod.DELETE,
value = "/store/order/{order_id}"
)
default ResponseEntity<Void> deleteOrder(
@ApiParam(value = "ID of the order that needs to be deleted", required = true) @PathVariable("order_id") String orderId
) {
@@ -87,6 +88,7 @@ public interface StoreApi {
value = "/store/inventory",
produces = { "application/json" }
)
default ResponseEntity<Map<String, Integer>> getInventory(
) {
@@ -121,6 +123,7 @@ public interface StoreApi {
value = "/store/order/{order_id}",
produces = { "application/xml", "application/json" }
)
default ResponseEntity<Order> getOrderById(
@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("order_id") Long orderId
) {
@@ -166,6 +169,7 @@ public interface StoreApi {
value = "/store/order",
produces = { "application/xml", "application/json" }
)
default ResponseEntity<Order> placeOrder(
@ApiParam(value = "order placed for purchasing the pet", required = true) @Valid @RequestBody Order body
) {

View File

@@ -52,6 +52,7 @@ public interface UserApi {
method = RequestMethod.POST,
value = "/user"
)
default ResponseEntity<Void> createUser(
@ApiParam(value = "Created user object", required = true) @Valid @RequestBody User body
) {
@@ -79,6 +80,7 @@ public interface UserApi {
method = RequestMethod.POST,
value = "/user/createWithArray"
)
default ResponseEntity<Void> createUsersWithArrayInput(
@ApiParam(value = "List of user object", required = true) @Valid @RequestBody List<User> body
) {
@@ -106,6 +108,7 @@ public interface UserApi {
method = RequestMethod.POST,
value = "/user/createWithList"
)
default ResponseEntity<Void> createUsersWithListInput(
@ApiParam(value = "List of user object", required = true) @Valid @RequestBody List<User> body
) {
@@ -136,6 +139,7 @@ public interface UserApi {
method = RequestMethod.DELETE,
value = "/user/{username}"
)
default ResponseEntity<Void> deleteUser(
@ApiParam(value = "The name that needs to be deleted", required = true) @PathVariable("username") String username
) {
@@ -169,6 +173,7 @@ public interface UserApi {
value = "/user/{username}",
produces = { "application/xml", "application/json" }
)
default ResponseEntity<User> getUserByName(
@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required = true) @PathVariable("username") String username
) {
@@ -215,6 +220,7 @@ public interface UserApi {
value = "/user/login",
produces = { "application/xml", "application/json" }
)
default ResponseEntity<String> loginUser(
@NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) String username,
@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) String password
@@ -242,6 +248,7 @@ public interface UserApi {
method = RequestMethod.GET,
value = "/user/logout"
)
default ResponseEntity<Void> logoutUser(
) {
@@ -273,6 +280,7 @@ public interface UserApi {
method = RequestMethod.PUT,
value = "/user/{username}"
)
default ResponseEntity<Void> updateUser(
@ApiParam(value = "name that need to be deleted", required = true) @PathVariable("username") String username,
@ApiParam(value = "Updated user object", required = true) @Valid @RequestBody User body

View File

@@ -57,6 +57,7 @@ public interface VersioningApi {
produces = { "*/*" },
headers = { "VersionWithDefaultValue=V1", "VersionNoDefaultValue" }
)
default ResponseEntity<ModelApiResponse> versioningHeaders(
@ApiParam(value = "ID of pet to update", required = true) @PathVariable("petId") Long petId
) {
@@ -103,6 +104,7 @@ public interface VersioningApi {
headers = { "VersionWithDefaultValueHeader=V1", "VersionNoDefaultValueHeader" } ,
params = { "VersionWithDefaultValueQuery=V1", "VersionNoDefaultValueQuery" }
)
default ResponseEntity<ModelApiResponse> versioningMix(
@NotNull @ApiParam(value = "", required = true, defaultValue = "V1") @Valid @RequestParam(value = "VersionWithDefaultValueQuery", required = true, defaultValue = "V1") String versionWithDefaultValueQuery,
@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "VersionNoDefaultValueQuery", required = true) String versionNoDefaultValueQuery,
@@ -146,6 +148,7 @@ public interface VersioningApi {
produces = { "*/*" },
params = { "VersionWithDefaultValue=V1", "VersionNoDefaultValue" }
)
default ResponseEntity<ModelApiResponse> versioningQueryParams(
@NotNull @ApiParam(value = "", required = true, defaultValue = "V1") @Valid @RequestParam(value = "VersionWithDefaultValue", required = true, defaultValue = "V1") String versionWithDefaultValue,
@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "VersionNoDefaultValue", required = true) String versionNoDefaultValue,