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

@@ -50,6 +50,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

@@ -58,6 +58,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
) {
@@ -87,6 +88,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
) {
@@ -116,6 +118,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
) {
@@ -145,6 +148,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
) {
@@ -174,6 +178,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
) {
@@ -202,6 +207,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
) {
@@ -230,6 +236,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
@@ -261,6 +268,7 @@ public interface FakeApi {
produces = { "application/json" },
consumes = { "application/json" }
)
default ResponseEntity<Client> testClientModel(
@ApiParam(value = "client model", required = true) @Valid @RequestBody Client body
) {
@@ -307,6 +315,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,
@@ -357,6 +366,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,
@@ -396,6 +406,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,
@@ -428,6 +439,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
) {
@@ -456,6 +468,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
@@ -488,6 +501,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,
@@ -529,6 +543,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

@@ -53,6 +53,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

@@ -58,6 +58,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
) {
@@ -93,6 +94,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
@@ -132,6 +134,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
@@ -173,6 +176,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
@@ -210,6 +214,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
) {
@@ -246,6 +251,7 @@ public interface PetApi {
value = "/pet/all",
produces = { "application/xml", "application/json" }
)
default ResponseEntity<List<Pet>> listAllPets(
@ApiIgnore final Pageable pageable
) {
@@ -285,6 +291,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
) {
@@ -320,6 +327,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,
@@ -359,6 +367,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

@@ -50,6 +50,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
) {
@@ -82,6 +83,7 @@ public interface StoreApi {
value = "/store/inventory",
produces = { "application/json" }
)
default ResponseEntity<Map<String, Integer>> getInventory(
) {
@@ -115,6 +117,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
) {
@@ -145,6 +148,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

@@ -48,6 +48,7 @@ public interface UserApi {
method = RequestMethod.POST,
value = "/user"
)
default ResponseEntity<Void> createUser(
@ApiParam(value = "Created user object", required = true) @Valid @RequestBody User body
) {
@@ -74,6 +75,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
) {
@@ -100,6 +102,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
) {
@@ -129,6 +132,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
) {
@@ -161,6 +165,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
) {
@@ -192,6 +197,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
@@ -218,6 +224,7 @@ public interface UserApi {
method = RequestMethod.GET,
value = "/user/logout"
)
default ResponseEntity<Void> logoutUser(
) {
@@ -248,6 +255,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

@@ -51,6 +51,7 @@ public interface VersioningApi {
produces = { "*/*" },
headers = { "VersionWithDefaultValue=V1", "VersionNoDefaultValue" }
)
default ResponseEntity<ModelApiResponse> versioningHeaders(
@NotNull @ApiParam(value = "", required = true, defaultValue = "V1") @RequestHeader(value = "VersionWithDefaultValue", required = true, defaultValue = "V1") String versionWithDefaultValue,
@NotNull @ApiParam(value = "", required = true) @RequestHeader(value = "VersionNoDefaultValue", required = true) String versionNoDefaultValue,
@@ -87,6 +88,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,
@@ -122,6 +124,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,