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

[Java/Spring] all-of and one-of Improvements and Fixes #12075

Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
da4712c
Add config to reproduce the issue
cachescrubber Apr 5, 2022
af9d7b3
Add test case to reproduce issue.
cachescrubber Apr 5, 2022
628de7d
Debug Session: identify critical codep path
cachescrubber Apr 6, 2022
3a26775
Works exactly as needed for oneOf/allOf in Java/Spring
cachescrubber Apr 6, 2022
ca6ee6e
Add allVars to omit list in OneOfImplementorAdditionalData
cachescrubber Apr 7, 2022
a4d79b3
SpringCodegen: Support parentVars in order to support fluent setter w…
cachescrubber Apr 7, 2022
34fe8af
Generate Samples
cachescrubber Apr 7, 2022
751455f
Add imports for inherited Properties
cachescrubber Apr 7, 2022
3fd8712
Add JavaDoc
cachescrubber Apr 7, 2022
3bb412a
Polishing
cachescrubber Apr 7, 2022
e224d61
add a link to zozo tech blog post
wing328 Apr 5, 2022
e7075d2
[java] Add jersey3 support to the Java client (#12046)
wing328 Apr 5, 2022
10e1a60
more checks in validateJsonObject (#12041)
wing328 Apr 5, 2022
4827d74
add response headers to api exception (#12042)
wing328 Apr 5, 2022
91bfb2f
[Ruby] Fix incorrectly capitalized identifier in apis template (#12045)
harmony7 Apr 5, 2022
726dcc0
update jackson databind to newer version (#12053)
wing328 Apr 5, 2022
7ebd09e
[PowerShell] add more tests to powershell client (#12057)
wing328 Apr 6, 2022
0924cab
comment out error message debug (#12056)
wing328 Apr 6, 2022
3f197e4
Reduce casting for operations processing (#12002)
borsch Apr 6, 2022
4e2995d
[typescript] Support esbuild, second attempt (#11465)
bodograumann Apr 6, 2022
13dbbc7
Fix the null pointer exception when generating examples for schemas i…
spacether Apr 7, 2022
6f3bf90
surefire plugin 3.0.0-M6 (#12076)
sullis Apr 7, 2022
852f8c3
[python-experimental] adds missing init files in endpoint modules (#1…
spacether Apr 7, 2022
1ed0ba7
testng 7.5 (#11380)
sullis Apr 7, 2022
1cee11e
Eliminates handlebars helper warnings (#12078)
spacether Apr 7, 2022
324d000
Adds postProcess method to python-experimental (#12079)
spacether Apr 7, 2022
231364f
[PowerShell] better enum model support (#12082)
wing328 Apr 8, 2022
9cf3029
docs: updated supported angular version (#12072)
takkiraz Apr 8, 2022
a5b7900
Fixed typo in readme which caused the project link to be broken (#12083)
lukacsaronzs Apr 8, 2022
1643c55
Bump actions/setup-java from 2 to 3 (#12087)
dependabot[bot] Apr 9, 2022
a1c4e37
Configure apiNameSuffix via plugins (#12062)
borsch Apr 9, 2022
940d240
[dart-dio] Adds support for enumUnknownDefaultCase to dart builtvalue…
josh-burton Apr 9, 2022
23995be
[php-slim4] Add Mock Server (#12044)
ybelenko Apr 9, 2022
5f4eccd
Adds 'params_encoder' config option for Ruby clients using Faraday (#…
dkliban Apr 9, 2022
eb4c696
Remove restrictions for additional property types (#11802)
impl Apr 9, 2022
bd9f1b6
Specify source encoding in java/kotlin sample poms templates (#12088)
wing328 Apr 9, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@
import java.util.Arrays;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.stream.Collectors;
import org.apache.commons.lang3.tuple.Pair;
Expand Down Expand Up @@ -894,6 +897,7 @@ public Map<String, ModelsMap> postProcessAllModels(Map<String, ModelsMap> objs)
for (ModelsMap modelsAttrs : objs.values()) {
for (ModelMap mo : modelsAttrs.getModels()) {
CodegenModel codegenModel = mo.getModel();
Set<String> additionalImports = new HashSet<>();
Map<String, CodegenProperty> propertyHash = new HashMap<>(codegenModel.vars.size());
for (final CodegenProperty property : codegenModel.vars) {
propertyHash.put(property.name, property);
Expand All @@ -908,10 +912,27 @@ public Map<String, ModelsMap> postProcessAllModels(Map<String, ModelsMap> objs)
parentVar.isInherited = true;
LOGGER.info("adding parent variable {}", property.name);
codegenModel.parentVars.add(parentVar);
Set<String> imports = parentVar.getImports(true).stream().filter(Objects::nonNull).collect(Collectors.toSet());
for (String imp: imports) {
// Avoid dupes
if (!codegenModel.getImports().contains(imp)) {
additionalImports.add(imp);
codegenModel.getImports().add(imp);
}
}
}
}
parentCodegenModel = parentCodegenModel.getParentModel();
}
// There must be a better way ...
for (String imp: additionalImports) {
String qimp = importMapping().get(imp);
if (qimp != null) {
Map<String,String> toAdd = new HashMap<>();
toAdd.put("import", qimp);
modelsAttrs.getImports().add(toAdd);
}
}
}
}
return objs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1026,6 +1026,7 @@ public void oneOf_allOf() throws IOException {
// previous bugs
assertFileNotContains(Paths.get(outputPath + "/src/main/java/org/openapitools/model/BarRef.java"), "atTypesuper.hashCode");
assertFileNotContains(Paths.get(outputPath + "/src/main/java/org/openapitools/model/BarRef.java"), "private String atBaseType");
assertFileContains(Paths.get(outputPath + "/src/main/java/org/openapitools/model/PizzaSpeziale.java"), "import java.math.BigDecimal");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import org.openapitools.model.Pizza;
import java.math.BigDecimal;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An import needed for the fluent setter.

import org.openapitools.jackson.nullable.JsonNullable;
import java.time.OffsetDateTime;
import javax.validation.Valid;
Expand Down