Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -568,12 +568,8 @@ public void processOpts() {
(sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "ApiUtil.java"));
}

if (!delegatePattern || delegateMethod) {
additionalProperties.put("jdk8-no-delegate", true);
}

if (delegatePattern && !delegateMethod) {
additionalProperties.put("isDelegate", "true");
additionalProperties.put("isDelegate", true);
apiTemplateFiles.put("apiDelegate.mustache", "Delegate.java");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@ import io.swagger.v3.oas.annotations.media.ExampleObject;
{{#swagger1AnnotationLibrary}}
import io.swagger.annotations.*;
{{/swagger1AnnotationLibrary}}
{{#jdk8-no-delegate}}
{{^isDelegate}}
{{#jdk8-default-interface}}
{{#virtualService}}
import io.virtualan.annotation.ApiVirtual;
import io.virtualan.annotation.VirtualService;
{{/virtualService}}
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
{{/jdk8-no-delegate}}
{{/jdk8-default-interface}}
{{/isDelegate}}
{{^useResponseEntity}}
import org.springframework.http.HttpStatus;
{{/useResponseEntity}}
Expand All @@ -48,11 +50,13 @@ import org.springframework.web.bind.annotation.RestController;
{{/useResponseEntity}}
{{/useSpringController}}
import org.springframework.web.bind.annotation.*;
{{#jdk8-no-delegate}}
{{^reactive}}
{{#jdk8-default-interface}}
{{^isDelegate}}
{{^reactive}}
import org.springframework.web.context.request.NativeWebRequest;
{{/reactive}}
{{/jdk8-no-delegate}}
{{/reactive}}
{{/isDelegate}}
{{/jdk8-default-interface}}
import org.springframework.web.multipart.MultipartFile;
{{#reactive}}
import org.springframework.web.server.ServerWebExchange;
Expand All @@ -67,14 +71,14 @@ import {{javaxPackage}}.validation.constraints.*;
{{/useBeanValidation}}
import java.util.List;
import java.util.Map;
{{#jdk8-no-delegate}}
{{^isDelegate}}
import java.util.Optional;
{{/jdk8-no-delegate}}
{{^jdk8-no-delegate}}
{{/isDelegate}}
{{#isDelegate}}
{{#useOptional}}
import java.util.Optional;
{{/useOptional}}
{{/jdk8-no-delegate}}
{{/isDelegate}}
{{#async}}
import java.util.concurrent.CompletableFuture;
{{/async}}
Expand Down Expand Up @@ -261,7 +265,9 @@ public interface {{classname}} {
{{#vendorExtensions.x-operation-extra-annotation}}
{{{.}}}
{{/vendorExtensions.x-operation-extra-annotation}}
{{#vendorExtensions.x-sse}}@ResponseBody{{/vendorExtensions.x-sse}}
{{#vendorExtensions.x-sse}}
@ResponseBody
{{/vendorExtensions.x-sse}}
{{#jdk8-default-interface}}default {{/jdk8-default-interface}}{{>responseType}} {{#delegate-method}}_{{/delegate-method}}{{operationId}}(
{{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{>cookieParams}}{{^-last}},
{{/-last}}{{/allParams}}{{#reactive}}{{#hasParams}},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package {{package}};

{{^jdk8-no-delegate}}
{{^isDelegate}}
{{#imports}}import {{import}};
{{/imports}}

import io.swagger.annotations.*;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
{{/jdk8-no-delegate}}
{{/isDelegate}}
import org.springframework.stereotype.Controller;
{{^jdk8-no-delegate}}
{{^isDelegate}}
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
Expand All @@ -26,7 +26,7 @@ import java.util.Optional;
{{#async}}
import java.util.concurrent.Callable;
{{/async}}
{{/jdk8-no-delegate}}
{{/isDelegate}}
{{^useSpringCloudClient}}
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
Expand Down Expand Up @@ -60,7 +60,7 @@ public class {{classname}}Controller implements {{classname}} {
}

{{/isDelegate}}
{{^jdk8-no-delegate}}
{{^isDelegate}}
{{#operation}}
public {{#async}}Callable<{{/async}}ResponseEntity<{{>returnTypes}}>{{#async}}>{{/async}} {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}},
{{/allParams}}@RequestHeader(value = "Accept", required = false) String accept) throws Exception {
Expand Down Expand Up @@ -111,6 +111,6 @@ public class {{classname}}Controller implements {{classname}} {
}

{{/operation}}
{{/jdk8-no-delegate}}
{{/isDelegate}}
}
{{/operations}}
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@
*/
package org.openapitools.api;

import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.Valid;
Expand All @@ -34,7 +31,6 @@ public interface SomeApi {
method = RequestMethod.GET,
value = SomeApi.PATH_SOME_ENDPOINT_GET
)

ResponseEntity<Void> someEndpointGet(

);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,9 @@
import org.springframework.lang.Nullable;
import java.time.OffsetDateTime;
import io.swagger.annotations.*;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.Valid;
Expand Down Expand Up @@ -52,7 +49,6 @@ public interface DefaultApi {
method = RequestMethod.GET,
value = DefaultApi.PATH_GET
)

ResponseEntity<Void> get(
@NotNull @ApiParam(value = "A date path parameter", required = true, defaultValue = "1972-01-01") @PathVariable("date") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date,
@NotNull @ApiParam(value = "A date-time query parameter", required = true, defaultValue = "1973-12-19T03:39:57-08:00") @Valid @RequestParam(value = "dateTime", required = true, defaultValue = "1973-12-19T03:39:57-08:00") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) OffsetDateTime dateTime,
Expand Down Expand Up @@ -83,7 +79,6 @@ ResponseEntity<Void> get(
value = DefaultApi.PATH_UPDATE_PET_WITH_FORM,
consumes = "application/x-www-form-urlencoded"
)

ResponseEntity<Void> updatePetWithForm(
@NotNull @ApiParam(value = "A date path parameter", required = true, defaultValue = "1970-01-01") @PathVariable("date") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date,
@ApiParam(value = "Updated last visit timestamp", defaultValue = "1971-12-19T03:39:57-08:00") @Valid @RequestParam(value = "visitDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) OffsetDateTime visitDate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,9 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.media.ExampleObject;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.Valid;
Expand Down Expand Up @@ -65,7 +62,6 @@ public interface PetApi {
value = PetApi.PATH_ADD_PET,
consumes = "application/json"
)

ResponseEntity<Void> addPet(
@Parameter(name = "Pet", description = "Pet object that needs to be added to the store", required = true) @Valid @RequestBody Pet pet
);
Expand Down Expand Up @@ -96,7 +92,6 @@ ResponseEntity<Void> addPet(
method = RequestMethod.DELETE,
value = PetApi.PATH_DELETE_PET
)

ResponseEntity<Void> deletePet(
@NotNull @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) @Nullable String apiKey
Expand Down Expand Up @@ -133,7 +128,6 @@ ResponseEntity<Void> deletePet(
value = PetApi.PATH_FIND_PETS_BY_STATUS,
produces = { "application/json", "application/xml" }
)

ResponseEntity<List<Pet>> findPetsByStatus(
@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
);
Expand Down Expand Up @@ -172,7 +166,6 @@ ResponseEntity<List<Pet>> findPetsByStatus(
value = PetApi.PATH_FIND_PETS_BY_TAGS,
produces = { "application/json", "application/xml" }
)

ResponseEntity<List<Pet>> findPetsByTags(
@NotNull @Parameter(name = "tags", description = "Tags to filter by", required = true, in = ParameterIn.QUERY) @Valid @RequestParam(value = "tags", required = true) List<String> tags
);
Expand Down Expand Up @@ -210,7 +203,6 @@ ResponseEntity<List<Pet>> findPetsByTags(
value = PetApi.PATH_GET_PET_BY_ID,
produces = { "application/json", "application/xml" }
)

ResponseEntity<Pet> getPetById(
@NotNull @Parameter(name = "petId", deprecated = true, description = "ID of pet to return", required = true, in = ParameterIn.PATH) @PathVariable("petId") @Deprecated Long petId
);
Expand Down Expand Up @@ -245,7 +237,6 @@ ResponseEntity<Pet> getPetById(
value = PetApi.PATH_UPDATE_PET,
consumes = "application/json"
)

ResponseEntity<Void> updatePet(
@Parameter(name = "Pet", description = "Pet object that needs to be added to the store", required = true) @Valid @RequestBody Pet pet
);
Expand Down Expand Up @@ -278,7 +269,6 @@ ResponseEntity<Void> updatePet(
value = PetApi.PATH_UPDATE_PET_WITH_FORM,
consumes = "application/x-www-form-urlencoded"
)

ResponseEntity<Void> updatePetWithForm(
@NotNull @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,
Expand Down Expand Up @@ -316,7 +306,6 @@ ResponseEntity<Void> updatePetWithForm(
produces = { "application/json" },
consumes = "multipart/form-data"
)

ResponseEntity<ModelApiResponse> uploadFile(
@NotNull @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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,9 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.media.ExampleObject;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.Valid;
Expand Down Expand Up @@ -62,7 +59,6 @@ public interface StoreApi {
method = RequestMethod.DELETE,
value = StoreApi.PATH_DELETE_ORDER
)

ResponseEntity<Void> deleteOrder(
@NotNull @Parameter(name = "orderId", description = "ID of the order that needs to be deleted", required = true, in = ParameterIn.PATH) @PathVariable("orderId") String orderId
);
Expand Down Expand Up @@ -94,7 +90,6 @@ ResponseEntity<Void> deleteOrder(
value = StoreApi.PATH_GET_INVENTORY,
produces = { "application/json" }
)

ResponseEntity<Map<String, Integer>> getInventory(

);
Expand Down Expand Up @@ -129,7 +124,6 @@ ResponseEntity<Map<String, Integer>> getInventory(
value = StoreApi.PATH_GET_ORDER_BY_ID,
produces = { "application/json", "application/xml" }
)

ResponseEntity<Order> getOrderById(
@NotNull @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
);
Expand Down Expand Up @@ -163,7 +157,6 @@ ResponseEntity<Order> getOrderById(
produces = { "application/json", "application/xml" },
consumes = "application/json"
)

ResponseEntity<Order> placeOrder(
@Parameter(name = "Order", description = "order placed for purchasing the pet", required = true) @Valid @RequestBody Order order
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,9 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.media.ExampleObject;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.Valid;
Expand Down Expand Up @@ -64,7 +61,6 @@ public interface UserApi {
value = UserApi.PATH_CREATE_USER,
consumes = "application/json"
)

ResponseEntity<Void> createUser(
@Parameter(name = "User", description = "Created user object", required = true) @Valid @RequestBody User user
);
Expand Down Expand Up @@ -95,7 +91,6 @@ ResponseEntity<Void> createUser(
value = UserApi.PATH_CREATE_USERS_WITH_ARRAY_INPUT,
consumes = "application/json"
)

ResponseEntity<Void> createUsersWithArrayInput(
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<@Valid User> user
);
Expand Down Expand Up @@ -126,7 +121,6 @@ ResponseEntity<Void> createUsersWithArrayInput(
value = UserApi.PATH_CREATE_USERS_WITH_LIST_INPUT,
consumes = "application/json"
)

ResponseEntity<Void> createUsersWithListInput(
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<@Valid User> user
);
Expand Down Expand Up @@ -158,7 +152,6 @@ ResponseEntity<Void> createUsersWithListInput(
method = RequestMethod.DELETE,
value = UserApi.PATH_DELETE_USER
)

ResponseEntity<Void> deleteUser(
@NotNull @Parameter(name = "username", description = "The name that needs to be deleted", required = true, in = ParameterIn.PATH) @PathVariable("username") String username
);
Expand Down Expand Up @@ -193,7 +186,6 @@ ResponseEntity<Void> deleteUser(
value = UserApi.PATH_GET_USER_BY_NAME,
produces = { "application/json", "application/xml" }
)

ResponseEntity<User> getUserByName(
@NotNull @Parameter(name = "username", description = "The name that needs to be fetched. Use user1 for testing.", required = true, in = ParameterIn.PATH) @PathVariable("username") String username
);
Expand Down Expand Up @@ -227,7 +219,6 @@ ResponseEntity<User> getUserByName(
value = UserApi.PATH_LOGIN_USER,
produces = { "application/json", "application/xml" }
)

ResponseEntity<String> loginUser(
@NotNull @Pattern(regexp = "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") @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", deprecated = true, description = "The password for login in clear text", required = true, in = ParameterIn.QUERY) @Valid @RequestParam(value = "password", required = true) @Deprecated String password
Expand Down Expand Up @@ -257,7 +248,6 @@ ResponseEntity<String> loginUser(
method = RequestMethod.GET,
value = UserApi.PATH_LOGOUT_USER
)

ResponseEntity<Void> logoutUser(

);
Expand Down Expand Up @@ -291,7 +281,6 @@ ResponseEntity<Void> logoutUser(
value = UserApi.PATH_UPDATE_USER,
consumes = "application/json"
)

ResponseEntity<Void> updateUser(
@NotNull @Parameter(name = "username", description = "name that need to be deleted", required = true, in = ParameterIn.PATH) @PathVariable("username") String username,
@Parameter(name = "User", description = "Updated user object", required = true) @Valid @RequestBody User user
Expand Down
Loading
Loading