update java server samples

This commit is contained in:
wing328
2017-10-09 23:00:44 +08:00
parent 3b134319fa
commit d054a43b65
70 changed files with 1410 additions and 59 deletions

View File

@@ -0,0 +1,39 @@
/**
* NOTE: This class is auto generated by the swagger code generator program (2.3.0-SNAPSHOT).
* https://github.com/swagger-api/swagger-codegen
* Do not edit the class manually.
*/
package io.swagger.api;
import io.swagger.model.Client;
import io.swagger.annotations.*;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.List;
import org.springframework.validation.annotation.Validated;
import javax.validation.constraints.*;
import javax.validation.Valid;
@Api(value = "another-fake", description = "the another-fake API")
public interface AnotherFakeApi {
@ApiOperation(value = "To test special tags", notes = "To test special tags", response = Client.class, tags={ "$another-fake?", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = Client.class) })
@RequestMapping(value = "/another-fake/dummy",
produces = { "application/json" },
consumes = { "application/json" },
method = RequestMethod.PATCH)
ResponseEntity<Client> testSpecialTags(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, @RequestHeader(value = "Accept", required = false) String accept) throws Exception;
}

View File

@@ -0,0 +1,44 @@
package io.swagger.api;
import io.swagger.model.Client;
import io.swagger.annotations.*;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import javax.validation.constraints.*;
import javax.validation.Valid;
@Controller
public class AnotherFakeApiController implements AnotherFakeApi {
private final ObjectMapper objectMapper;
public AnotherFakeApiController(ObjectMapper objectMapper) {
this.objectMapper = objectMapper;
}
private final AnotherFakeApiDelegate delegate;
@org.springframework.beans.factory.annotation.Autowired
public AnotherFakeApiController(AnotherFakeApiDelegate delegate) {
this.delegate = delegate;
}
public ResponseEntity<Client> testSpecialTags(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body,
@RequestHeader(value = "Accept", required = false) String accept) throws Exception {
// do some magic!
return delegate.testSpecialTags(body);
}
}

View File

@@ -0,0 +1,24 @@
package io.swagger.api;
import io.swagger.model.Client;
import io.swagger.annotations.*;
import org.springframework.http.ResponseEntity;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
/**
* A delegate to be called by the {@link AnotherFakeApiController}}.
* Should be implemented as a controller but without the {@link org.springframework.stereotype.Controller} annotation.
* Instead, use spring to autowire this class into the {@link AnotherFakeApiController}.
*/
public interface AnotherFakeApiDelegate {
/**
* @see AnotherFakeApi#testSpecialTags
*/
ResponseEntity<Client> testSpecialTags(Client body);
}

View File

@@ -18,7 +18,7 @@ public class SwaggerDocumentationConfig {
return new ApiInfoBuilder()
.title("Swagger Petstore")
.description("This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\")
.license("Apache 2.0")
.license("Apache-2.0")
.licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html")
.termsOfServiceUrl("")
.version("1.0.0")