Skip to content

Commit

Permalink
Fix for #3014, #3243, #2345, #3211, #3082
Browse files Browse the repository at this point in the history
  • Loading branch information
MaksimOrlov committed Feb 6, 2020
1 parent 05c6a5e commit 6e660f0
Show file tree
Hide file tree
Showing 7 changed files with 791 additions and 601 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,14 @@ private Set<ComparisonCondition> mergeModelBranch(UniqueTypeNameAdapter adapter,
Set<String> sameModels = new HashSet<String>();
Set<Model> modelsToCompare = new HashSet<Model>();

Iterator<String> nodesIt = nodes.iterator();

while (nodesIt.hasNext()) {
if (adapter.getTypeName(nodesIt.next()).isPresent()) {
nodesIt.remove();
}
}

if (!nodes.isEmpty()) {
mergingContext = mergeNodes(nodes, adapter, mergingContext);
modelsToCompare.addAll(buildModels(adapter, mergingContext));
Expand Down Expand Up @@ -213,9 +221,6 @@ private MergingContext mergeNodes(final Set<String> nodes, final UniqueTypeNameA
final Set<String> currentDependencies = new HashSet<String>();

for (final String modelId : nodes) {
if (adapter.getTypeName(modelId).isPresent()) {
continue;
}

if (!mergingContext.hasSeenBefore(modelId)) {
Set<ComparisonCondition> newDependencies = mergeModelBranch(adapter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,12 @@
import springfox.documentation.annotations.ApiIgnore;
import springfox.documentation.schema.Views;
import springfox.documentation.spring.web.dummy.DummyModels.Ignorable;
import springfox.documentation.spring.web.dummy.models.Bar;
import springfox.documentation.spring.web.dummy.models.Holder;
import springfox.documentation.spring.web.dummy.models.EnumType;
import springfox.documentation.spring.web.dummy.models.Example;
import springfox.documentation.spring.web.dummy.models.FancyPet;
import springfox.documentation.spring.web.dummy.models.Foo;
import springfox.documentation.spring.web.dummy.models.FoobarDto;
import springfox.documentation.spring.web.dummy.models.MapFancyPet;
import springfox.documentation.spring.web.dummy.models.Pet;
Expand Down Expand Up @@ -477,6 +480,12 @@ public RecursiveTypeWithNonEqualsConditionsOuterWithSubTypes methodToTestBidirec
throw new UnsupportedOperationException();
}

@ResponseBody
public Holder<Bar> methodToTestSpareModelsWithKnownTypes(
@RequestBody Foo model1, @RequestBody Holder<Bar> model2) {
throw new UnsupportedOperationException();
}

@ResponseBody
public Pet methodToTestIssue182(@RequestBody springfox.documentation.spring.web.dummy.models.same.Pet pet) {
throw new UnsupportedOperationException();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package springfox.documentation.spring.web.dummy.models;

import java.util.List;

public class Bar {

private Integer id;

private String name;

private List<Foo> foos;

public Integer getId() {
return id;
}

public void setId(Integer id) {
this.id = id;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public List<Foo> getFoos() {
return foos;
}

public void setFoos(List<Foo> foos) {
this.foos = foos;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package springfox.documentation.spring.web.dummy.models;

public class Foo {

private Integer id;

private String name;

public Integer getId() {
return id;
}

public void setId(Integer id) {
this.id = id;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package springfox.documentation.spring.web.dummy.models;

public class Holder<T> {

private T content;

private Wrapper<T> wrapper;

public T getContent() {
return content;
}

public void setContent(T content) {
this.content = content;
}

public Wrapper<T> getWrapper() {
return wrapper;
}

public void setWrapper(Wrapper<T> wrapper) {
this.wrapper = wrapper;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package springfox.documentation.spring.web.dummy.models;

public class Wrapper<T> {

private T object;

public T getObject() {
return object;
}

public void setObject(T object) {
this.object = object;
}

}

0 comments on commit 6e660f0

Please sign in to comment.