Coder Social home page Coder Social logo

zalando-stups / swagger-codegen-tooling Goto Github PK

View Code? Open in Web Editor NEW
26.0 20.0 17.0 845 KB

Tooling around Maven and Gradle to generate code from OpenAPI/Swagger specs

Home Page: https://stups.io/swagger-codegen-tooling

License: Apache License 2.0

Java 49.74% Groovy 11.81% HTML 38.45%

swagger-codegen-tooling's Introduction

Swagger-Codegen-Tooling

Build Status Javadoc Release Maven Central License

The project provides some tooling around Maven and Gradle* to generate code from OpenAPI-Specs. It comes with custom-templates to support Spring-MVC/Spring-Boot projects. Instead of generating code only once when a project starts (design phase), code will be generated at every build to make sure your code is in sync with your spec. So controllers/resources are generated as interfaces developers have to implement then. So changes in the spec should be reflected immediately on build/compile-step.

Getting started with Maven

To get started in a Maven project just add the following plugin-definition to you pom.xml.

    <plugin>
        <groupId>org.zalando.maven.plugins</groupId>
        <artifactId>swagger-codegen-maven-plugin</artifactId>
        <version>${version}</version>
        <configuration>
            <apiFile>${project.basedir}/src/main/resources/api.yaml</apiFile>
            <language>springinterfaces</language>
            <apiPackage>com.example.project.api</apiPackage>
            <modelPackage>com.example.project.model</modelPackage>
        </configuration>
        <executions>
            <execution>
                <id>swagger-codegen</id>
                <goals>
                    <goal>codegen</goal>
                </goals>
            </execution>
        </executions>
    </plugin>

According to your OpenAPI-spec (api.yaml) code will be generated in ${basedir}/target/generated-sources/swagger-codegen

More examples how to use the Maven-Plugin can be found in the integration-test section.

Development/Contribution

Build

The project itself uses Maven:

mvn clean install

Run with integration-tests enabled

mvn clean install -Pintegration

TODO's

API-SPEC

https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/3.0.md

Contributions

Many thanks to ePaul for reporting issues and code-contributions.

License

Copyright 2015-2017 Zalando SE

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

swagger-codegen-tooling's People

Contributors

ender74 avatar epaul avatar jbellmann avatar kkrauth avatar otrosien 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

Watchers

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

swagger-codegen-tooling's Issues

spring interface api files fail to compile symbol not found @FormParam

The generated spring interface api files do not compile with an error:

[ERROR] error: cannot find symbol
[ERROR] symbol: class FormParam

The reason is because the generated file does not contain the includes:

import javax.ws.rs.;
import javax.ws.rs.core.
;

For now I fixed it by adding the two includes to the top of the file:
swagger-codegen-templates/swagger-codegen-template-spring-interfaces/src/main/resources/SpringInterfaces/api.mustache
but am not sure if that is the correct approach should be added somewhere else.

Happens with Java 1.8 not sure if it happens with earlier versions.

$ java -version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

apiPackage required even when skipApigeneration defined

When <skipApigeneration>true</skipApigeneration> is set, the <apiPackage> value is still required. When omitted, a NullPointerException is thrown. Ideally <apiPackage> should be optional when skipping API generation. Using version 0.4.30.

Upgrade swagger dependencies

Update to current versions of swagger libraries:

'io.swagger:swagger-codegen:2.2.1'
'io.swagger:swagger-parser:1.0.25'
'io.swagger:swagger-compat-spec-parser:1.0.25'

support spring-boot-hateoas

I would like to use the swagger code generator together with spring-boot-hateoas. From my understanding this would mean, that there needs to be a new template where every model bean extends from org.springframework.hateoas.ResourceSupport. What do you think about this? Any other ideas, how to achieve this? I'm willing to provide a PR if this feature is wanted.

Code generation for "dynamic-html" failing (on Windows only)

Not sure if this is a bug here or an upstream swagger-codegen bug, but this is what I get:

...
[INFO] Generate for language : dynamic-html
reading from Y:\workspace\aurora.core\aua-sl-rest-api/src/main/resources/swagger.yaml
writing file Y:\workspace\aurora.core\aua-sl-rest-api\target\generated-sources\swagger\docs\models\Link.html
writing file Y:\workspace\aurora.core\aua-sl-rest-api\target\generated-sources\swagger\docs\models\Product.html
writing file Y:\workspace\aurora.core\aua-sl-rest-api\target\generated-sources\swagger\docs\models\Suggest.html
writing file Y:\workspace\aurora.core\aua-sl-rest-api\target\generated-sources\swagger\docs\models\Document.html
writing file Y:\workspace\aurora.core\aua-sl-rest-api\target\generated-sources\swagger\docs\models\DocumentCollection.html
writing file Y:\workspace\aurora.core\aua-sl-rest-api\target\generated-sources\swagger\docs\operations\DefaultApi.html

writing file Y:\workspace\aurora.core\aua-sl-rest-api\target\generated-sources\swagger\package.json
writing file Y:\workspace\aurora.core\aua-sl-rest-api\target\generated-sources\swagger\main.js
can't open swagger-static\assets/css/bootstrap-responsive.css for input
can't open swagger-static\assets/css/bootstrap.css for input
can't open swagger-static\assets/css/style.css for input
can't open swagger-static\assets/images/logo.png for input
can't open swagger-static\assets/js/bootstrap.js for input
can't open swagger-static\assets/js/jquery-1.8.3.min.js for input
can't open swagger-static\assets/js/main.js for input
writing file Y:\workspace\aurora.core\aua-sl-rest-api\target\generated-sources\swagger\docs\index.html

The files above where it says can't open <file> for input end up being 0-byte empty files.

