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
2 changes: 1 addition & 1 deletion bin/java-petstore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ fi

# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l java -o samples/client/petstore/java/default"
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l java -o samples/client/petstore/java/default -DhideGenerationTimestamp=true"

java $JAVA_OPTS -jar $executable $ags
2 changes: 1 addition & 1 deletion bin/jaxrs-cxf-petstore-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ fi

# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaJaxRS -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l jaxrs-cxf -o samples/server/petstore/jaxrs-cxf"
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaJaxRS -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l jaxrs-cxf -o samples/server/petstore/jaxrs-cxf -DhideGenerationTimestamp=true"

java $JAVA_OPTS -jar $executable $ags
2 changes: 1 addition & 1 deletion bin/jaxrs-petstore-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ fi

# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaJaxRS -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l jaxrs -o samples/server/petstore/jaxrs"
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaJaxRS -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l jaxrs -o samples/server/petstore/jaxrs -DhideGenerationTimestamp=true"

java $JAVA_OPTS -jar $executable $ags
2 changes: 1 addition & 1 deletion bin/jaxrs-resteasy-petstore-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ fi

# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaJaxRS -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l jaxrs-resteasy -o samples/server/petstore/jaxrs-resteasy"
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaJaxRS -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l jaxrs-resteasy -o samples/server/petstore/jaxrs-resteasy -DhideGenerationTimestamp=true"

java $JAVA_OPTS -jar $executable $ags
2 changes: 1 addition & 1 deletion bin/jersey2-petstore-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ fi

# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaJaxRS -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l jaxrs -o samples/server/petstore/jersey2 --library=jersey2"
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaJaxRS -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l jaxrs -o samples/server/petstore/jersey2 --library=jersey2 -DhideGenerationTimestamp=true"

java $JAVA_OPTS -jar $executable $ags
2 changes: 1 addition & 1 deletion bin/nodejs-petstore-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ fi

# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l nodejs-server -o samples/server/petstore/nodejs"
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l nodejs-server -o samples/server/petstore/nodejs"

