Skip to content

Commit b045c8e

Browse files
authored
feat: add excludeFromCodeCoverage CLI option and update to v7.12.0 of OpenAPI Geneator (#9)
* chore: update version numbers in pom.xml and fix systemProperties to systemPropertyVariables * chore: update BASE_VERSION to v7.12.0 and GENERATOR_VERSION to 1.1.0 in Dockerfile * feat: 🎉 add support for excluding code coverage in ASP.NET dependency injection generator by boolean parameter excludeFromCodeCoverage
1 parent f44221e commit b045c8e

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

docker/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
ARG BASE_VERSION=v7.10.0
1+
ARG BASE_VERSION=v7.12.0
22
FROM openapitools/openapi-generator-cli:${BASE_VERSION}
33

44
ARG GENERATOR_DIR=/opt/openapi-generator/modules/openapi-generator-cli/target
5-
ARG GENERATOR_VERSION=1.0.0
5+
ARG GENERATOR_VERSION=1.1.0
66

77
COPY --chmod=555 docker/scripts/docker-entrypoint.sh /usr/local/bin/
88
RUN ln -s /usr/local/bin/docker-entrypoint.sh /usr/local/bin/openapi-generator

pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<packaging>jar</packaging>
99
<name>openapi-generator-di</name>
1010
<description>OpenAPI Generator extension providing generators that use the dependency injection pattern</description>
11-
<version>1.0.0</version>
11+
<version>1.1.0</version>
1212
<build>
1313
<plugins>
1414
<plugin>
@@ -36,12 +36,12 @@
3636
<artifactId>maven-surefire-plugin</artifactId>
3737
<version>2.12</version>
3838
<configuration>
39-
<systemProperties>
39+
<systemPropertyVariables>
4040
<property>
4141
<name>loggerPath</name>
4242
<value>conf/log4j.properties</value>
4343
</property>
44-
</systemProperties>
44+
</systemPropertyVariables>
4545
<argLine>-Xms512m -Xmx1500m</argLine>
4646
<parallel>methods</parallel>
4747
<forkMode>pertest</forkMode>
@@ -127,7 +127,7 @@
127127
<!--
128128
If you update openapi-generator-version ensure you change the Dockerfile as well
129129
-->
130-
<openapi-generator-version>7.10.0</openapi-generator-version>
130+
<openapi-generator-version>7.12.0</openapi-generator-version>
131131
<maven-plugin-version>1.0.0</maven-plugin-version>
132132
<junit-version>4.13.2</junit-version>
133133
</properties>

src/main/java/org/openapitools/codegen/AspNetDependencyInjectGenerator.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public class AspNetDependencyInjectGenerator extends AbstractCSharpCodegen {
4949
public static final String OPERATION_RESULT_TASK = "operationResultTask";
5050
public static final String MODEL_CLASS_MODIFIER = "modelClassModifier";
5151
public static final String CREATE_PROJECT_FILE = "createProjectFile";
52+
public static final String EXCLUDE_FROM_CODECOVERAGE = "excludeFromCodeCoverage";
5253

5354
public static final String PROJECT_SDK = "projectSdk";
5455
public static final String SDK_WEB = "Microsoft.NET.Sdk.Web";
@@ -63,6 +64,7 @@ public class AspNetDependencyInjectGenerator extends AbstractCSharpCodegen {
6364
private boolean operationIsAsync = false;
6465
private boolean operationResultTask = false;
6566
private boolean createProjectFile = false;
67+
private boolean excludeFromCodeCoverage = false;
6668

6769
protected CliOption aspnetCoreVersion = new CliOption(ASPNET_CORE_VERSION, "ASP.NET Core version: 9.0, 8.0, 7.0, 6.0 (deprecated)");
6870
private CliOption modelClassModifier = new CliOption(MODEL_CLASS_MODIFIER, "Model Class Modifier can be nothing or partial");
@@ -302,6 +304,10 @@ public void processOpts() {
302304
createProjectFile = convertPropertyToBooleanAndWriteBack(CREATE_PROJECT_FILE);
303305
}
304306

307+
if (additionalProperties.containsKey(EXCLUDE_FROM_CODECOVERAGE)) {
308+
excludeFromCodeCoverage = convertPropertyToBooleanAndWriteBack(EXCLUDE_FROM_CODECOVERAGE);
309+
}
310+
305311
// Check for the modifiers etc.
306312
// The order of the checks is important.
307313
setModelClassModifier();

0 commit comments

Comments
 (0)