My pom.xml looks like this:

...
            <plugin>
                <groupId>org.zalando.maven.plugins</groupId>
                <artifactId>swagger-codegen-maven-plugin</artifactId>
                <version>0.4.7</version>
                <configuration>
                    <apiFile>${project.basedir}/src/main/resources/swagger.yaml</apiFile>
                </configuration>
                <executions>
                    <execution>
                        <id>generate-swagger-apidocs</id>
                        <goals>
                            <goal>codegen</goal>
                        </goals>
                        <configuration>
                            <language>dynamic-html</language>
                            <outputDirectory>${project.build.directory}/generated-sources/swagger</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
...

Any ideas? The forward slashes maybe? Or am I using it the wrong way?

language=spring-interfaces for a yaml with file-upload seems to produce incorrect code

API with a formupload and using language = springinterfaces produces incorrect java code. Looks like the code generating FormDataContentDisposition and FormDataParam and also missing the includes for them.

With spring I would have expected mode along the lines of: @RequestPart("file") MultipartFile application

Attached is a zip with yaml and maven pom file to demonstrate the error - just unzip and run mvn clean compile.

Uploading spring-swagger-error.zip…

Re-enable gradle plugin

Ensure same feature set to re-align the gradle plugin with the maven plugin.

framework:
✅ ensure gradle 2.10+ and gradle 3 compatibility (is that sufficient?)
✅ java

feature set:
✅ use single input file instead of a source set as swagger source definition
❓ : apply same defaults as the maven plugin
✅ ensure interoperability with compile phase

testing:
✅ smoke test using gradle testKit
✅ at least one unit test for critical path

releasing:
🚧 release 0.4.38 to the gradle plugin portal

Unable to generate any code using plugin

I tried the approach mentioned in read me. Added the swagger.json file to 'Src/main/resources' folder and ran a 'mvn clean install' after adding the plugin to the Pom.xml. No code got generated. Build is success and jar only gets generated! Is my approach incorrect ? Please guide me...

Usage of Spring MVC interfaces

Hi, I was inspired to do some hacking around in Spring MVC interface generation in the hope that I could use this to generate nicely separated interfaces holding all annotations, (request-mapping, security, etc), only later to learn that method level annotations are not inherited, and Spring MVC will not detect any of the controllers, @Secured annotations, etc. This leads me to ask, what is the "spring-interfaces" templating used for? Thanks you for you time! :)

Refs:

Evaluate official maven plugin for swagger-codegen

In best case this project can be reduced to publishing our own code templates, and letting swagger's own maven plugin do the code generation.

Questions to answer

❓ what features does our maven integration offer that the official plugin does not?
✅ is the official plugin capable of using our templates or do we need to adapt something?
❓ do we need to offer some migration guide how to switch to the official plugin?
❓ how do our templates perform in comparison with the current official (e.g. spring) code templates?

See

Java Map not generated correctly

given a field like:

"test": {
    "type": "object",
    "additionalProperties" : {
        "type" : "string"
        }
    }

the resulting java code is:

private String test = new HashMap<String, String>();

I am using version 0.4.16 of the maven plugin.

Any ideas?

Introduce something like skipApiGeneration to be used as plugin config

It will be really nice if i can skip generation of API classes as well as model classes (using skipModelgeneration property) e.g. when i want to re-create only model when only definitions was changed in my contract but already have API classes generated and saved somewhere (probably as another module)/

Do not generate consumes for requests without body

If you define something like

consumes: application/json

on top of your swagger file and then generate Spring MVC controller interfaces for a

GET /myResource

endpoint, the following annotation will be generated:

@RequestMapping(value="/purchase-orders", method=RequestMethod.GET , consumes={ "application/json" })

The Spring docs say about consumes:

The format is a single media type or a sequence of media types, with a request only mapped if the Content-Type matches one of these media types.

And Spring is pretty strict here: if the Content-Type header is missing, it will return a 400 status code. This does not seem to be what we want here: Defining a Content-Type header without sending a request body makes no sense, and GET requests are not meant to have a request body. So i guess, it is better to just leave this out for methods without body.

Document dependencies needed for the generated classes to work

The generator outputs interfaces which import stuff from other projects.
For example, after using the jaxrsinterfaces generator, I had those imports:

package de.zalando.einkaufshelden.purchase_order.api.controller;

import de.zalando.einkaufshelden.purchase_order.api.model.*;

import io.swagger.annotations.*;

import de.zalando.einkaufshelden.purchase_order.api.model.Problem;
import de.zalando.einkaufshelden.purchase_order.api.model.PurchaseOrder;

import java.util.List;
import de.zalando.einkaufshelden.purchase_order.api.controller.NotFoundException;

import java.io.InputStream;

import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.glassfish.jersey.media.multipart.FormDataParam;

import javax.ws.rs.core.Response;
import javax.ws.rs.*;

The einkaufshelden stuff is also generated, java.io and java.util come from the Java standard library, but the rest (javax.ws, io.swagger, org.glassfish.jersey) comes from other libraries. For each of the options the needed dependencies (e.g. for copying into a maven definition) should be documented.

Builder Pattern for generated models

It would be awesome (and low hanging fruit probably ;-)) if the generated models could be contructed via Builder pattern, e.g. BlogPost p = new BlogPostBuilder().title("foo").content("bar").author("baz").build();

What do you think?

swagger-ui not working when deployed in servlet container

I am deploying a Spring Boot application in a Jetty servlet container instead of running it with an embedded Tomcat. I guess that classpath resolution doesn't work in the swagger UI controller because its not a flattened classpath in the war file:

2016-06-11 13:12:42.881 ERROR 9404 --- [tp1542155234-19] o.s.boot.context.web.ErrorPageFilter     : Forwarding to error page from request [/v2/api-docs] due to exception [No InputStream specified]

java.lang.IllegalArgumentException: No InputStream specified
    at org.springframework.util.Assert.notNull(Assert.java:115) ~[spring-core-4.2.6.RELEASE.jar:4.2.6.RELEASE]
    at org.springframework.util.StreamUtils.copy(StreamUtils.java:121) ~[spring-core-4.2.6.RELEASE.jar:4.2.6.RELEASE]
    at org.springframework.util.StreamUtils.copyToByteArray(StreamUtils.java:59) ~[spring-core-4.2.6.RELEASE.jar:4.2.6.RELEASE]
    at org.zalando.stups.swagger.codegen.SwaggerCodegenController.getApi(SwaggerCodegenController.java:56) ~[spring-boot-stups-swagger-codegen-ui-0.4.27.jar:na]

Swagger Codegen error with version 0.4.26

Getting the following error while trying to generate spring-boot code with plugin version 0.4.26. The same works for 0.4.22.
swagger-springboot-error.zip

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building swagger-springboot-codegen 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ swagger-springboot-codegen ---
[INFO]
[INFO] --- swagger-codegen-maven-plugin:0.4.26:codegen (YAML to code Generation) @ swagger-springboot-codegen ---
[INFO] 'apiFile' seems not be an valid URL, check file exist
[INFO] register config : 'springinterfaces' with class : de.zalando.stups.swagger.codegen.language.SpringInterfaces
[INFO] register config : 'springinterfacesNoSwaggerAnnotations' with class : de.zalando.stups.swagger.codegen.language.SpringInterfacesNoSwaggerAnnotations
[INFO] register config : 'springinterfacesResponseEntity' with class : de.zalando.stups.swagger.codegen.language.SpringInterfacesResponseEntity
[INFO] register config : 'springinterfacesResponseEntityNoSwaggerAnnotations' with class : de.zalando.stups.swagger.codegen.language.SpringInterfacesResponseEntityNoSwaggerAnnotations
[INFO] register config : 'jaxrsinterfaces' with class : de.zalando.stups.swagger.codegen.language.JaxRsInterfaces
[INFO] register config : 'android' with class : io.swagger.codegen.languages.AndroidClientCodegen
[INFO] register config : 'aspnet5' with class : io.swagger.codegen.languages.AspNet5ServerCodegen
[INFO] register config : 'async-scala' with class : io.swagger.codegen.languages.AsyncScalaClientCodegen
[INFO] register config : 'csharp' with class : io.swagger.codegen.languages.CSharpClientCodegen
[INFO] register config : 'dart' with class : io.swagger.codegen.languages.DartClientCodegen
[INFO] register config : 'flash' with class : io.swagger.codegen.languages.FlashClientCodegen
[INFO] register config : 'python-flask' with class : io.swagger.codegen.languages.FlaskConnexionCodegen
[INFO] register config : 'go' with class : io.swagger.codegen.languages.GoClientCodegen
[INFO] register config : 'groovy' with class : io.swagger.codegen.languages.GroovyClientCodegen
[INFO] register config : 'java' with class : io.swagger.codegen.languages.JavaClientCodegen
[INFO] register config : 'jaxrs' with class : io.swagger.codegen.languages.JavaJerseyServerCodegen
[INFO] register config : 'jaxrs-cxf' with class : io.swagger.codegen.languages.JavaCXFServerCodegen
[INFO] register config : 'jaxrs-resteasy' with class : io.swagger.codegen.languages.JavaResteasyServerCodegen
[INFO] register config : 'inflector' with class : io.swagger.codegen.languages.JavaInflectorServerCodegen
[INFO] register config : 'javascript' with class : io.swagger.codegen.languages.JavascriptClientCodegen
[INFO] register config : 'javascript-closure-angular' with class : io.swagger.codegen.languages.JavascriptClosureAngularClientCodegen
[INFO] register config : 'jmeter' with class : io.swagger.codegen.languages.JMeterCodegen
[INFO] register config : 'nodejs-server' with class : io.swagger.codegen.languages.NodeJSServerCodegen
[INFO] register config : 'objc' with class : io.swagger.codegen.languages.ObjcClientCodegen
[INFO] register config : 'perl' with class : io.swagger.codegen.languages.PerlClientCodegen
[INFO] register config : 'php' with class : io.swagger.codegen.languages.PhpClientCodegen
[INFO] register config : 'python' with class : io.swagger.codegen.languages.PythonClientCodegen
[INFO] register config : 'qt5cpp' with class : io.swagger.codegen.languages.Qt5CPPGenerator
[INFO] register config : 'ruby' with class : io.swagger.codegen.languages.RubyClientCodegen
[INFO] register config : 'scala' with class : io.swagger.codegen.languages.ScalaClientCodegen
[INFO] register config : 'scalatra' with class : io.swagger.codegen.languages.ScalatraServerCodegen
[INFO] register config : 'silex-PHP' with class : io.swagger.codegen.languages.SilexServerCodegen
[INFO] register config : 'sinatra' with class : io.swagger.codegen.languages.SinatraServerCodegen
[INFO] register config : 'slim' with class : io.swagger.codegen.languages.SlimFrameworkServerCodegen
[INFO] register config : 'spring-mvc' with class : io.swagger.codegen.languages.SpringMVCServerCodegen
[INFO] register config : 'dynamic-html' with class : io.swagger.codegen.languages.StaticDocCodegen
[INFO] register config : 'html' with class : io.swagger.codegen.languages.StaticHtmlGenerator
[INFO] register config : 'swagger' with class : io.swagger.codegen.languages.SwaggerGenerator
[INFO] register config : 'swagger-yaml' with class : io.swagger.codegen.languages.SwaggerYamlGenerator
[INFO] register config : 'swift' with class : io.swagger.codegen.languages.SwiftCodegen
[INFO] register config : 'tizen' with class : io.swagger.codegen.languages.TizenClientCodegen
[INFO] register config : 'typescript-angular2' with class : io.swagger.codegen.languages.TypeScriptAngular2ClientCodegen
[INFO] register config : 'typescript-angular' with class : io.swagger.codegen.languages.TypeScriptAngularClientCodegen
[INFO] register config : 'typescript-node' with class : io.swagger.codegen.languages.TypeScriptNodeClientCodegen
[INFO] register config : 'akka-scala' with class : io.swagger.codegen.languages.AkkaScalaClientCodegen
[INFO] register config : 'CsharpDotNet2' with class : io.swagger.codegen.languages.CsharpDotNet2ClientCodegen
[INFO] register config : 'clojure' with class : io.swagger.codegen.languages.ClojureClientCodegen
[INFO] register config : 'haskell' with class : io.swagger.codegen.languages.HaskellServantCodegen
[INFO] register config : 'lumen' with class : io.swagger.codegen.languages.LumenServerCodegen
[INFO] Generate for language : springinterfaces
[INFO] reading from D:/PLATFORMS/Micro-Services/micro-ws/swagger-springboot-codegen/src/main/resources/swagger.yaml
[INFO] writing file D:\PLATFORMS\Micro-Services\micro-ws\swagger-springboot-codegen\target\generated-sources\swagger-codegen/com\example\test\api\model\Greeting.java
[ERROR] SpringInterfaces\model_doc.mustache (The system cannot find the path specified)
[ERROR] can't load template SpringInterfaces\model_doc.mustache
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.489 s
[INFO] Finished at: 2016-05-02T15:18:33+05:30
[INFO] Final Memory: 17M/212M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.zalando.maven.plugins:swagger-codegen-maven-plugin:0.4.26:codegen (YAML to code Generation) on project swagger-springboot-codegen: Could not generate model 'Greeting': can't load template SpringInterfaces\model_doc.mustache -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Inverted Spring MVC query param required generation

