swagger-api / swagger-api/swagger-codegen

[JAVA][maven] .swagger-codegen-ignore wildcards are not honoured

Open
#8,294 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

Maven plugin configuration:

<plugin>
  <groupId>io.swagger</groupId>
  <artifactId>swagger-codegen-maven-plugin</artifactId>
  <version>2.3.1</version>
    <executions>
      <execution>
        <id>generate-java-impl</id>
        <goals>
          <goal>generate</goal>
        </goals>
        <phase>generate-sources</phase>
        <configuration>
          <inputSpec>${project.basedir}/src/main/resources/core.yaml</inputSpec>
          <apiPackage>${project.groupId}.${project.artifactId}.swagger.api</apiPackage>
          <modelPackage>${project.groupId}.${project.artifactId}.swagger.model</modelPackage>
          <configOptions>
            <configPackage>${project.groupId}.${project.artifactId}.swagger.config</configPackage>
            <basePackage>${project.groupId}.${project.artifactId}.swagger</basePackage>
          </configOptions>
          <output>${project.basedir}</output>
          <language>spring</language>
          <generateSupportingFiles>true</generateSupportingFiles>
          <generateModelTests>false</generateModelTests>
          <generateApiTests>false</generateApiTests>
        </configuration>
      </execution>
    </executions>
</plugin>

Have created ${project.basedir}/.swagger-codegen-ignore file with contents

**/*
!src/**/*

And it wasn't honored during generation. Had overwritten my project files and got bunch of unneeded trash in root of my project.

Swagger-codegen version

Maven plugin version 2.3.1

Swagger declaration file content or url

irrelevant

Command line used for generation

mvn clean install

Steps to reproduce

All info above.

Related issues/PRs

None I know of.

Suggest a fix/enhancement

Make swagger-codegen-maven-plugin actually honour .swagger-codegen-ignore entries.

Currently have to manaully specify each trash file generated by plugin, which would not hold if it will be generating more of them in the future.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the report using the Maven plugin configuration, .swagger-codegen-ignore containing / and !src/*/*, and mvn clean install. Start by tracing how the Maven plugin reads the ignore file during generation; done means wildcard entries are honored and unignored src files are generated without overwriting or creating the reported root-level files.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.