Skip to content

Commit

Permalink
Maintenance: minor code style issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sschnabe committed Aug 17, 2023
1 parent 892bcb9 commit 7c4fa14
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
5 changes: 2 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.compilerArgument>-Xlint:all,-processing,-unchecked,-rawtypes,-serial</maven.compiler.compilerArgument>

<invoker.parallelThreads>0.5C</invoker.parallelThreads>

<!-- ===================================================================== -->
<!-- ============================= Versions ============================== -->
<!-- ===================================================================== -->
Expand Down Expand Up @@ -327,9 +329,6 @@
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<parallelThreads>0.5C</parallelThreads>
</configuration>
</execution>
</executions>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ public class MicronautCodegen extends AbstractJavaCodegen
private boolean introspected = true;
private boolean dateTimeRelaxed = true;
private boolean pageable = false;
private boolean isClient = false;

public MicronautCodegen() {

Expand Down Expand Up @@ -230,11 +229,10 @@ public void processOpts() {
sourceFolder = getOrDefault.apply(SOURCE_FOLDER, projectFolder + File.separator + "openapi");
testFolder = getOrDefault.apply("testFolder", projectTestFolder + File.separator + "openapi");
modelNameSuffix = getOrDefault.apply(MODEL_NAME_SUFFIX, modelNameSuffix);
isClient = additionalProperties.containsKey(CLIENT_ID);

// add files to generate

if (isClient) {
if (additionalProperties.containsKey(CLIENT_ID)) {
apiTemplateFiles.put("apiClient.mustache", "Client.java");
} else {
apiTemplateFiles.put("apiServer.mustache", ".java");
Expand Down Expand Up @@ -556,18 +554,16 @@ public String toExampleValue(Schema schema) {
if (ModelUtils.isDateSchema(schema)) {
if ("java.time.LocalDate".equals(typeMapping.get(schema.getType()))) {
return "java.time.LocalDate." + value.map(v -> "parse(\"" + v + "\")").orElse("now()");
} else {
// we cannot provide a valid example for all possible date types
return "null";
}
// we cannot provide a valid example for all possible date types
return "null";
}
if (ModelUtils.isDateTimeSchema(schema)) {
if ("java.time.Instant".equals(typeMapping.get(schema.getType()))) {
return "java.time.Instant." + value.map(v -> "parse(\"" + v + "\")").orElse("now()");
} else {
// we cannot provide a valid example for all possible date types
return "null";
}
// we cannot provide a valid example for all possible date types
return "null";
}
if (ModelUtils.isByteArraySchema(schema) || ModelUtils.isBinarySchema(schema)) {
return value.orElse("\"byteArray\".getBytes()");
Expand Down

0 comments on commit 7c4fa14

Please sign in to comment.