Spring MVCs @RequestParam annotation has an attribute required. It is, by default, true.
The behaviour of SpringInterfacesNoSwaggerAnnotations/queryParams.mustache is therefore broken:

If a query parameter is required, it generates required=true, which is superfluous. If a query parameter is not required, it generates no required parameter at all. The default value will take it's place then, which is true - that is just wrong.

The same seems to be true for the other SpringInterface* templates.

Name collision with APIs

Hello,

I tried your org.zalando.maven.plugins:swagger-codegen-maven-plugin plugin with the example provided by the io.swagger:swagger-codegen-maven-plugin plugin.

I ran into a name collision between model classes and API classes, namely io.swagger.annotations.APIResponse and com.example.project.model.APIResponse with the jaxrsinterfaces language of yours.

Machines doesn't need to make pretty code to make it work. I see no reason not to use fully qualified name and prevent such collisions (all annotation names are concerned actually).

Code generation with maven plugin does not work for yaml files

When configuring a yaml file, the swagger parser tries to interpret it as json. The configuration yamlToJson apparently converts a swagger definition from yaml to json file, but the resulting file is not used for the code generation step.

Plugin configuration:

            <plugin>
                <groupId>org.zalando.maven.plugins</groupId>
                <artifactId>swagger-codegen-maven-plugin</artifactId>
                <version>0.4.15</version>
                <configuration>
                    <apiFile>${project.basedir}/src/main/swagger/swagger.yaml</apiFile>
                    <yamlToJson>true</yamlToJson>
                    <language>jaxrsinterfaces</language>
                    <apiPackage>de.zalando.phrs.coupon.api</apiPackage>
                    <modelPackage>de.zalando.phrs.coupon.model</modelPackage>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.zalando.stups</groupId>
                        <artifactId>swagger-codegen-template-jaxrs-interfaces</artifactId>
                        <version>0.4.15</version>
                    </dependency>
                </dependencies>
            </plugin>

Console output:

reading from /home/hanzelm/git/phrasers/coupon-api/coupon-service/core/src/main/swagger/swagger.yaml
(was java.lang.NullPointerException) (through reference chain: io.swagger.models.ModelImpl["properties"]->java.util.LinkedHashMap["discount"]) (through reference chain: io.swagger.models.parameters.BodyParameter["schema"]) (through reference chain: io.swagger.models.Path["post"]->io.swagger.models.Operation["parameters"]->java.util.ArrayList[0]) (through reference chain: io.swagger.models.Swagger["paths"]->java.util.LinkedHashMap["/coupons"])
reading from /home/hanzelm/git/phrasers/coupon-api/coupon-service/core/src/main/swagger/swagger.yaml
(was java.lang.NullPointerException) (through reference chain: io.swagger.models.ModelImpl["properties"]->java.util.LinkedHashMap["discount"]) (through reference chain: io.swagger.models.parameters.BodyParameter["schema"]) (through reference chain: io.swagger.models.Path["post"]->io.swagger.models.Operation["parameters"]->java.util.ArrayList[0]) (through reference chain: io.swagger.models.Swagger["paths"]->java.util.LinkedHashMap["/coupons"])
com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'swagger': was expecting ('true', 'false' or 'null')
 at [Source: /home/hanzelm/git/phrasers/coupon-api/coupon-service/core/src/main/swagger/swagger.yaml; line: 1, column: 9]
    at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1419)
    at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:508)
    at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._reportInvalidToken(UTF8StreamJsonParser.java:3201)
    at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._handleUnexpectedValue(UTF8StreamJsonParser.java:2360)
    at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._nextTokenNotInObject(UTF8StreamJsonParser.java:794)
    at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.nextToken(UTF8Sreading from /home/hanzelm/git/phrasers/coupon-api/coupon-service/core/src/main/swagger/swagger.yaml
(was java.lang.NullPointerException) (through reference chain: io.swagger.models.ModelImpl["properties"]->java.util.LinkedHashMap["discount"]) (through reference chain: io.swagger.models.parameters.BodyParameter["schema"]) (through reference chain: io.swagger.models.Path["post"]->io.swagger.models.Operation["parameters"]->java.util.ArrayList[0]) (through reference chain: io.swagger.models.Swagger["paths"]->java.util.LinkedHashMap["/coupons"])
reading from /home/hanzelm/git/phrasers/coupon-api/coupon-service/core/src/main/swagger/swagger.yaml
(was java.lang.NullPointerException) (through reference chain: io.swagger.models.ModelImpl["properties"]->java.util.LinkedHashMap["discount"]) (through reference chain: io.swagger.models.parameters.BodyParameter["schema"]) (through reference chain: io.swagger.models.Path["post"]->io.swagger.models.Operation["parameters"]->java.util.ArrayList[0]) (through reference chain: io.swagger.models.Swagger["paths"]->java.util.LinkedHashMap["/coupons"])
com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'swagger': was expecting ('true', 'false' or 'null')
 at [Source: /home/hanzelm/git/phrasers/coupon-api/coupon-service/core/src/main/swagger/swagger.yaml; line: 1, column: 9]
    at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1419)
    at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:508)
    at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._reportInvalidToken(UTF8StreamJsonParser.java:3201)
    at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._handleUnexpectedValue(UTF8StreamJsonParser.java:2360)
    at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._nextTokenNotInObject(UTF8StreamJsonParser.java:794)
    at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.nextToken(UTF8StreamJsonParser.java:690)
    at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:3105)
    at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3051)
    at com.fasterxml.jackson.databind.ObjectMapper.readTree(ObjectMapper.java:1861)
    at io.swagger.parser.SwaggerCompatConverter.readResourceListing(SwaggerCompatConverter.java:147)
    at io.swagger.parser.SwaggerCompatConverter.read(SwaggerCompatConverter.java:82)
    at io.swagger.parser.SwaggerParser.read(SwaggerParser.java:36)
    at org.zalando.stups.swagger.codegen.StandaloneCodegenerator.generate(StandaloneCodegenerator.java:130)
    at org.zalando.maven.plugins.swagger.codegen.CodegenMojo.execute(CodegenMojo.java:100)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)treamJsonParser.java:690)
    at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:3105)
    at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3051)
    at com.fasterxml.jackson.databind.ObjectMapper.readTree(ObjectMapper.java:1861)
    at io.swagger.parser.SwaggerCompatConverter.readResourceListing(SwaggerCompatConverter.java:147)
    at io.swagger.parser.SwaggerCompatConverter.read(SwaggerCompatConverter.java:82)
    at io.swagger.parser.SwaggerParser.read(SwaggerParser.java:36)
    at org.zalando.stups.swagger.codegen.StandaloneCodegenerator.generate(StandaloneCodegenerator.java:130)
    at org.zalando.maven.plugins.swagger.codegen.CodegenMojo.execute(CodegenMojo.java:100)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)

consumes annotation field on HTTP actions without a body

When using a swagger file that defines the consume/produce properties globally:

consumes:
  - application/json
produces:
  - application/json

In the resulting spring interface definitions, the consumes request mapping field is included even for HTTP actions that don't have a body (i.e. DELETE):

@RequestMapping(value="/myendpoint",method=RequestMethod.DELETE,consumes={ "application/json" } , produces={ "application/json" })

This causes issues with "strict" HTTP client libraries like OkHttp which will refuse to send a Content-Type header for DELETE/GET operations - as a result, spring will reject these requests because of an unsupported content type. Would you consider omitting the consumes type for GET/DELETE?

It could be argued that perhaps spring should ignore the consumes request mapping field for HTTP verbs that don't contain request bodies.

Bug: springinterfacesResponseEntityNoSwaggerAnnotations omits a `List<...>` in the response type parameter

When using the language springinterfacesResponseEntityNoSwaggerAnnotations with an operation which returns an array of some type, the generated method has return type ResponseEntity<Warehouse> instead of ResponseEntity<List<Warehouse>>.

From the pom.xml:

            <plugin>
                <groupId>org.zalando.maven.plugins</groupId>
                <artifactId>swagger-codegen-maven-plugin</artifactId>
                <version>0.4.20</version>
                <executions>
                    <execution>
                        <id>generate-api</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>codegen</goal>
                        </goals>
                        <configuration>
                            <apiFile>${project.basedir}/src/main/resources/api/bug-trigger.yaml</apiFile>
                            <language>springinterfacesResponseEntityNoSwaggerAnnotations</language>
                            <apiPackage>de.zalando.wholesale.warehouseallocation.api.controller</apiPackage>
                            <modelPackage>de.zalando.wholesale.warehouseallocation.api.model</modelPackage>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.zalando.stups</groupId>
                        <artifactId>swagger-codegen-template-spring-interfaces</artifactId>
                        <version>0.4.20</version>
                    </dependency>
                </dependencies>
            </plugin>

bug-trigger.yaml:

swagger: '2.0'
info:
  title: Swagger Codegen bug trigger
  description: |
     This demonstrates a bug in swagger-codegen-tooling.
  version: 0.0.1
basePath: /api