java $JAVA_OPTS -Dservice -jar $executable $ags
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {
protected Boolean serializableModel = false;
protected boolean serializeBigDecimalAsString = false;
protected boolean useRxJava = false;
protected boolean hideGenerationTimestamp = false;


public JavaClientCodegen() {
super();
Expand Down Expand Up @@ -99,6 +101,7 @@ public JavaClientCodegen() {
.SERIALIZE_BIG_DECIMAL_AS_STRING_DESC));
cliOptions.add(CliOption.newBoolean(FULL_JAVA_UTIL, "whether to use fully qualified name for classes under java.util"));
cliOptions.add(CliOption.newBoolean(USE_RX_JAVA, "Whether to use the RxJava adapter with the retrofit2 library."));
cliOptions.add(new CliOption("hideGenerationTimestamp", "hides the timestamp when files were generated"));

supportedLibraries.put(DEFAULT_LIBRARY, "HTTP client: Jersey client 1.18. JSON processing: Jackson 2.4.2");
supportedLibraries.put("feign", "HTTP client: Netflix Feign 8.1.1");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import java.util.*;

public class JavaJerseyServerCodegen extends AbstractJavaJAXRSServerCodegen {
boolean showGenerationTimestamp = false;

public JavaJerseyServerCodegen() {
super();

Expand Down Expand Up @@ -48,7 +46,6 @@ public JavaJerseyServerCodegen() {
cliOptions.add(library);
cliOptions.add(new CliOption(CodegenConstants.IMPL_FOLDER, CodegenConstants.IMPL_FOLDER_DESC));
cliOptions.add(new CliOption("title", "a title describing the application"));
cliOptions.add(new CliOption("showGenerationTimestamp", "shows the timestamp when files were generated"));
}

@Override
Expand Down Expand Up @@ -152,7 +149,7 @@ public void addOperationToGroup(String tag, String resourcePath, Operation opera
co.baseName = basePath;
}

public void showGenerationTimestamp(boolean showGenerationTimestamp) {
this.showGenerationTimestamp = showGenerationTimestamp;
public void hideGenerationTimestamp(boolean hideGenerationTimestamp) {
this.hideGenerationTimestamp = hideGenerationTimestamp;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,9 @@ public void preprocessSwagger(Swagger swagger) {
if(operation.getOperationId() == null) {
operation.setOperationId(getOrGenerateOperationId(operation, pathname, method.toString()));
}
operation.getVendorExtensions().put("x-swagger-router-controller", toApiName(tag));
if(operation.getVendorExtensions().get("x-swagger-router-controller") == null) {
operation.getVendorExtensions().put("x-swagger-router-controller", sanitizeTag(tag));
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@javax.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}")
{{^hideGenerationTimestamp}}@javax.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}"){{/hideGenerationTimestamp}}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{#showGenerationTimestamps}}@javax.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}"){{/showGenerationTimestamps}}
{{^hideGenerationTimestamp}}@javax.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}"){{/hideGenerationTimestamp}}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{#showGenerationTimestamps}}@javax.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}"){{/showGenerationTimestamps}}
{{^hideGenerationTimestamp}}@javax.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}"){{/hideGenerationTimestamp}}
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package io.swagger.codegen.options;

import io.swagger.codegen.Codegen;
import com.google.common.collect.ImmutableMap;
import io.swagger.codegen.CodegenConstants;
import io.swagger.codegen.languages.JavaClientCodegen;

import com.google.common.collect.ImmutableMap;

import java.util.Map;

public class JavaOptionsProvider implements OptionsProvider {
Expand Down Expand Up @@ -46,6 +44,7 @@ public JavaOptionsProvider() {
.put(CodegenConstants.SERIALIZE_BIG_DECIMAL_AS_STRING, "true")
.put(JavaClientCodegen.USE_RX_JAVA, "false")
.put(JavaClientCodegen.DATE_LIBRARY, "joda")
.put("hideGenerationTimestamp", "true")
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ public Map<String, String> createOptions() {
builder.putAll(options)
.put(CodegenConstants.IMPL_FOLDER, IMPL_FOLDER_VALUE)
//.put(JavaJaxRSJersey1ServerCodegen.DATE_LIBRARY, "joda") //java.lang.IllegalArgumentException: Multiple entries with same key: dateLibrary=joda and dateLibrary=joda
.put("title", "Test title")
.put("showGenerationTimestamp", "true");
.put("title", "Test title");

return builder.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.util.Map;
import java.util.List;

@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T10:45:51.189+08:00")

public class ApiException extends Exception {
private int code = 0;
private Map<String, List<String>> responseHeaders = null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.swagger.client;

@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T10:45:51.189+08:00")

public class Configuration {
private static ApiClient defaultApiClient = new ApiClient();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.swagger.client;

@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T10:45:51.189+08:00")

public class Pair {
private String name = "";
private String value = "";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.swagger.client;

@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T10:45:51.189+08:00")

public class StringUtil {
/**
* Check if the given array contains the given value (with case-insensitive comparison).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import java.util.List;
import java.util.Map;

@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T16:01:11.428+08:00")

public class PetApi {
private ApiClient apiClient;

Expand Down Expand Up @@ -294,7 +294,7 @@ public Pet getPetById(Long petId) throws ApiException {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

String[] localVarAuthNames = new String[] { "petstore_auth", "api_key" };
String[] localVarAuthNames = new String[] { "api_key", "petstore_auth" };


GenericType<Pet> localVarReturnType = new GenericType<Pet>() {};
Expand Down Expand Up @@ -342,7 +342,7 @@ public InlineResponse200 getPetByIdInObject(Long petId) throws ApiException {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

String[] localVarAuthNames = new String[] { "petstore_auth", "api_key" };
String[] localVarAuthNames = new String[] { "api_key", "petstore_auth" };


GenericType<InlineResponse200> localVarReturnType = new GenericType<InlineResponse200>() {};
Expand Down Expand Up @@ -390,7 +390,7 @@ public byte[] petPetIdtestingByteArraytrueGet(Long petId) throws ApiException {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

String[] localVarAuthNames = new String[] { "petstore_auth", "api_key" };
String[] localVarAuthNames = new String[] { "api_key", "petstore_auth" };


GenericType<byte[]> localVarReturnType = new GenericType<byte[]>() {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import java.util.List;
import java.util.Map;

@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T16:01:11.428+08:00")

public class StoreApi {
private ApiClient apiClient;

Expand Down Expand Up @@ -247,7 +247,7 @@ public Order getOrderById(String orderId) throws ApiException {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

String[] localVarAuthNames = new String[] { "test_api_key_query", "test_api_key_header" };
String[] localVarAuthNames = new String[] { "test_api_key_header", "test_api_key_query" };


GenericType<Order> localVarReturnType = new GenericType<Order>() {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import java.util.List;
import java.util.Map;

@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T16:01:11.428+08:00")

public class UserApi {
private ApiClient apiClient;

Expand Down Expand Up @@ -204,7 +204,7 @@ public void deleteUser(String username) throws ApiException {
/**
* Get user by user name
*
* @param username The name that needs to be fetched. Use user1 for testing. (required)
* @param username The name that needs to be fetched. Use user1 for testing. (required)
* @return User
* @throws ApiException if fails to make API call
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import java.util.Map;
import java.util.List;

@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T10:45:51.189+08:00")

public class ApiKeyAuth implements Authentication {
private final String location;
private final String paramName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import java.io.UnsupportedEncodingException;

@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T10:45:51.189+08:00")

public class HttpBasicAuth implements Authentication {
private String username;
private String password;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import java.util.Map;
import java.util.List;

@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T10:45:51.189+08:00")

public class OAuth implements Authentication {
private String accessToken;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@



@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T10:45:51.189+08:00")

public class Category {

private Long id = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@



@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T10:45:51.189+08:00")

public class InlineResponse200 {

private List<Tag> tags = new ArrayList<Tag>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@



@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T10:45:51.189+08:00")

public class Model200Response {

private Integer name = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@



@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T10:45:51.189+08:00")

public class ModelReturn {

private Integer _return = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@



@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T10:45:51.189+08:00")

public class Name {

private Integer name = null;
private Integer snakeCase = null;


/**
Expand All @@ -32,6 +33,23 @@ public void setName(Integer name) {
}


/**
**/
public Name snakeCase(Integer snakeCase) {
this.snakeCase = snakeCase;
return this;
}

@ApiModelProperty(example = "null", value = "")
@JsonProperty("snake_case")
public Integer getSnakeCase() {
return snakeCase;
}
public void setSnakeCase(Integer snakeCase) {
this.snakeCase = snakeCase;
}



@Override
public boolean equals(java.lang.Object o) {
Expand All @@ -42,12 +60,13 @@ public boolean equals(java.lang.Object o) {
return false;
}
Name name = (Name) o;
return Objects.equals(this.name, name.name);
return Objects.equals(this.name, name.name) &&
Objects.equals(this.snakeCase, name.snakeCase);
}

@Override
public int hashCode() {
return Objects.hash(name);
return Objects.hash(name, snakeCase);
}

@Override
Expand All @@ -56,6 +75,7 @@ public String toString() {
sb.append("class Name {\n");

sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" snakeCase: ").append(toIndentedString(snakeCase)).append("\n");
sb.append("}");
return sb.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@



@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T10:45:51.189+08:00")

public class Order {

private Long id = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@



@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T10:45:51.189+08:00")

public class Pet {

private Long id = null;
Expand Down
Loading