Add sbt support for feign.

This commit is contained in:
clasnake 2016-06-04 21:51:49 +08:00
parent 503fb138f5
commit 4da829315f
29 changed files with 80 additions and 26 deletions

View File

@ -275,6 +275,8 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {
gradleWrapperPackage.replace( ".", File.separator ), "gradle-wrapper.properties") ); gradleWrapperPackage.replace( ".", File.separator ), "gradle-wrapper.properties") );
supportingFiles.add( new SupportingFile( "gradle-wrapper.jar", supportingFiles.add( new SupportingFile( "gradle-wrapper.jar",
gradleWrapperPackage.replace( ".", File.separator ), "gradle-wrapper.jar") ); gradleWrapperPackage.replace( ".", File.separator ), "gradle-wrapper.jar") );
// "build.sbt" is for development with SBT
supportingFiles.add(new SupportingFile("build.sbt.mustache", "", "build.sbt"));
} }
supportingFiles.add(new SupportingFile("auth/HttpBasicAuth.mustache", authFolder, "HttpBasicAuth.java")); supportingFiles.add(new SupportingFile("auth/HttpBasicAuth.mustache", authFolder, "HttpBasicAuth.java"));
supportingFiles.add(new SupportingFile("auth/ApiKeyAuth.mustache", authFolder, "ApiKeyAuth.java")); supportingFiles.add(new SupportingFile("auth/ApiKeyAuth.mustache", authFolder, "ApiKeyAuth.java"));

View File

@ -0,0 +1,26 @@
lazy val root = (project in file(".")).
settings(
organization := "{{groupId}}",
name := "{{artifactId}}",
version := "{{artifactVersion}}",
scalaVersion := "2.11.4",
scalacOptions ++= Seq("-feature"),
javacOptions in compile ++= Seq("-Xlint:deprecation"),
publishArtifact in (Compile, packageDoc) := false,
resolvers += Resolver.mavenLocal,
libraryDependencies ++= Seq(
"io.swagger" % "swagger-annotations" % "1.5.8" % "compile",
"com.netflix.feign" % "feign-core" % "8.16.0" % "compile",
"com.netflix.feign" % "feign-jackson" % "8.16.0" % "compile",
"com.netflix.feign" % "feign-slf4j" % "8.16.0" % "compile",
"com.fasterxml.jackson.core" % "jackson-core" % "2.7.0" % "compile",
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.7.0" % "compile",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.7.0" % "compile",
"com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.1.5" % "compile",
"joda-time" % "joda-time" % "2.9.3" % "compile",
"org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile",
"com.brsanthu" % "migbase64" % "2.2" % "compile",
"junit" % "junit" % "4.12" % "testCompile",
"com.novocode" % "junit-interface" % "0.10" % "test"
)
)

View File

@ -0,0 +1,26 @@
lazy val root = (project in file(".")).
settings(
organization := "io.swagger",
name := "swagger-petstore-feign",
version := "1.0.0",
scalaVersion := "2.11.4",
scalacOptions ++= Seq("-feature"),
javacOptions in compile ++= Seq("-Xlint:deprecation"),
publishArtifact in (Compile, packageDoc) := false,
resolvers += Resolver.mavenLocal,
libraryDependencies ++= Seq(
"io.swagger" % "swagger-annotations" % "1.5.8" % "compile",
"com.netflix.feign" % "feign-core" % "8.16.0" % "compile",
"com.netflix.feign" % "feign-jackson" % "8.16.0" % "compile",
"com.netflix.feign" % "feign-slf4j" % "8.16.0" % "compile",
"com.fasterxml.jackson.core" % "jackson-core" % "2.7.0" % "compile",
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.7.0" % "compile",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.7.0" % "compile",
"com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.1.5" % "compile",
"joda-time" % "joda-time" % "2.9.3" % "compile",
"org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile",
"com.brsanthu" % "migbase64" % "2.2" % "compile",
"junit" % "junit" % "4.12" % "test",
"com.novocode" % "junit-interface" % "0.10" % "test"
)
)

View File

