String scopeName = getString(node, "scope", "non_versioned");
Scope scope = parseScope(scopeName);
TypeManager typeManager = repository.getTypeManager();
// Be gentle to users of Lily 1.0
if (node.has("valueType") && node.get("valueType").isObject() && node.get("valueType").has("primitive")) {
throw new JsonFormatException("Lily 1.1 format change: the valueType should now be specified as a string" +
" rather than a nested object with the 'primitive' property.");
}
String valueTypeString = getString(node, "valueType");
ValueType valueType = typeManager.getValueType(ValueTypeNSConverter.fromJson(valueTypeString, namespaces));
FieldType fieldType = typeManager.newFieldType(valueType, name, scope);
String idString = getString(node, "id", null);
SchemaId id = null;
if (idString != null) {
id = new SchemaIdImpl(idString);