Giter Site home page Giter Site logo

thebignet / swagger-codegen-gradle-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from garethjevans/swagger-codegen-maven-plugin

41.0 4.0 26.0 161 KB

A Gradle plugin to support the swagger code generation project

License: MIT License

Groovy 100.00%

swagger-codegen-gradle-plugin's Introduction

swagger-codegen-gradle-plugin

Build Status

A Gradle plugin to support the swagger code generation project

[DEPRECATED] !!!

see the swagger-codegen-gradle-plugin-example for creating a Gradle task to generate code with Swagger Codegen.

Usage

see the swagger-codegen-gradle-plugin-example, or:

Here is an example of how to use the plugin in a build.gradle file

plugins {
    id 'org.detoeuf.swagger-codegen' version '1.7.4'
    id 'java'
}

apply plugin: 'org.detoeuf.swagger-codegen'

repositories {
    mavenCentral()
    jcenter()
}

swagger {
    inputSpec = 'http://petstore.swagger.io/v2/swagger.json'
    outputDir = file('build/swagger')
    lang = 'java'

    additionalProperties = [
            'invokerPackage'   : 'io.swagger.petstore.client',
            'modelPackage'     : 'io.swagger.petstore.client.model',
            'apiPackage'       : 'io.swagger.petstore.client.api',
            'dateLibrary'      : 'java8'
    ]
    importMappings = [
            'Dog': 'io.swagger.petstore.client.model.Dog'
    ]
}

sourceSets {
    swagger {
        java {
            srcDir file("${project.buildDir.path}/swagger/src/main/java")
        }
    }
}

classes.dependsOn('swagger')

ext {
    spring_boot_version = '1.5.6.RELEASE'
    jackson_version = '2.4.2'
    jersey_version = '1.18'
    jodatime_version = '2.3'
    junit_version = '4.8.1'
}

dependencies {
    swaggerCompile "org.springframework.boot:spring-boot-starter-web:$spring_boot_version"
    swaggerCompile 'io.swagger:swagger-annotations:1.5.16'
    swaggerCompile 'com.squareup.okhttp:okhttp:2.7.5'
    swaggerCompile 'com.squareup.okhttp:logging-interceptor:2.7.5'
    swaggerCompile 'com.google.code.gson:gson:2.8.1'

    compile sourceSets.swagger.output

    compile "com.sun.jersey:jersey-client:$jersey_version"
    compile "com.sun.jersey.contribs:jersey-multipart:$jersey_version"
    compile "com.fasterxml.jackson.core:jackson-core:$jackson_version"
    compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
    compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
    compile "com.fasterxml.jackson.datatype:jackson-datatype-joda:2.1.5"
    compile "joda-time:joda-time:$jodatime_version"
    compile 'io.swagger:swagger-codegen:2.2.3'

    testCompile "junit:junit:$junit_version"

    runtime 'com.squareup.okhttp:okhttp:2.7.5'
    runtime 'com.squareup.okhttp:logging-interceptor:2.7.5'
    runtime 'com.google.code.gson:gson:2.8.1'
}

Launch with:

gradle swagger

Configuration parameters

the swagger {} configuration is passed to CodegenConfigurator.java

Dynamic properties

Some Swagger codegen configurations will contain extra properties that are not part of the io.swagger.codegen.CodegenConfig interface. For example there is the sourceFolder property that is only applicable if using jaxrs-spec as the value of the lang property. In order to set such properties, we should use the dynamicProperty method inside the swagger {} configuration as shown below.

swagger {
    lang = 'jaxrs-spec'

    addDynamicProperty 'sourceFolder', 'src/swagger/java'

    additionalProperties = [
        ...
    ]
    systemProperties = [
        ...
    ]
}

… to be documented …

deprecation warning

the old behaviour had a custom plugin for this swagger config as seen below

  • inputSpec - :check:
  • outputDir - was: output
  • lang - was: language
  • additionalProperties - sets additional properties that can be referenced by the mustache templates in the format of name=value,name=value. See Customizing the generator for list of parameters

new settings possible

no longer included

  • models - have a look at the systemProperties section
  • apis - selective generation of apis. Leave blank to generate apis only
  • supportingFiles - selective generation of supporting files. Leave blank to generate supporting files only

no substituion for:

  • cleanOutputDir - now, configured by configuring the task directly:
    tasks.getByName("swagger") {
        cleanOutputDir = false
    }