@ -14,7 +14,7 @@ import feign.codec.EncodeException;
import feign.codec.Encoder; import feign.codec.Encoder;
import feign.RequestTemplate; import feign.RequestTemplate;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00")
public class FormAwareEncoder implements Encoder { public class FormAwareEncoder implements Encoder {
public static final String UTF_8 = "utf-8"; public static final String UTF_8 = "utf-8";
private static final String LINE_FEED = "\r\n"; private static final String LINE_FEED = "\r\n";

View File

@ -1,6 +1,6 @@
package io.swagger.client; package io.swagger.client;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00")
public class StringUtil { public class StringUtil {
/** /**
* Check if the given array contains the given value (with case-insensitive comparison). * Check if the given array contains the given value (with case-insensitive comparison).

View File

@ -11,7 +11,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import feign.*; import feign.*;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00")
public interface FakeApi extends ApiClient.Api { public interface FakeApi extends ApiClient.Api {

View File

@ -12,7 +12,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import feign.*; import feign.*;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00")
public interface PetApi extends ApiClient.Api { public interface PetApi extends ApiClient.Api {

View File

@ -10,7 +10,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import feign.*; import feign.*;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00")
public interface StoreApi extends ApiClient.Api { public interface StoreApi extends ApiClient.Api {

View File

@ -10,7 +10,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import feign.*; import feign.*;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00")
public interface UserApi extends ApiClient.Api { public interface UserApi extends ApiClient.Api {

View File

@ -13,7 +13,7 @@ import java.util.Map;
/** /**
* AdditionalPropertiesClass * AdditionalPropertiesClass
*/ */
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00")
public class AdditionalPropertiesClass { public class AdditionalPropertiesClass {
private Map<String, String> mapProperty = new HashMap<String, String>(); private Map<String, String> mapProperty = new HashMap<String, String>();

View File

@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty;
/** /**
* Animal * Animal
*/ */
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00")
public class Animal { public class Animal {
private String className = null; private String className = null;

View File

@ -10,7 +10,7 @@ import java.util.List;
/** /**
* AnimalFarm * AnimalFarm
*/ */
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00")
public class AnimalFarm extends ArrayList<Animal> { public class AnimalFarm extends ArrayList<Animal> {

View File

@ -12,7 +12,7 @@ import java.util.List;
/** /**
* ArrayTest * ArrayTest
*/ */
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00")
public class ArrayTest { public class ArrayTest {
private List<String> arrayOfString = new ArrayList<String>(); private List<String> arrayOfString = new ArrayList<String>();

View File

@ -11,7 +11,7 @@ import io.swagger.client.model.Animal;
/** /**
* Cat * Cat
*/ */
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00")
public class Cat extends Animal { public class Cat extends Animal {
private String className = null; private String className = null;

View File

@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty;
/** /**
* Category * Category
*/ */
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00")
public class Category { public class Category {
private Long id = null; private Long id = null;

View File

@ -11,7 +11,7 @@ import io.swagger.client.model.Animal;
/** /**
* Dog * Dog
*/ */
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00")
public class Dog extends Animal { public class Dog extends Animal {
private String className = null; private String className = null;

View File

@ -11,7 +11,7 @@ import io.swagger.annotations.ApiModelProperty;
/** /**
* EnumTest * EnumTest
*/ */
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00")
public class EnumTest { public class EnumTest {

View File

@ -12,7 +12,7 @@ import java.util.Date;
/** /**
* FormatTest * FormatTest
*/ */
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00")
public class FormatTest { public class FormatTest {
private Integer integer = null; private Integer integer = null;

View File

@ -15,7 +15,7 @@ import java.util.Map;
/** /**
* MixedPropertiesAndAdditionalPropertiesClass * MixedPropertiesAndAdditionalPropertiesClass
*/ */
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00")
public class MixedPropertiesAndAdditionalPropertiesClass { public class MixedPropertiesAndAdditionalPropertiesClass {
private String uuid = null; private String uuid = null;

View File

@ -11,7 +11,7 @@ import io.swagger.annotations.ApiModelProperty;
* Model for testing model name starting with number * Model for testing model name starting with number
*/ */
@ApiModel(description = "Model for testing model name starting with number") @ApiModel(description = "Model for testing model name starting with number")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00")
public class Model200Response { public class Model200Response {
private Integer name = null; private Integer name = null;

View File

@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty;
/** /**
* ModelApiResponse * ModelApiResponse
*/ */
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00")
public class ModelApiResponse { public class ModelApiResponse {
private Integer code = null; private Integer code = null;

View File

@ -11,7 +11,7 @@ import io.swagger.annotations.ApiModelProperty;
* Model for testing reserved words * Model for testing reserved words
*/ */
@ApiModel(description = "Model for testing reserved words") @ApiModel(description = "Model for testing reserved words")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00")
public class ModelReturn { public class ModelReturn {
private Integer _return = null; private Integer _return = null;

View File

@ -11,7 +11,7 @@ import io.swagger.annotations.ApiModelProperty;
* Model for testing model name same as property name * Model for testing model name same as property name
*/ */
@ApiModel(description = "Model for testing model name same as property name") @ApiModel(description = "Model for testing model name same as property name")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00")
public class Name { public class Name {
private Integer name = null; private Integer name = null;

View File

@ -12,7 +12,7 @@ import java.util.Date;
/** /**
* Order * Order
*/ */
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00")
public class Order { public class Order {
private Long id = null; private Long id = null;

View File

@ -15,7 +15,7 @@ import java.util.List;
/** /**
* Pet * Pet
*/ */
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00")
public class Pet { public class Pet {
private Long id = null; private Long id = null;

View File

@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty;
/** /**
* ReadOnlyFirst * ReadOnlyFirst
*/ */
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00")
public class ReadOnlyFirst { public class ReadOnlyFirst {
private String bar = null; private String bar = null;

View File

@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty;
/** /**
* SpecialModelName * SpecialModelName
*/ */
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00")
public class SpecialModelName { public class SpecialModelName {
private Long specialPropertyName = null; private Long specialPropertyName = null;

View File

@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty;
/** /**
* Tag * Tag
*/ */
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00")
public class Tag { public class Tag {
private Long id = null; private Long id = null;

View File

@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty;
/** /**
* User * User
*/ */
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-05-31T18:50:49.249+02:00") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-04T21:21:36.995+08:00")
public class User { public class User {
private Long id = null; private Long id = null;