swagger生成的文件夹结构不匹配包结构

时间:2015-12-15 16:36:17

标签: java swagger

Swagger(版本2.1.4)正在为我生成一个这样的包结构:

io/
io/swagger/
io/swagger/api/
io/swagger/api/ApiException.class
io/swagger/api/factories/
io/swagger/api/factories/ProjectsApiServiceFactory.class
io/swagger/api/impl/
io/swagger/api/impl/ProjectsApiServiceImpl.class
io/swagger/api/impl/TasksApiServiceImpl.class

但文件夹结构如下:

src/gen/java/factories/
src/gen/java/factories/io/
src/gen/java/factories/io/swagger/
src/gen/java/factories/io/swagger/api/
src/gen/java/factories/io/swagger/api/ProjectsApiServiceFactory.java
src/gen/java/factories/io/swagger/api/TasksApiServiceFactory.java
src/gen/java/impl/
src/gen/java/impl/io/
src/gen/java/impl/io/swagger/
src/gen/java/impl/io/swagger/api/
src/gen/java/impl/io/swagger/api/ProjectsApiServiceImpl.java
src/gen/java/impl/io/swagger/api/TasksApiServiceImpl.java

“impl”包应该是结构中的最后一个节点。

我以编程方式调用swagger(但在http://editor.swagger.io/#/上使用在线编辑器时也会发生这种情况:

Swagger swagger = new SwaggerParser().read(location);

CodegenConfig config = CodegenConfigLoader.forName(this.language); //JAXRS
config.setOutputDir(new File(this.apiGenSrcPath).getPath());
config.additionalProperties().put(TEMPLATE_DIR_PARAM, targetTemplateDir + File.separator + JAXRS_DIR); //standard mustache from jaxrs

ClientOptInput input = new ClientOptInput().opts(new ClientOpts()).swagger(swagger);
input.setConfig(config);

DefaultGenerator generator = new DefaultGenerator();
generator.opts(input).generate();

有没有办法解决这个问题,或者这是一个已知问题?

0 个答案:

没有答案