swagger-codegen-gradle-plugin's People

Contributors

blub0hr avatar dcoraboeuf avatar garethjevans avatar jlleitschuh avatar matthewrj avatar nightapes avatar pbouillet avatar radarsh avatar suvodeep-pyne avatar thebignet avatar vburckhardt avatar vineethtw avatar vorburger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

swagger-codegen-gradle-plugin's Issues

Multiple Tasks

Is there a way to execute the swagger task multiple times with different configurations?

I'm migrating from a maven project where I used multliple execution blocks to generate spring boot server stubs as well as jersey2 client classes. Is there a way to achieve the same thing with this gradle plugin?

Not specifying additionalProperties throws error

If you don't specify any additional properties, the following error is thrown:

Ambiguous method overloading for method java.util.HashMap#putAll.
Cannot resolve which method to invoke for [null] due to overlapping prototypes between:
        [interface java.util.Map]
        [interface java.util.Collection]

ignoreFileOverride properties dont work for me

swager-codegen have ignoreFileOverride option to set file .swagger-codegen-ignore (Use this file to prevent files from being overwritten by the generator)

swagger {
    inputSpec = 'http://localhost:8080/v1/swagger.json'

    outputDir = "${rootDir}/swagger-client"
    lang = 'java'

    additionalProperties = [
            'library'           : 'retrofit2',
            'useRxJava2'        : 'true',
            'useGzipFeature'    : 'true',
            'parcelableModel'   : 'true',
            'serializableModel' : 'true',
            'dateLibrary'       : 'java7',
            'ignoreFileOverride': "${projectDir}/.swagger-codegen-ignore"
    ]
}

If I add this all files are not modified

tasks.getByName("swagger") {
    cleanOutputDir = false
}

Can I have .swagger-codegen-ignore ?

[FeatureRequest] Support for missing CodeGen options like TypeMappings

Would be great to discuss some enhancement like: Support For TypeMappings

Perhaps, it's easy to just add any options https://github.com/swagger-api/swagger-codegen/blob/v2.2.1/modules/swagger-codegen/src/main/java/io/swagger/codegen/config/CodegenConfigurator.java

what is inpossible for me atm:

    CodegenConfigurator configurator = new CodegenConfigurator()
    // ...
    configurator.setTypeMappings([
            "DateTime": "java.time.Instant"
    ])
    configurator.setImportMappings([
            "Instant": "java.time.Instant"
    ])

Pass swagger-codegen version as argument

It would be great if we could pass in the version of swagger-codegen as an argument to the plugin.
We have problems with v2.2.1 and are still using v 2.1.6, but the gradle plugin is hard-coded to 2.2.1

Unsupported major.minor version 52.0

When trying to include this plugin (v1.3 and v1.4) with Gradle 2.10 and Java 7 (1.7.0_80), I get the following error:

java.lang.UnsupportedClassVersionError: org/detoeuf/SwaggerCodeGenPlugin : Unsupported major.minor version 52.0

My understanding is that this means the plugin was built with an incompatible JDK, but a Gradle plugin should definitely be compatible with Java 7.

Question about configuration (documentation issue?)

It would be great to have some more examples of configuration. In my case I'm getting properly generated files but I can't figure out how to get rid of the @ApiModelProperty annotations

For example:

   /**
   * Get id
   * @return id
  **/
  @ApiModelProperty(example = "null", value = "")
  public String getId() {
    return id;
  }

I also can't get verbose to work.

Thanks for any help.

JAX-RS server stubs generation?

How can I generate Java JAX-RS server stubs? The following does not work in this plugin, but I believe is the correct:

swagger {
    ...
    language = 'jaxrs-spec'
   ...
}

swaggerInputSpec does not get resolved correctly in a multi build setup

Hi,
when I specify the swaggerInputSpec as a relative path in a sub project and start the build from the root project then the path is not correctly resolved. The problem should be in line 19 of https://github.com/thebignet/swagger-codegen-gradle-plugin/blob/master/src/main/groovy/org/detoeuf/SwaggerCodeGenTask.groovy. The path should be resolved relative to project.projectDir (https://docs.gradle.org/current/dsl/org.gradle.api.Project.html#org.gradle.api.Project:projectDir).

Configurable configPackage setting?

Hello,

I am very happy to find this plugin!
Is there an easy way already to use a custom name for the configPackage?

I use your plugin to generate Spring MVC REST server-side stubs. Via command line this means:

java -jar /swagger-codegen-cli-2.1.6.jar generate -i my_api.yaml -l spring-mvc -o ./my_server -c server-config.json

Using this option I can specify the configPackage using:

{
  "configPackage": generated.config",
  "apiPackage": "generated.api",
  "modelPackage": "generated.domain"
}

Another option is to pass it via command line JVM arg:

java -jar /swagger-codegen-cli-2.1.6.jar generate -i my_api.yaml -l spring-mvc -o ./my_server -c server-config.json -DconfigPackage=my.config.package

otherwise it uses the hardcoded package name: io.swagger.configuration

I tried passing the JVM arg via Gradle but that was not picked up.

Thanks!

License?

What is this project Licensed under?

Build dependency

I didn't expect that the 'build' task would run the swagger task.
This causes a problem since I am unable to consistently build the swagger target.
Is there a way to make this configurable? I am new to gradle plugins.

Within IntelliJ gradle plugin, my swagger target fails when using a local file for the 'inputSpec' however, if I use an http source for the 'inputSpec' it works.

Using gradle from the command line works fine either way.

Publish 1.6.3 to plugins.gradle.org

Running the example code, I get the error:

Plugin [id: 'org.detoeuf.swagger-codegen', version: '1.6.3'] was not found in any of the following sources:

- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Gradle Central Plugin Repository (plugin 'org.detoeuf.swagger-codegen' has no version '1.6.3' - see https://plugins.gradle.org/plugin/org.detoeuf.swagger-codegen for available versions)

Looking at https://plugins.gradle.org/plugin/org.detoeuf.swagger-codegen indeed the last version seems to be 1.6.2; but I need 1.6.3 for the fix #21 .

Could you please publish the new version or am I doing something wrong?

@srehlig FYI!

Plugin tries to clean project dir

it is wrong behaviour as we have .swagger-codegen-ignore to not iverride files and handy gradle tasks to implement it in separatly

here the smarty code:

class SwaggerCodeGenTask extends DefaultTask {

    boolean cleanOutputDir = true

Please make it configurable.

No "Issues" tab for swagger-codegen-gradle-plugin-example

I wanted to report an issue with https://github.com/thebignet/swagger-codegen-gradle-plugin-example but I see no "Issues" tab there. Is there a reason for it?

For now, I'll describe my issue with the example here but I'll be happy to create it there once it's possible.

Firstly, if I clone the example and run gradle build, it fails because the test contained within fails. I personally don't really care about the test, so I commented it out; then the build succeeds.

Secondly, and that's more important to me, this creates swagger-codegen-gradle-plugin-example.jar but the file is virtually empty (it only contains Manifest). The generated and compiled classes are not contained within it. This means I can't use this JAR as a dependency for other modules.

Version 1.6.3 at the plugin repo doesn't match the example

In my build.gradle i have:

plugins {
    id 'org.detoeuf.swagger-codegen' version '1.6.3'
}

and then following the readme I have:

swagger {
    output = 'build/swagger'
    lang = 'spring-mvc'
}

but I get this error:

A problem occurred evaluating root project 'cni_android_mdm'.
> Could not set unknown property 'outputDir' for object of type org.detoeuf.SwaggerPluginExtension.

If I change output to outputDir, and lang to language, the errors go away.

Perhaps related, I don't see a 1.6.3 tag in the git repo.

Thanks for your help.

-DB

swaggerOutput vs. swaggerSrc option

What is the purpose of having 2 configurable options for the output directory?

I was getting the sources generated in 2 locations: under src/swagger and the directory I configured for swaggerOutput while using language=java with this plugin.

In the plugin documentation I found:

swaggerOutput - target output path (default is ${project.build.directory}/generated-sources/swagger)
swaggerSrc - target source directory (default is ${project.root.directory}/src/swagger). This directory should be added as as source set

And in the sources I see:

    @TaskAction
    def swaggerCodeGen() {
       ...
        new DefaultGenerator().opts(input).generate()
        project.copy {
            from outputDir+'/src/main/'+project.swaggerLanguage
            into srcDir+'/'+project.swaggerLanguage
        }
    }

Is there any particular reason for copying the sources and not generating them directly in the location configured under swaggerOutput, maybe a workaround to avoid the java (swagger language name) from the generated path?

My workaround to the problem of sources being generated in 2 locations is now is that I configure swaggerSrc only (thus leaving the default location for swaggerOutput) and just don't include the sources from the swaggerOutput location.

When using language=spring-mvc I did not have this problem while only configuring the swaggerOutput option. This happens because the above Groovy snippet does not find a source folder and thus the destination folder does not get created.

The plain library accepts a single parameter for the generation location and I think it would be most intuitive to have the same behavior from the plugin.

java -jar swagger-codegen-cli-2.1.6.jar generate -i my_api.yaml -l java -o ./my-api-client

which would naturally translate to swaggerOutput=my-api-client

My suggestion would be to remove the option swaggerSrc and generate the code to the swaggerOutput folder directly and then suggest users to add the $swaggerOuput/src/main/java folder as extra source set.

Simple example (below chapter Usage) failes...

... with
`Execution failed for task ':swagger'.

Can't load config class with name spring-mvc
Caused by: java.lang.RuntimeException: Can't load config class with name spring-mvc
at org.detoeuf.SwaggerCodeGenTask.forName(SwaggerCodeGenTask.groovy:54)
`

Why?

Generated Code Output Dir

Hello,

I'm using swagger to generate my backend webservice.
Currently I'm struggling with the configuration of the outout directory and the additional properties package declaration.

My current config:

inputSpec = "${projectDir}/src/main/resources/webservice.yml"
outputDir = "${projectDir}/src/main/java/com/mydomain/tool/rest"
lang = "spring"
additionalProperties = [
            'invokerPackage'   : 'com.mydomain.tool.rest',
            'modelPackage'     : 'com.mydomain.tool.rest.model',
            'apiPackage'       : 'com.mydomain.tool.rest.api',
            'dateLibrary'      : 'java8'
    ]
systemProperties = [
            'apis' : '',
            'models' : ''
    ]

After running the :swagger task, the code will be generated in:
src/main/java/com/mydomain/tool/rest/src/main/java/com/mydomain/tool/rest

If I change the outputDir to
outputDir = "${projectDir}/src/main/java"
The whole directory will be cleansed before the code is generated and therefore existing code is wiped out. Result ist generated in
src/main/java/src/main/java/com/mydomain/tool/rest

What would be the right configuration for the outputDir??

Incomplete codegen for java + okhttp and java + retrofit2

The list could be longer, I don't really know if I'm doing something wrong with the plugin but it worked fine for spring.

When I use this plugin (1.6.2) with java and okhttp, I find it doesn't generate many of the classes that are generated using the tool directly, including APIClient class, needed at compile time. Similar with retrofit.

Is this something it's going to be fixed with 1.6.3?

my code (unfortunately I cannot share the swagger file)

swagger {
inputSpec = "${buildDir}/swagger-files/account-service-api-${supported_api_version}.yaml"

output = 'build/swagger'
language = 'java'

additionalProperties = [
        'dateLibrary'      : 'java8',
        'library' : 'okhttp-gson'
]
apis = ''
models = ''

}

I tried with and without api and domain packages, no difference.

Missing classes for okhttp.. APIClient, APIException, Pair... all of them generated one level above model package by the codegen tool.

[main] INFO io.swagger.codegen.AbstractGenerator - writing file /Users/alberto/code/account-service/client/./src/main/java/io/swagger/client/ApiException.java [main] INFO io.swagger.codegen.AbstractGenerator - writing file /Users/alberto/code/account-service/client/./src/main/java/io/swagger/client/Configuration.java [main] INFO io.swagger.codegen.AbstractGenerator - writing file /Users/alberto/code/account-service/client/./src/main/java/io/swagger/client/Pair.java [main] INFO io.swagger.codegen.AbstractGenerator - writing file /Users/alberto/code/account-service/client/./src/main/java/io/swagger/client/auth/Authentication.java [main] INFO io.swagger.codegen.AbstractGenerator - writing file /Users/alberto/code/account-service/client/./src/main/java/io/swagger/client/ApiCallback.java [main] INFO io.swagger.codegen.AbstractGenerator - writing file /Users/alberto/code/account-service/client/./src/main/java/io/swagger/client/ApiResponse.java [main] INFO io.swagger.codegen.AbstractGenerator - writing file /Users/alberto/code/account-service/client/./src/main/java/io/swagger/client/JSON.java [main] INFO io.swagger.codegen.AbstractGenerator - writing file /Users/alberto/code/account-service/client/./src/main/java/io/swagger/client/ProgressRequestBody.java [main] INFO io.swagger.codegen.AbstractGenerator - writing file /Users/alberto/code/account-service/client/./src/main/java/io/swagger/client/ProgressResponseBody.java

Other missing classes, the ones under auth

[main] INFO io.swagger.codegen.AbstractGenerator - writing file /Users/alberto/code/account-service/client/./src/main/java/io/swagger/client/ApiClient.java [main] INFO io.swagger.codegen.AbstractGenerator - writing file /Users/alberto/code/account-service/client/./src/main/java/io/swagger/client/StringUtil.java [main] INFO io.swagger.codegen.AbstractGenerator - writing file /Users/alberto/code/account-service/client/./src/main/java/io/swagger/client/auth/HttpBasicAuth.java [main] INFO io.swagger.codegen.AbstractGenerator - writing file /Users/alberto/code/account-service/client/./src/main/java/io/swagger/client/auth/ApiKeyAuth.java [main] INFO io.swagger.codegen.AbstractGenerator - writing file /Users/alberto/code/account-service/client/./src/main/java/io/swagger/client/auth/OAuth.java [main] INFO io.swagger.codegen.AbstractGenerator - writing file /Users/alberto/code/account-service/client/./src/main/java/io/swagger/client/auth/OAuthFlow.java

Hopefully you'll at least respond soon

Thanks

Alberto Navarro

Published location

I'm writing a custom plugin and want to declare a runtime dependency on this library. Is it published anywhere? Maven Central has no record of it. I tried the following:

dependencies {
  runtime "org.detoeuf:swagger-codegen-plugin:1.6.3"
}

Generated classes fail to compile due to missing io.swagger.client.* dependency if swagger codegen isn't use in default sourceSet

for a setup where swagger client and code gen is only used in test:

plugins {
    id 'java'
    id 'org.detoeuf.swagger-codegen' version '1.6.0'
}

ext {
    swaggerDir = "${project.buildDir.path}/generated-test-sources/swagger"
}

sourceSets {
    test {
        java {
            srcDir("${swaggerDir}/src/main/java")
        }
    }
}

dependencies {
    testCompile 'io.swagger:swagger-jersey2-jaxrs:1.5.9'
}

swagger {
    inputSpec = "${project.rootDir}/src/specialSourceSet/resources/swagger.yaml"

    output = swaggerDir
    language = 'java'

    additionalProperties = [
            'modelPackage'     : 'com.example.my.model',
            'apiPackage'       : 'com.example.my.api',
            'dateLibrary'      : 'java8',
            'library'          : 'jersey2'
    ]
    apis = ''
    models = ''
}

compilation fails due to hard-baken compile dependency but testCompile has no swagger client dependency, e.g.

/my/projectdir/build/generated-test-sources/swagger/src/main/java/com/example/my/api/DefaultApi.java:4: error: package io.swagger.client does not exist import io.swagger.client.ApiClient;

referring to
https://github.com/thebignet/swagger-codegen-gradle-plugin/blob/master/src/main/groovy/org/detoeuf/SwaggerCodeGenPlugin.groovy#L12

I tried this workaround:

dependencies {
    configurations {
        testCompile.extendsFrom swaggerCompile
        testRuntime.extendsFrom swaggerRuntime
    }
}

compileTestJava.dependsOn 'swagger'

but I can't cleanup compile dependency either ...

## HACK; DIRT; PSEUDO_CODE
dependencies {
    configurations {
        compile.excludeAny swaggerCompile.dependencies
        runtime.excludeAny swaggerRuntime.dependencies
    }
}
## HACK; DIRT; PSEUDO_CODE

anyway ... not working at all ... I'm missing somewhat ... perhaps more ☕ helps ..

🙏 would be nice to get this some more sourceSet specific. e.g. Avro plugin extends each sourceSet where a swagger file might be set in and auto-fetched for generating classes.
For swagger-codegen, the dependency should only be relevant for the given

P:S:
sure, swaggerCompile is an implicit scope from your example sourceset "swagger" and is not predefined.
So, I can't see any code that will anyway solve this client dependency ... 😕


https://github.com/thebignet/swagger-codegen-gradle-plugin/blob/master/src/main/groovy/org/detoeuf/SwaggerCodeGenPlugin.groovy#L15

^ should be updated anyway ... from 1.5.0 to 1.5.9


^^

testCompile 'io.swagger:swagger-jersey2-jaxrs:1.5.9'
will result in duplicated annotations dependency

🎁 if a known "library" is set, auto-add relevant dependency ,)

Support serializableModel parameter

The latest swagger code generation supports a boolean parameter called serializableModel that causes the model classes to implement the java.io.Serializable interface. Can you add support for that parameter or more generally support addition of new parameters?

Deleting of files

Hello,

i change files from the generated code and add it to the .swagger-codegen-ignore. When i run the plugin again, all changes are reset. I found that you delete SwaggerCodeGenTask.groovy#L24 the complete output folder. Is this necessary?

[Feature Request] Add support for incremental builds

Currently, the plugin does not provide support for incremental builds in gradle. I have managed to work around this in build.gradle by defining task inputs/outputs in a custom wrapper task, but I think it would be cleaner to be able to specify the input and output directories in the plugin properties and be done with it.

Generating models from multiple sources

Hi,

I am trying to generate domain models from multiple services. I dont see how I can do that with this plugin? Can you tell me if this is possible and show me a basic example of how to do it?

Eksample: I want to get domain models from these three servers
localhost:8081 - Package name: com.github.server1
localhost:8082 - Package name: com.github.api.different.package
localhost:8083 - Package name: com.github.server3

Thanks in advance

[Feature Request] Support for multiple input specs

Currently, the plugin mirrors the behaviour of swagger-codegen-cli in that it requires a single file specified as inputSpec. It would be beneficial, I think, to be able to specify a FileSet to encourage a more modular approach to swagger.

Deprecation question!

In the readme, there is a phrase DEPRECATED? Could you clarify why and what is the substitution?

Doesn't seem to create output files

I've got this in my build.gradle:

plugins {
    id 'org.detoeuf.swagger-codegen' version '1.7.1'
    id 'java'
}

swagger {
    inputSpec = 'http://localhost/revapi/swagger/docs/v2'

    outputDir = 'swagger-java-client'
    lang = 'java'
}

I run gradle swagger, and I expect that the directory "swagger-java-client" will be created and contain the generated client SDK. I can see the task run without error, and lots of output indicating that "stuff" is being created, but at the end, no output directory is created.

I'm probably doing something stupid, any help would be appreciated.

Dp you need to hardcode swagger-annotations.jar

I see in the groovy sources that swagger-annotations is hardcoded as:

io.swagger:swagger-annotations:1.5.0

Is this necessary? It looks liek this plug-in can quickly become obsolete unless the developer can select the latest version.

Problem with ignoreFileOverride

Hello.

It seems I faced with a bug with ignoreFileOverride variable. I set it like this ignoreFileOverride = "$projectDir/.swagger-codegen-ignore2" Inside of swagger {} block but it ignores the .swagger-codegen-ignore2 file and doesn't exclude pom.xml from build dir.

I use the plugin like this:

    inputSpec = "file://$projectDir/src/main/resources/myservice-api.yaml"
    outputDir = swaggerTargetFolder
    lang = 'spring'
    ignoreFileOverride = "$projectDir/.swagger-codegen-ignore2"
    println ignoreFileOverride

    additionalProperties = [
            'interfaceOnly' : 'true',
            'apiPackage'    : 'com.workingbit.api',
            'dateLibrary'   : 'java8'
    ]
    importMappings = [
            'MyContainer': 'com.workingbit.share.domain.impl.MyContainer'
    ]
}

.swagger-codegen-ignore2:

README.md

Any suggestions?

How to configure cleanOutputDir

With 1.6.2 you could simply set cleanOutputDir = false in the configuration.

Now the README states:

  • cleanOutputDir - now, configured by configuring the task directly:
    tasks.getByName("swagger") {
        cleanOutputDir = false
    }

Where/when do I add this statement in my build.gradle?
I keep getting the following error, no matter where I put the lines.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':swagger'.
> You probably don't want to overwrite this directory: /my/output/directory

I am executing the swagger task directly... gradle swagger

Allow more than one language generation

Hi,
it would be great if this plugin supports the generation of more than one language.

Or did someone found a way (maybe with a custom task) to generate 2 language stubs in one build.gradle?

swaggerInputSpec as a URL no longer works

@mcoughlin729 commented on aa32376 4 days ago

I believe this commit breaks when your swaggerInputSpec is a URL. I had to revert to version 1.1 and it worked again.

What went wrong: Execution failed for task ':swagger'. > Cannot convert URL 'http://localhost:8065/swagger-api/v2/api-docs' to a file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.