definitions:

  warehouse:
    type: object
    description: |
      A warehouse is the location where ordered goods are delivered.
      This object (when transmitted in JSON format) is known as
      application/x.zalando.lumberjack.warehouse+json, a list of these as
      application/x.zalando.lumberjack.warehouse-list+json.
    properties:
      self:
        type: string
        format: uri
        description: a link to this warehouse object.
        example:
          /warehouses/WH-DE-EF
      code:
        type: string
        description: |
          The code of the warehouse.
        example:
          WH-DE-EF


paths:
# API endpoints
  /warehouses:
    get:
      summary: Finds warehouses which fit to search parameters.
      produces:
        - application/x.zalando.lumberjack.warehouse-list+json
        - application/x.problem+json
      responses:
        200:
          description: The found warehouses or an empty list
            if no warehouse fits to search parameter.
          schema:
            type: array
            items:
              $ref: "#/definitions/warehouse"

Generated code (omitted imports):

package de.zalando.wholesale.warehouseallocation.api.controller;

// [... imports omitted]

//
// GENERATED CLASS, DO NOT EDIT
//

public interface WarehousesApi {

  @RequestMapping(value="/warehouses",method=RequestMethod.GET , produces={ "application/x.zalando.lumberjack.warehouse-list+json", "application/x.problem+json" })
  ResponseEntity<Warehouse> warehousesGet();

}

When using the language springinterfacesResponseEntity instead (i.e. without the NoSwaggerAnnotations), the type is generated correctly:

  ResponseEntity<List<Warehouse>> warehousesGet();

Allow generating code from an URL

The maven-codegen plugin from io.swagger allows generating code from an HTTP URL (of the YAML or JSON definition). This project's plugin doesn't allow this, finishing with an error message instead:

[ERROR] Failed to execute goal org.zalando.maven.plugins:swagger-codegen-maven-plugin:0.4.24:codegen (generate-nakadi-api) on project tarbela: The 'apiFile' does not exists at : https://raw.githubusercontent.com/zalando/nakadi/nakadi-jvm/api/nakadi-event-bus-api.yaml

Digging into the code, this seems to be caused by the checkApiFileExists method in StandaloneCodeGenerator. Commenting out its call in line 83 prevents this error message, and makes the generation work.

Is this check needed for some reason? It looks like the called framework will do a similar check again, but in a way that works for HTTP URLs.

maven.plugin.validation warnings

Building a project using Maven 3.9.x will generate plugin validation [WARNING] log entries. These a intended to help spot problems that plugins might run into when Maven 4.x is released.

When using 'maven.plugin.validation' property with value "verbose", we see:

Plugin validation issues were detected in x plugin(s)

* org.zalando.maven.plugins:swagger-codegen-maven-plugin:0.4.38
 Declared at location(s):
  * XXX
 Used in module(s):
  * YYY
 Plugin issue(s):
* Plugin is a Maven 2.x plugin, which will be not supported in Maven 4.x
* Plugin mixes multiple Maven versions: [2.0, 2.0.7, 3.2.1]
* Plugin should declare these Maven artifacts in `provided` scope: [org.apache.maven:maven-settings:3.2.1, org.apache.maven:maven-model-builder:3.2.1, org.apache.maven:maven-model:3.2.1, org.apache.maven:maven-settings-builder:3.2.1, org.apache.maven:maven-artifact:3.2.1, org.apache.maven:maven-plugin-api:3.2.1, org.apache.maven:maven-core:3.2.1, org.apache.maven:maven-repository-metadata:3.2.1, org.apache.maven:maven-aether-provider:3.2.1]
* Plugin depends on plexus-container-default, which is EOL

The advise from Maven devs is:

Do not rely on maven-compat, as if you do, it means your plugin is technically a Maven2 plugin (as you depend on Maven3's Maven2 compatibility layer)

Problem generating enums with special characters

When generating code from an enum like this:

      my_enum:
        type: string
        enum: ["A", "B", "C/D"]

This is the resulting code:

    public enum MyEnumEnum {
       A,  B,  C/D, 
    };

Which does not compile. Moving the string value to a constructor parameter and removing/replacing special characters may be a solution.

Invalid generation of API query params

Generation of query params for API is incorrect

The output is:

@RequestParam("filter", required=true) String filter);

but should be:

@RequestParam(value="filter", required=true) String filter);

the template at:

https://github.com/zalando-stups/swagger-codegen-tooling/blob/master/swagger-codegen-templates/swagger-codegen-template-spring-interfaces/src/main/resources/SpringInterfaces/queryParams.mustache

looks to be the issue:

@RequestParam("filter") String filter); is valid but not if required or default is present then value="" must be used. I would prob just use value ="" all the time.

When DefaultGenerator.generate() fails, this is ignored.

