Skip to content

Commit 0f89250

Browse files
committed
Handle Umbraco.Grid data type
1 parent d972c3f commit 0f89250

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/Our.Umbraco.GraphQL/Adapters/PublishedContent/Types/PublishedPropertyFieldType.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public PublishedPropertyFieldType(IPublishedContentType contentType, PropertyTyp
3030
unwrappedTypeInfo = typeof(IPublishedElement).GetTypeInfo();
3131

3232
var propertyGraphType = typeRegistry.Get(unwrappedTypeInfo) ?? typeof(StringGraphType).GetTypeInfo();
33-
propertyGraphType = propertyGraphType.Wrap(type, propertyType.Mandatory, false);
33+
propertyGraphType = propertyGraphType.Wrap(type, propertyType.Mandatory, false, propertyType.PropertyEditorAlias != global::Umbraco.Core.Constants.PropertyEditors.Aliases.Grid);
3434

3535
if (propertyType.VariesByCulture())
3636
{
@@ -44,8 +44,11 @@ public PublishedPropertyFieldType(IPublishedContentType contentType, PropertyTyp
4444
Name = publishedPropertyType.Alias.ToCamelCase();
4545
Description = propertyType.Description;
4646
Resolver = new FuncFieldResolver<IPublishedElement, object>(context =>
47-
context.Source.Value(propertyType.Alias, context.GetArgument<string>("culture"),
48-
fallback: Fallback.ToLanguage));
47+
{
48+
var val = context.Source.Value(propertyType.Alias, context.GetArgument<string>("culture"),
49+
fallback: Fallback.ToLanguage);
50+
return val;
51+
});
4952
}
5053
}
5154
}

src/Our.Umbraco.GraphQL/Reflection/TypeInfoExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ public static TypeInfo Unwrap(this TypeInfo typeInfo)
3838
return enumerableArgument != null ? enumerableArgument.GetTypeInfo() : typeInfo;
3939
}
4040

41-
public static TypeInfo Wrap(this TypeInfo graphType, TypeInfo typeInfo, bool isNonNull, bool isNonNullItem)
41+
public static TypeInfo Wrap(this TypeInfo graphType, TypeInfo typeInfo, bool isNonNull, bool isNonNullItem, bool checkEnumerable = true)
4242
{
4343
if (graphType == null)
4444
return null;
4545

46-
var enumerableArgument = GetEnumerableArgument(typeInfo);
46+
var enumerableArgument = checkEnumerable ? GetEnumerableArgument(typeInfo) : null;
4747

4848
if (typeInfo.IsValueType && typeInfo.IsNullable() == false || enumerableArgument != null &&
4949
(enumerableArgument.IsValueType && enumerableArgument.IsNullable() == false || isNonNullItem))

0 commit comments

Comments
 (0)