Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maintenance: minor code style issues #279

Merged
merged 1 commit into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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