Merge branch 'master' into afnetworking-pinned-certificates-fix

This commit is contained in:
Roman Truba 2016-11-08 15:48:46 +03:00
commit 73276fd63a
47 changed files with 256 additions and 120 deletions

View File

@ -310,7 +310,10 @@ public class CodeGenMojo extends AbstractMojo {
}
if (addCompileSourceRoot) {
String sourceJavaFolder = output.toString() + "/" + configOptions.get(CodegenConstants.SOURCE_FOLDER);
final Object sourceFolderObject = configOptions.get(CodegenConstants.SOURCE_FOLDER);
final String sourceFolder = sourceFolderObject == null ? "src/main/java" : sourceFolderObject.toString();
String sourceJavaFolder = output.toString() + "/" + sourceFolder;
project.addCompileSourceRoot(sourceJavaFolder);
}
}

View File

@ -1892,7 +1892,11 @@ public class DefaultCodegen {
for (String key : consumes) {
Map<String, String> mediaType = new HashMap<String, String>();
// escape quotation to avoid code injection
mediaType.put("mediaType", escapeText(escapeQuotationMark(key)));
if ("*/*".equals(key)) { // "*/*" is a special case, do nothing
mediaType.put("mediaType", key);
} else {
mediaType.put("mediaType", escapeText(escapeQuotationMark(key)));
}
count += 1;
if (count < consumes.size()) {
mediaType.put("hasMore", "true");
@ -1926,7 +1930,11 @@ public class DefaultCodegen {
for (String key : produces) {
Map<String, String> mediaType = new HashMap<String, String>();
// escape quotation to avoid code injection
mediaType.put("mediaType", escapeText(escapeQuotationMark(key)));
if ("*/*".equals(key)) { // "*/*" is a special case, do nothing
mediaType.put("mediaType", key);
} else {
mediaType.put("mediaType", escapeText(escapeQuotationMark(key)));
}
count += 1;
if (count < produces.size()) {
mediaType.put("hasMore", "true");

View File

@ -141,7 +141,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
config.additionalProperties().put("generatedDate", DateTime.now().toString());
config.additionalProperties().put("generatorClass", config.getClass().toString());
config.additionalProperties().put("inputSpec", config.getInputSpec());
if (swagger.getInfo() != null) {
Info info = swagger.getInfo();
if (info.getTitle() != null) {
@ -405,6 +405,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
operation.put("classname", config.toApiName(tag));
operation.put("classVarName", config.toApiVarName(tag));
operation.put("importPath", config.toApiImport(tag));
operation.put("classFilename", config.toApiFilename(tag));
if(!config.vendorExtensions().isEmpty()) {
operation.put("vendorExtensions", config.vendorExtensions());

View File

@ -10,6 +10,8 @@ public class AspNet5ServerCodegen extends AspNetCoreServerCodegen {
public AspNet5ServerCodegen() {
super();
embeddedTemplateDir = templateDir = "aspnetcore";
}
@Override

View File

@ -63,12 +63,9 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#parcela
{{/maximum}}
* @return {{name}}
**/
{{#vendorExtensions.extraAnnotation}}
{{{vendorExtensions.extraAnnotation}}}
{{/vendorExtensions.extraAnnotation}}
{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} @ApiModelProperty({{#example}}example = "{{example}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}")
{{#vendorExtensions.extraAnnotation}}
{{vendorExtensions.extraAnnotation}}
{{{vendorExtensions.extraAnnotation}}}
{{/vendorExtensions.extraAnnotation}}
public {{{datatypeWithEnum}}} {{getter}}() {
return {{name}};

View File

@ -1,9 +1,9 @@
@XmlType(name="{{datatypeWithEnum}}")
@XmlEnum
@XmlEnum({{datatype}}.class)
public enum {{datatypeWithEnum}} {
{{#allowableValues}}
{{#enumVars}}{{name}}({{datatype}}.valueOf({{{value}}})){{^-last}}, {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}
{{#enumVars}}@XmlEnumValue({{{value}}}) {{name}}({{datatype}}.valueOf({{{value}}})){{^-last}}, {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}
{{/allowableValues}}
@ -17,7 +17,17 @@ public enum {{datatypeWithEnum}} {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static {{datatypeWithEnum}} fromValue(String v) {
return valueOf(v);
for ({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) {
if (String.valueOf(b.value).equals(v)) {
return b;
}
}
return null;
}
}

View File

@ -5,6 +5,7 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
@XmlAccessorType(XmlAccessType.FIELD)
{{#hasVars}} @XmlType(name = "{{classname}}", propOrder =

View File

@ -15,8 +15,8 @@ import {{package}}.NotFoundException;
import java.io.InputStream;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.glassfish.jersey.media.multipart.FormDataParam;
import org.wso2.msf4j.formparam.FormDataParam;
import org.wso2.msf4j.formparam.FileInfo;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;

View File

@ -3,7 +3,8 @@ package {{package}};
import {{package}}.*;
import {{modelPackage}}.*;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.wso2.msf4j.formparam.FormDataParam;
import org.wso2.msf4j.formparam.FileInfo;
{{#imports}}import {{import}};
{{/imports}}

View File

@ -11,7 +11,8 @@ import {{package}}.NotFoundException;
import java.io.InputStream;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.wso2.msf4j.formparam.FormDataParam;
import org.wso2.msf4j.formparam.FileInfo;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext;

View File

@ -1,3 +1,3 @@
{{#isFormParam}}{{#notFile}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}){{#vendorExtensions.x-multipart}}@FormDataParam("{{paramName}}") {{{dataType}}} {{paramName}}{{/vendorExtensions.x-multipart}}{{^vendorExtensions.x-multipart}} {{#defaultValue}} @DefaultValue("{{{defaultValue}}}"){{/defaultValue}} @FormParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/vendorExtensions.x-multipart}}{{/notFile}}{{#isFile}}
@FormDataParam("{{paramName}}") InputStream {{paramName}}InputStream,
@FormDataParam("{{paramName}}") FormDataContentDisposition {{paramName}}Detail{{/isFile}}{{/isFormParam}}
@FormDataParam("{{paramName}}") FileInfo {{paramName}}Detail{{/isFile}}{{/isFormParam}}

View File

@ -66,16 +66,6 @@
<artifactId>jackson-datatype-joda</artifactId>
<version>2.4.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
<version>${jersey2-version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-multipart</artifactId>
<version>${jersey2-version}</version>
</dependency>
</dependencies>
<repositories>

View File

@ -1 +1 @@
{{#isFormParam}}{{#notFile}}{{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}}InputStream {{paramName}}InputStream, FormDataContentDisposition {{paramName}}Detail{{/isFile}}{{/isFormParam}}
{{#isFormParam}}{{#notFile}}{{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}}InputStream {{paramName}}InputStream, FileInfo {{paramName}}Detail{{/isFile}}{{/isFormParam}}

View File

@ -16,7 +16,7 @@ part 'auth/api_key_auth.dart';
part 'auth/oauth.dart';
part 'auth/http_basic_auth.dart';
{{#apiInfo}}{{#apis}}part 'api/{{classVarName}}_api.dart';
{{#apiInfo}}{{#apis}}part 'api/{{classFilename}}.dart';
{{/apis}}{{/apiInfo}}
{{#models}}{{#model}}part 'model/{{classFilename}}.dart';
{{/model}}{{/models}}

View File

@ -43,7 +43,7 @@
* This method is used by `JSONModel`.
*/
+ (JSONKeyMapper *)keyMapper {
return [[JSONKeyMapper alloc] initWithDictionary:@{ {{#vars}}@"{{baseName}}": @"{{name}}"{{#hasMore}}, {{/hasMore}}{{/vars}} }];
return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{ {{#vars}}@"{{name}}": @"{{baseName}}"{{#hasMore}}, {{/hasMore}}{{/vars}} }];
}
/**

View File

@ -31,7 +31,7 @@ Pod::Spec.new do |s|
{{#useCoreData}} s.resources = '{{podName}}/**/*.{xcdatamodeld,xcdatamodel}'{{/useCoreData}}
s.dependency 'AFNetworking', '~> 3.1'
s.dependency 'JSONModel', '~> 1.2'
s.dependency 'JSONModel', '~> 1.4'
s.dependency 'ISO8601', '~> 0.5'
end

View File

@ -462,7 +462,7 @@ class ApiClient(object):
content_types = list(map(lambda x: x.lower(), content_types))
if 'application/json' in content_types:
if 'application/json' in content_types or '*/*' in content_types:
return 'application/json'
else:
return content_types[0]

View File

@ -125,10 +125,11 @@ module {{moduleName}}
# application/json
# application/json; charset=UTF8
# APPLICATION/JSON
# */*
# @param [String] mime MIME
# @return [Boolean] True if the MIME is application/json
def json_mime?(mime)
!(mime =~ /\Aapplication\/json(;.*)?\z/i).nil?
(mime == "*/*") || !(mime =~ /\Aapplication\/json(;.*)?\z/i).nil?
end
# Deserialize the response to the given return type.

View File

@ -590,9 +590,9 @@ paths:
descriptions: To test enum parameters
operationId: testEnumParameters
consumes:
- application/json
- "*/*"
produces:
- application/json
- "*/*"
parameters:
- name: enum_form_string_array
type: array

View File

@ -17,7 +17,7 @@
* This method is used by `JSONModel`.
*/
+ (JSONKeyMapper *)keyMapper {
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"name": @"name" }];
return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{ @"_id": @"id", @"name": @"name" }];
}
/**

View File

@ -17,7 +17,7 @@
* This method is used by `JSONModel`.
*/
+ (JSONKeyMapper *)keyMapper {
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"petId": @"petId", @"quantity": @"quantity", @"shipDate": @"shipDate", @"status": @"status", @"complete": @"complete" }];
return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{ @"_id": @"id", @"petId": @"petId", @"quantity": @"quantity", @"shipDate": @"shipDate", @"status": @"status", @"complete": @"complete" }];
}
/**

View File

@ -17,7 +17,7 @@
* This method is used by `JSONModel`.
*/
+ (JSONKeyMapper *)keyMapper {
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"category": @"category", @"name": @"name", @"photoUrls": @"photoUrls", @"tags": @"tags", @"status": @"status" }];
return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{ @"_id": @"id", @"category": @"category", @"name": @"name", @"photoUrls": @"photoUrls", @"tags": @"tags", @"status": @"status" }];
}
/**

View File

@ -17,7 +17,7 @@
* This method is used by `JSONModel`.
*/
+ (JSONKeyMapper *)keyMapper {
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"name": @"name" }];
return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{ @"_id": @"id", @"name": @"name" }];
}
/**

View File

@ -17,7 +17,7 @@
* This method is used by `JSONModel`.
*/
+ (JSONKeyMapper *)keyMapper {
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"username": @"username", @"firstName": @"firstName", @"lastName": @"lastName", @"email": @"email", @"password": @"password", @"phone": @"phone", @"userStatus": @"userStatus" }];
return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{ @"_id": @"id", @"username": @"username", @"firstName": @"firstName", @"lastName": @"lastName", @"email": @"email", @"password": @"password", @"phone": @"phone", @"userStatus": @"userStatus" }];
}
/**

View File

@ -462,7 +462,7 @@ class ApiClient(object):
content_types = list(map(lambda x: x.lower(), content_types))
if 'application/json' in content_types:
if 'application/json' in content_types or '*/*' in content_types:
return 'application/json'
else:
return content_types[0]

View File

@ -191,8 +191,8 @@ No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
- **Content-Type**: */*
- **Accept**: */*

View File

@ -306,11 +306,11 @@ module Petstore
header_params = {}
# HTTP header 'Accept' (if needed)
local_header_accept = ['application/json']
local_header_accept = ['*/*']
local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
# HTTP header 'Content-Type'
local_header_content_type = ['application/json']
local_header_content_type = ['*/*']
header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
header_params[:'enum_header_string_array'] = @api_client.build_collection_param(opts[:'enum_header_string_array'], :csv) if !opts[:'enum_header_string_array'].nil?
header_params[:'enum_header_string'] = opts[:'enum_header_string'] if !opts[:'enum_header_string'].nil?

View File

@ -142,10 +142,11 @@ module Petstore
# application/json
# application/json; charset=UTF8
# APPLICATION/JSON
# */*
# @param [String] mime MIME
# @return [Boolean] True if the MIME is application/json
def json_mime?(mime)
!(mime =~ /\Aapplication\/json(;.*)?\z/i).nil?
(mime == "*/*") || !(mime =~ /\Aapplication\/json(;.*)?\z/i).nil?
end
# Deserialize the response to the given return type.

View File

@ -66,16 +66,6 @@
<artifactId>jackson-datatype-joda</artifactId>
<version>2.4.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
<version>${jersey2-version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-multipart</artifactId>
<version>${jersey2-version}</version>
</dependency>
</dependencies>
<repositories>

View File

@ -16,8 +16,8 @@ import io.swagger.api.NotFoundException;
import java.io.InputStream;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.glassfish.jersey.media.multipart.FormDataParam;
import org.wso2.msf4j.formparam.FormDataParam;
import org.wso2.msf4j.formparam.FileInfo;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;

View File

@ -3,7 +3,8 @@ package io.swagger.api;
import io.swagger.api.*;
import io.swagger.model.*;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.wso2.msf4j.formparam.FormDataParam;
import org.wso2.msf4j.formparam.FileInfo;
import io.swagger.model.Client;
import java.util.Date;
@ -19,7 +20,30 @@ import javax.ws.rs.core.SecurityContext;
public abstract class FakeApiService {
public abstract Response testClientModel(Client body ) throws NotFoundException;
public abstract Response testEndpointParameters(BigDecimal number ,Double _double ,String patternWithoutDelimiter ,byte[] _byte ,Integer integer ,Integer int32 ,Long int64 ,Float _float ,String string ,byte[] binary ,Date date ,Date dateTime ,String password ,String paramCallback ) throws NotFoundException;
public abstract Response testEnumParameters(List<String> enumFormStringArray ,String enumFormString ,List<String> enumHeaderStringArray ,String enumHeaderString ,List<String> enumQueryStringArray ,String enumQueryString ,BigDecimal enumQueryInteger ,Double enumQueryDouble ) throws NotFoundException;
public abstract Response testClientModel(Client body
) throws NotFoundException;
public abstract Response testEndpointParameters(BigDecimal number
,Double _double
,String patternWithoutDelimiter
,byte[] _byte
,Integer integer
,Integer int32
,Long int64
,Float _float
,String string
,byte[] binary
,Date date
,Date dateTime
,String password
,String paramCallback
) throws NotFoundException;
public abstract Response testEnumParameters(List<String> enumFormStringArray
,String enumFormString
,List<String> enumHeaderStringArray
,String enumHeaderString
,List<String> enumQueryStringArray
,String enumQueryString
,BigDecimal enumQueryInteger
,Double enumQueryDouble
) throws NotFoundException;
}

View File

@ -16,8 +16,8 @@ import io.swagger.api.NotFoundException;
import java.io.InputStream;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.glassfish.jersey.media.multipart.FormDataParam;
import org.wso2.msf4j.formparam.FormDataParam;
import org.wso2.msf4j.formparam.FileInfo;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
@ -179,7 +179,7 @@ public class PetApi {
,@ApiParam(value = "Additional data to pass to server")@FormDataParam("additionalMetadata") String additionalMetadata
,
@FormDataParam("file") InputStream fileInputStream,
@FormDataParam("file") FormDataContentDisposition fileDetail
@FormDataParam("file") FileInfo fileDetail
)
throws NotFoundException {
return delegate.uploadFile(petId,additionalMetadata,fileInputStream, fileDetail);

View File

@ -3,7 +3,8 @@ package io.swagger.api;
import io.swagger.api.*;
import io.swagger.model.*;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.wso2.msf4j.formparam.FormDataParam;
import org.wso2.msf4j.formparam.FileInfo;
import io.swagger.model.Pet;
import java.io.File;
@ -19,12 +20,25 @@ import javax.ws.rs.core.SecurityContext;
public abstract class PetApiService {
public abstract Response addPet(Pet body ) throws NotFoundException;
public abstract Response deletePet(Long petId ,String apiKey ) throws NotFoundException;
public abstract Response findPetsByStatus(List<String> status ) throws NotFoundException;
public abstract Response findPetsByTags(List<String> tags ) throws NotFoundException;
public abstract Response getPetById(Long petId ) throws NotFoundException;
public abstract Response updatePet(Pet body ) throws NotFoundException;
public abstract Response updatePetWithForm(Long petId ,String name ,String status ) throws NotFoundException;
public abstract Response uploadFile(Long petId ,String additionalMetadata ,InputStream fileInputStream, FormDataContentDisposition fileDetail ) throws NotFoundException;
public abstract Response addPet(Pet body
) throws NotFoundException;
public abstract Response deletePet(Long petId
,String apiKey
) throws NotFoundException;
public abstract Response findPetsByStatus(List<String> status
) throws NotFoundException;
public abstract Response findPetsByTags(List<String> tags
) throws NotFoundException;
public abstract Response getPetById(Long petId
) throws NotFoundException;
public abstract Response updatePet(Pet body
) throws NotFoundException;
public abstract Response updatePetWithForm(Long petId
,String name
,String status
) throws NotFoundException;
public abstract Response uploadFile(Long petId
,String additionalMetadata
,InputStream fileInputStream, FileInfo fileDetail
) throws NotFoundException;
}

View File

@ -15,8 +15,8 @@ import io.swagger.api.NotFoundException;
import java.io.InputStream;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.glassfish.jersey.media.multipart.FormDataParam;
import org.wso2.msf4j.formparam.FormDataParam;
import org.wso2.msf4j.formparam.FileInfo;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;

View File

@ -3,7 +3,8 @@ package io.swagger.api;
import io.swagger.api.*;
import io.swagger.model.*;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.wso2.msf4j.formparam.FormDataParam;
import org.wso2.msf4j.formparam.FileInfo;
import java.util.Map;
import io.swagger.model.Order;
@ -18,8 +19,11 @@ import javax.ws.rs.core.SecurityContext;
public abstract class StoreApiService {
public abstract Response deleteOrder(String orderId ) throws NotFoundException;
public abstract Response deleteOrder(String orderId
) throws NotFoundException;
public abstract Response getInventory() throws NotFoundException;
public abstract Response getOrderById(Long orderId ) throws NotFoundException;
public abstract Response placeOrder(Order body ) throws NotFoundException;
public abstract Response getOrderById(Long orderId
) throws NotFoundException;
public abstract Response placeOrder(Order body
) throws NotFoundException;
}

View File

@ -15,8 +15,8 @@ import io.swagger.api.NotFoundException;
import java.io.InputStream;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.glassfish.jersey.media.multipart.FormDataParam;
import org.wso2.msf4j.formparam.FormDataParam;
import org.wso2.msf4j.formparam.FileInfo;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;

View File

@ -3,7 +3,8 @@ package io.swagger.api;
import io.swagger.api.*;
import io.swagger.model.*;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.wso2.msf4j.formparam.FormDataParam;
import org.wso2.msf4j.formparam.FileInfo;
import io.swagger.model.User;
import java.util.List;
@ -18,12 +19,21 @@ import javax.ws.rs.core.SecurityContext;
public abstract class UserApiService {
public abstract Response createUser(User body ) throws NotFoundException;
public abstract Response createUsersWithArrayInput(List<User> body ) throws NotFoundException;
public abstract Response createUsersWithListInput(List<User> body ) throws NotFoundException;
public abstract Response deleteUser(String username ) throws NotFoundException;
public abstract Response getUserByName(String username ) throws NotFoundException;
public abstract Response loginUser(String username ,String password ) throws NotFoundException;
public abstract Response createUser(User body
) throws NotFoundException;
public abstract Response createUsersWithArrayInput(List<User> body
) throws NotFoundException;
public abstract Response createUsersWithListInput(List<User> body
) throws NotFoundException;
public abstract Response deleteUser(String username
) throws NotFoundException;
public abstract Response getUserByName(String username
) throws NotFoundException;
public abstract Response loginUser(String username
,String password
) throws NotFoundException;
public abstract Response logoutUser() throws NotFoundException;
public abstract Response updateUser(String username ,User body ) throws NotFoundException;
public abstract Response updateUser(String username
,User body
) throws NotFoundException;
}

View File

@ -12,7 +12,8 @@ import io.swagger.api.NotFoundException;
import java.io.InputStream;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.wso2.msf4j.formparam.FormDataParam;
import org.wso2.msf4j.formparam.FileInfo;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext;
@ -20,17 +21,40 @@ import javax.ws.rs.core.SecurityContext;
public class FakeApiServiceImpl extends FakeApiService {
@Override
public Response testClientModel(Client body ) throws NotFoundException {
public Response testClientModel(Client body
) throws NotFoundException {
// do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}
@Override
public Response testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, byte[] binary, Date date, Date dateTime, String password, String paramCallback ) throws NotFoundException {
public Response testEndpointParameters(BigDecimal number
, Double _double
, String patternWithoutDelimiter
, byte[] _byte
, Integer integer
, Integer int32
, Long int64
, Float _float
, String string
, byte[] binary
, Date date
, Date dateTime
, String password
, String paramCallback
) throws NotFoundException {
// do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}
@Override
public Response testEnumParameters(List<String> enumFormStringArray, String enumFormString, List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, BigDecimal enumQueryInteger, Double enumQueryDouble ) throws NotFoundException {
public Response testEnumParameters(List<String> enumFormStringArray
, String enumFormString
, List<String> enumHeaderStringArray
, String enumHeaderString
, List<String> enumQueryStringArray
, String enumQueryString
, BigDecimal enumQueryInteger
, Double enumQueryDouble
) throws NotFoundException {
// do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}

View File

@ -12,7 +12,8 @@ import io.swagger.api.NotFoundException;
import java.io.InputStream;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.wso2.msf4j.formparam.FormDataParam;
import org.wso2.msf4j.formparam.FileInfo;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext;
@ -20,42 +21,55 @@ import javax.ws.rs.core.SecurityContext;
public class PetApiServiceImpl extends PetApiService {
@Override
public Response addPet(Pet body ) throws NotFoundException {
public Response addPet(Pet body
) throws NotFoundException {
// do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}
@Override
public Response deletePet(Long petId, String apiKey ) throws NotFoundException {
public Response deletePet(Long petId
, String apiKey
) throws NotFoundException {
// do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}
@Override
public Response findPetsByStatus(List<String> status ) throws NotFoundException {
public Response findPetsByStatus(List<String> status
) throws NotFoundException {
// do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}
@Override
public Response findPetsByTags(List<String> tags ) throws NotFoundException {
public Response findPetsByTags(List<String> tags
) throws NotFoundException {
// do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}
@Override
public Response getPetById(Long petId ) throws NotFoundException {
public Response getPetById(Long petId
) throws NotFoundException {
// do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}
@Override
public Response updatePet(Pet body ) throws NotFoundException {
public Response updatePet(Pet body
) throws NotFoundException {
// do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}
@Override
public Response updatePetWithForm(Long petId, String name, String status ) throws NotFoundException {
public Response updatePetWithForm(Long petId
, String name
, String status
) throws NotFoundException {
// do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}
@Override
public Response uploadFile(Long petId, String additionalMetadata, InputStream fileInputStream, FormDataContentDisposition fileDetail ) throws NotFoundException {
public Response uploadFile(Long petId
, String additionalMetadata
, InputStream fileInputStream, FileInfo fileDetail
) throws NotFoundException {
// do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}

View File

@ -11,7 +11,8 @@ import io.swagger.api.NotFoundException;
import java.io.InputStream;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.wso2.msf4j.formparam.FormDataParam;
import org.wso2.msf4j.formparam.FileInfo;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext;
@ -19,7 +20,8 @@ import javax.ws.rs.core.SecurityContext;
public class StoreApiServiceImpl extends StoreApiService {
@Override
public Response deleteOrder(String orderId ) throws NotFoundException {
public Response deleteOrder(String orderId
) throws NotFoundException {
// do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}
@ -29,12 +31,14 @@ public class StoreApiServiceImpl extends StoreApiService {
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}
@Override
public Response getOrderById(Long orderId ) throws NotFoundException {
public Response getOrderById(Long orderId
) throws NotFoundException {
// do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}
@Override
public Response placeOrder(Order body ) throws NotFoundException {
public Response placeOrder(Order body
) throws NotFoundException {
// do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}

View File

@ -11,7 +11,8 @@ import io.swagger.api.NotFoundException;
import java.io.InputStream;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.wso2.msf4j.formparam.FormDataParam;
import org.wso2.msf4j.formparam.FileInfo;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext;
@ -19,32 +20,39 @@ import javax.ws.rs.core.SecurityContext;
public class UserApiServiceImpl extends UserApiService {
@Override
public Response createUser(User body ) throws NotFoundException {
public Response createUser(User body
) throws NotFoundException {
// do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}
@Override
public Response createUsersWithArrayInput(List<User> body ) throws NotFoundException {
public Response createUsersWithArrayInput(List<User> body
) throws NotFoundException {
// do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}
@Override
public Response createUsersWithListInput(List<User> body ) throws NotFoundException {
public Response createUsersWithListInput(List<User> body
) throws NotFoundException {
// do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}
@Override
public Response deleteUser(String username ) throws NotFoundException {
public Response deleteUser(String username
) throws NotFoundException {
// do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}
@Override
public Response getUserByName(String username ) throws NotFoundException {
public Response getUserByName(String username
) throws NotFoundException {
// do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}
@Override
public Response loginUser(String username, String password ) throws NotFoundException {
public Response loginUser(String username
, String password
) throws NotFoundException {
// do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}
@ -54,7 +62,9 @@ public class UserApiServiceImpl extends UserApiService {
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}
@Override
public Response updateUser(String username, User body ) throws NotFoundException {
public Response updateUser(String username
, User body
) throws NotFoundException {
// do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}

View File

@ -8,6 +8,7 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Category", propOrder =

View File

@ -8,6 +8,7 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ModelApiResponse", propOrder =

View File

@ -8,6 +8,7 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Order", propOrder =
@ -31,10 +32,10 @@ public class Order {
private javax.xml.datatype.XMLGregorianCalendar shipDate = null;
@XmlType(name="StatusEnum")
@XmlEnum
@XmlEnum(String.class)
public enum StatusEnum {
PLACED(String.valueOf("placed")), APPROVED(String.valueOf("approved")), DELIVERED(String.valueOf("delivered"));
@XmlEnumValue("placed") PLACED(String.valueOf("placed")), @XmlEnumValue("approved") APPROVED(String.valueOf("approved")), @XmlEnumValue("delivered") DELIVERED(String.valueOf("delivered"));
private String value;
@ -47,8 +48,18 @@ public enum StatusEnum {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static StatusEnum fromValue(String v) {
return valueOf(v);
for (StatusEnum b : StatusEnum.values()) {
if (String.valueOf(b.value).equals(v)) {
return b;
}
}
return null;
}
}

View File

@ -12,6 +12,7 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Pet", propOrder =
@ -38,10 +39,10 @@ public class Pet {
private List<Tag> tags = new ArrayList<Tag>();
@XmlType(name="StatusEnum")
@XmlEnum
@XmlEnum(String.class)
public enum StatusEnum {
AVAILABLE(String.valueOf("available")), PENDING(String.valueOf("pending")), SOLD(String.valueOf("sold"));
@XmlEnumValue("available") AVAILABLE(String.valueOf("available")), @XmlEnumValue("pending") PENDING(String.valueOf("pending")), @XmlEnumValue("sold") SOLD(String.valueOf("sold"));
private String value;
@ -54,8 +55,18 @@ public enum StatusEnum {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static StatusEnum fromValue(String v) {
return valueOf(v);
for (StatusEnum b : StatusEnum.values()) {
if (String.valueOf(b.value).equals(v)) {
return b;
}
}
return null;
}
}

View File

@ -8,6 +8,7 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Tag", propOrder =

View File

@ -8,6 +8,7 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "User", propOrder =