This might not apply to the latest released version (I didn't try this due to other problems), but it shows when using this project's maven-plugin with the latest master of swagger-codegen.

The the generate() method in io.swagger.codegen.DefaultGenerator just sets a status flag (in the DefaultGenerator class) when any exception is caught while generating, and CodeGenMojo does not check this flag. (This is similar to Issue #1140 in swagger-codegen).

So if there is a failure in generating one of the files, the thrown exception gets swallowed, and the maven build still is SUCCESSFUL.

custom mustache template

is there an example of how I can point my code generation (in my case for jax-rs) to a local mustache template? I'm looking to add JSR303 annotations to the template.

Using swagger-codegen-maven-plugin with maven 2.0.11

I'm bound to use maven 2.0.11 in an older project and would like to use swagger-codegen-maven-plugin. This sadly does not work out of the box:

-----------------------------------------------------
this realm = app0.child-container[org.zalando.maven.plugins:swagger-codegen-maven-plugin]
urls[0] = file:/d:/m2r/org/zalando/maven/plugins/swagger-codegen-maven-plugin/0.4.34/swagger-codegen-maven-plugin-0.4.34.jar
urls[1] = file:/d:/m2r/org/zalando/stups/swagger-codegen-template-spring-interfaces/0.4.35-SNAPSHOT/swagger-codegen-template-spring-interfaces-0.4.35-SNAPSHOT.jar
urls[2] = file:/d:/m2r/org/zalando/stups/swagger-codegen-common/0.4.34/swagger-codegen-common-0.4.34.jar
urls[3] = file:/d:/m2r/io/swagger/swagger-codegen/2.1.6/swagger-codegen-2.1.6.jar
urls[4] = file:/d:/m2r/io/swagger/swagger-parser/1.0.19/swagger-parser-1.0.19.jar
urls[5] = file:/d:/m2r/io/swagger/swagger-core/1.5.8/swagger-core-1.5.8.jar
urls[6] = file:/d:/m2r/org/apache/commons/commons-lang3/3.2.1/commons-lang3-3.2.1.jar
urls[7] = file:/d:/m2r/org/slf4j/slf4j-api/1.7.12/slf4j-api-1.7.12.jar
urls[8] = file:/d:/m2r/com/fasterxml/jackson/core/jackson-annotations/2.4.5/jackson-annotations-2.4.5.jar
urls[9] = file:/d:/m2r/com/fasterxml/jackson/core/jackson-databind/2.4.5/jackson-databind-2.4.5.jar
urls[10] = file:/d:/m2r/com/fasterxml/jackson/core/jackson-core/2.4.5/jackson-core-2.4.5.jar
urls[11] = file:/d:/m2r/com/fasterxml/jackson/datatype/jackson-datatype-joda/2.4.5/jackson-datatype-joda-2.4.5.jar
urls[12] = file:/d:/m2r/joda-time/joda-time/2.3/joda-time-2.3.jar
urls[13] = file:/d:/m2r/com/fasterxml/jackson/dataformat/jackson-dataformat-yaml/2.4.5/jackson-dataformat-yaml-2.4.5.jar
urls[14] = file:/d:/m2r/org/yaml/snakeyaml/1.12/snakeyaml-1.12.jar
urls[15] = file:/d:/m2r/io/swagger/swagger-models/1.5.8/swagger-models-1.5.8.jar
urls[16] = file:/d:/m2r/io/swagger/swagger-annotations/1.5.8/swagger-annotations-1.5.8.jar
urls[17] = file:/d:/m2r/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final.jar
urls[18] = file:/d:/m2r/org/slf4j/slf4j-ext/1.7.12/slf4j-ext-1.7.12.jar
urls[19] = file:/d:/m2r/ch/qos/cal10n/cal10n-api/0.8.1/cal10n-api-0.8.1.jar
urls[20] = file:/d:/m2r/commons-io/commons-io/2.4/commons-io-2.4.jar
urls[21] = file:/d:/m2r/io/swagger/swagger-compat-spec-parser/1.0.19/swagger-compat-spec-parser-1.0.19.jar
urls[22] = file:/d:/m2r/com/github/fge/json-schema-validator/2.2.3/json-schema-validator-2.2.3.jar
urls[23] = file:/d:/m2r/com/github/fge/json-schema-core/1.2.1/json-schema-core-1.2.1.jar
urls[24] = file:/d:/m2r/com/github/fge/uri-template/0.9/uri-template-0.9.jar
urls[25] = file:/d:/m2r/com/github/fge/msg-simple/1.1/msg-simple-1.1.jar
urls[26] = file:/d:/m2r/com/github/fge/btf/1.2/btf-1.2.jar
urls[27] = file:/d:/m2r/com/github/fge/jackson-coreutils/1.6/jackson-coreutils-1.6.jar
urls[28] = file:/d:/m2r/org/mozilla/rhino/1.7R4/rhino-1.7R4.jar
urls[29] = file:/d:/m2r/com/googlecode/libphonenumber/libphonenumber/6.0/libphonenumber-6.0.jar
urls[30] = file:/d:/m2r/javax/mail/mailapi/1.4.3/mailapi-1.4.3.jar
urls[31] = file:/d:/m2r/javax/activation/activation/1.1/activation-1.1.jar
urls[32] = file:/d:/m2r/net/sf/jopt-simple/jopt-simple/4.6/jopt-simple-4.6.jar
urls[33] = file:/d:/m2r/com/github/fge/json-patch/1.6/json-patch-1.6.jar
urls[34] = file:/d:/m2r/org/apache/httpcomponents/httpclient/4.3.1/httpclient-4.3.1.jar
urls[35] = file:/d:/m2r/org/apache/httpcomponents/httpcore/4.3/httpcore-4.3.jar
urls[36] = file:/d:/m2r/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar
urls[37] = file:/d:/m2r/commons-codec/commons-codec/1.6/commons-codec-1.6.jar
urls[38] = file:/d:/m2r/com/samskivert/jmustache/1.9/jmustache-1.9.jar
urls[39] = file:/d:/m2r/org/apache/maven/maven-plugin-tools-api/2.0/maven-plugin-tools-api-2.0.jar
urls[40] = file:/d:/m2r/org/codehaus/plexus/plexus-utils/3.0.17/plexus-utils-3.0.17.jar
urls[41] = file:/d:/m2r/org/apache/felix/maven-bundle-plugin/2.3.4/maven-bundle-plugin-2.3.4.jar
urls[42] = file:/d:/m2r/biz/aQute/bndlib/1.15.0/bndlib-1.15.0.jar
urls[43] = file:/d:/m2r/net/sf/kxml/kxml2/2.2.2/kxml2-2.2.2.jar
urls[44] = file:/d:/m2r/xmlpull/xmlpull/1.1.3.1/xmlpull-1.1.3.1.jar
urls[45] = file:/d:/m2r/org/apache/felix/org.apache.felix.bundlerepository/1.6.2/org.apache.felix.bundlerepository-1.6.2.jar
urls[46] = file:/d:/m2r/org/osgi/org.osgi.core/4.1.0/org.osgi.core-4.1.0.jar
urls[47] = file:/d:/m2r/org/easymock/easymock/2.4/easymock-2.4.jar
urls[48] = file:/d:/m2r/org/apache/felix/org.osgi.core/1.0.0/org.osgi.core-1.0.0.jar
urls[49] = file:/d:/m2r/org/apache/felix/org.osgi.service.obr/1.0.1/org.osgi.service.obr-1.0.1.jar
urls[50] = file:/d:/m2r/org/apache/maven/maven-archiver/2.5/maven-archiver-2.5.jar
urls[51] = file:/d:/m2r/org/codehaus/plexus/plexus-archiver/2.4.4/plexus-archiver-2.4.4.jar
urls[52] = file:/d:/m2r/org/apache/maven/shared/maven-dependency-tree/1.2/maven-dependency-tree-1.2.jar
urls[53] = file:/d:/m2r/org/slf4j/slf4j-simple/1.7.12/slf4j-simple-1.7.12.jar
urls[54] = file:/d:/m2r/commons-lang/commons-lang/2.4/commons-lang-2.4.jar
urls[55] = file:/d:/m2r/org/zalando/stups/swagger-codegen-template-jaxrs-interfaces/0.4.34/swagger-codegen-template-jaxrs-interfaces-0.4.34.jar
urls[56] = file:/d:/m2r/org/codehaus/plexus/plexus-io/2.0.10/plexus-io-2.0.10.jar
urls[57] = file:/d:/m2r/org/codehaus/plexus/plexus-interpolation/1.15/plexus-interpolation-1.15.jar
urls[58] = file:/d:/m2r/org/apache/commons/commons-compress/1.5/commons-compress-1.5.jar
urls[59] = file:/d:/m2r/org/tukaani/xz/1.2/xz-1.2.jar
Number of imports: 10
import: org.codehaus.classworlds.Entry@a6c57a42
import: org.codehaus.classworlds.Entry@12f43f3b
import: org.codehaus.classworlds.Entry@20025374
import: org.codehaus.classworlds.Entry@f8e44ca4
import: org.codehaus.classworlds.Entry@92758522
import: org.codehaus.classworlds.Entry@ebf2705b
import: org.codehaus.classworlds.Entry@bb25e54
import: org.codehaus.classworlds.Entry@bece5185
import: org.codehaus.classworlds.Entry@3fee8e37
import: org.codehaus.classworlds.Entry@3fee19d8


this realm = plexus.core
urls[0] = file:/d:/Programme/apache-maven-2.0.11/bin/../lib/maven-2.0.11-uber.jar
Number of imports: 10
import: org.codehaus.classworlds.Entry@a6c57a42
import: org.codehaus.classworlds.Entry@12f43f3b
import: org.codehaus.classworlds.Entry@20025374
import: org.codehaus.classworlds.Entry@f8e44ca4
import: org.codehaus.classworlds.Entry@92758522
import: org.codehaus.classworlds.Entry@ebf2705b
import: org.codehaus.classworlds.Entry@bb25e54
import: org.codehaus.classworlds.Entry@bece5185
import: org.codehaus.classworlds.Entry@3fee8e37
import: org.codehaus.classworlds.Entry@3fee19d8
-----------------------------------------------------
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Internal error in the plugin manager executing goal 'org.zalando.maven.plugins:swagger-codegen-maven-plugin:0.4.34:codegen': Unable to find the mojo 'org.zalando.maven.plugins:swagger-codegen-maven-plugin:0.4.34:codegen' in the plugin 'org.zalando.maven.plugins:swagger-codegen-maven-plugin'
com.google.common.collect.ImmutableMap

I've tried rebuilding swagger-codegen-maven-plugin after setting maven.version in swagger-codegen-maven-plugin/pom.xml to 2.0.11 or even 2.2.1. After both of these changes I was able to sucessfully use the plugin with my outdated maven version. Could you please change the referenced maven version to 2.2.1 ?

BasePath not generated with JAX-RS interfaces

I am currently generating JAX-RS annotated interfaces. I'd like to have all the swagger-generated enpoints have a base path, for example, of /api. I tried adding basePath: "/api" to the root of my swagger.yaml, but it does not look like this is picked up during code generation (and I do not see anything referencing basePath in the mustache templates. Is this something that can be done?

I found a related issue in swagger codegen: 1425
Thanks

Gradle plugin status/version

Hi,

I was trying to follow the README to configure the Gradle plugin, which gives me this error :
> Could not resolve all dependencies for configuration ':classpath'. > Could not find org.zalando.stups:swagger-codegen-gradle-plugin:0.4.24.

Thus I'm interested if I'm missing some configuration or plugin is just not yet published?
If it is not, I would be very interested if there's any work planned on it in the near future?

Thanks

support apiPrefix parameter

I have to different swagger files with same basePath (like /api). I would like to generate spring-boot server stups out of it. This results in two identical named classes (e.g. "ApiApiController") which then results in colliding bean names:

Caused by: org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name 'apiApiController' for bean class [de.zalando.ale.asgateway.api.sorter.ApiApiController] conflicts with existing, non-compatible bean definition of same name and class [de.zalando.ale.asgateway.api.wms.ApiApiController]

To prevent this, i would like to be able to configure a Prefix which will be added to the generated Api Classnames.

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.