Package com.wordnik.swagger.model

Examples of com.wordnik.swagger.model.Model


        target.put(sModelEntry.getKey(), sModelEntry.getValue());
      } else {
        //we can encounter a known model with an unknown property
        //if (de)serialization is not symmetrical (@JsonIgnore on setter, @JsonProperty on getter).
        //In these cases, don't overwrite the entire model entry for that type, just add the unknown property.
        Model targetModelValue = target.get(sourceModelKey);
        Model sourceModelValue = sModelEntry.getValue();

        Map<String, ModelProperty> targetProperties = fromScalaMap(targetModelValue.properties());
        Map<String, ModelProperty> sourceProperties = fromScalaMap(sourceModelValue.properties());

        Set<String> newSourcePropKeys = newHashSet(sourceProperties.keySet());
        newSourcePropKeys.removeAll(targetProperties.keySet());
        Map<String, ModelProperty> mergedTargetProperties = Maps.newHashMap(targetProperties);
        for (String newProperty : newSourcePropKeys) {
          mergedTargetProperties.put(newProperty, sourceProperties.get(newProperty));
        }

        // uses scala generated copy constructor.
        Model mergedModel = targetModelValue.copy(
                targetModelValue.id(),
                targetModelValue.name(),
                targetModelValue.qualifiedType(),
                ScalaConverters.toScalaLinkedHashMap(mergedTargetProperties),
                targetModelValue.description(),
View Full Code Here


                || name.equalsIgnoreCase("set") || name.equalsIgnoreCase("collection");
    }

    public static void addModels(final Class<?> clazz, final Map<String, Model> models) {
        Option<Model> modelOption = ModelConverters.read(clazz, JavaToScalaUtil.toScalaImmutableMap(new java.util.HashMap<String, String>()));
        Model model;
        if(!modelOption.isEmpty()) {
           model = modelOption.get();
            if(!isIgnorableModel(model.name())) {
                models.put(model.name(), model);
            }
        }
    }
View Full Code Here

              each.propertyDescription(),
              each.allowableValues(),
              itemModelRef(each.getType())
      ));
    }
    return Optional.of(new Model(typeName(propertiesHost),
            typeName(propertiesHost),
            simpleQualifiedTypeName(propertiesHost),
            toScalaLinkedHashMap(properties),
            modelDescription(propertiesHost), Option.apply(""),
            Option.<String>empty(),
View Full Code Here

                v.setRequired(true);
            }
            prop.put(key, v.toSwaggerModel());
        }

        return new Model(id, name, qualifiedType, prop, Utils.getOption(description), Utils.getOption(baseModel),
                Utils.getOption(discriminator),
                Utils.toScalaImmutableList(subTypes));
    }
View Full Code Here

TOP

Related Classes of com.wordnik.swagger.model.Model

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.