fixed ComposedModel definitions model bug when used with examples

This commit is contained in:
Hugo de Paix de Coeur
2016-03-02 19:07:00 +01:00
parent c0f758ba9b
commit 3c0e545661
2 changed files with 8 additions and 5 deletions

View File

@@ -304,8 +304,7 @@ public class DefinitionsDocument extends MarkupDocument {
return definitions.containsKey(ref)
? getAllProperties(definitions, definitions.get(ref))
: null;
}
if (model instanceof ComposedModel) {
} else if (model instanceof ComposedModel) {
ComposedModel composedModel = (ComposedModel) model;
Map<String, Property> allProperties = new HashMap<>();
if (composedModel.getAllOf() != null) {

View File

@@ -13,6 +13,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -158,12 +159,15 @@ public class ExamplesUtil {
private static Map<String, Property> getPropertiesForComposedModel(ComposedModel model, Map<String, Model> definitions) {
Map<String, Property> combinedProperties;
if (model.getParent() instanceof RefModel) {
combinedProperties = definitions.get(((RefModel) model.getParent()).getSimpleRef()).getProperties();
if (combinedProperties == null) {
Map<String, Property> parentProperties = definitions.get(((RefModel) model.getParent()).getSimpleRef()).getProperties();
if (parentProperties == null) {
return null;
} else {
combinedProperties = new LinkedHashMap<>(parentProperties);
}
} else {
combinedProperties = model.getParent().getProperties();
combinedProperties = new LinkedHashMap<>(model.getParent().getProperties());
}
Map<String, Property> childProperties;
if (model.getChild() instanceof RefModel) {