Skip to content

Commit

Permalink
Migrated spatial types to new type system core. (#2304)
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Staib <michael@chillicream.com>
  • Loading branch information
PascalSenn and michaelstaib committed Oct 4, 2020
1 parent ed032ed commit 2497709
Show file tree
Hide file tree
Showing 191 changed files with 9,890 additions and 4,516 deletions.
3 changes: 2 additions & 1 deletion .build/Helpers.cs
Expand Up @@ -17,7 +17,8 @@ class Helpers
Path.Combine("HotChocolate", "PersistedQueries"),
Path.Combine("HotChocolate", "Utilities"),
Path.Combine("HotChocolate", "Data"),
Path.Combine("HotChocolate", "Filters")
Path.Combine("HotChocolate", "Filters"),
Path.Combine("HotChocolate", "Spatial")
};

public static IEnumerable<string> GetAllProjects(string sourceDirectory)
Expand Down
1 change: 0 additions & 1 deletion src/HotChocolate/Core/src/Types/Types/EnumType.cs
Expand Up @@ -220,6 +220,5 @@ public bool TryDeserialize(object? resultValue, out object? runtimeValue)
runtimeValue = null;
return false;
}

}
}
4 changes: 2 additions & 2 deletions src/HotChocolate/Core/src/Types/Types/Scalars/IdType.cs
Expand Up @@ -88,7 +88,7 @@ public override IValueNode ParseValue(object? runtimeValue)
{
if (runtimeValue is null)
{
return new NullValueNode(null);
return NullValueNode.Default;
}

if (runtimeValue is string s)
Expand All @@ -105,7 +105,7 @@ public override IValueNode ParseResult(object? resultValue)
{
if (resultValue is null)
{
return new NullValueNode(null);
return NullValueNode.Default;
}

if (resultValue is string s)
Expand Down
4 changes: 2 additions & 2 deletions src/HotChocolate/Core/test/Utilities/TestHelper.cs
@@ -1,4 +1,4 @@
using System;
using System;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using HotChocolate.Execution;
Expand Down Expand Up @@ -203,4 +203,4 @@ public static void AddDefaultConfiguration(IRequestExecutorBuilder builder)
.AddStarWarsRepositories();
}
}
}
}
@@ -1,6 +1,7 @@
using System;
using System.Linq.Expressions;
using HotChocolate.Language;
using HotChocolate.Types.Descriptors;
using HotChocolate.Utilities;

namespace HotChocolate.Data.Filters.Expressions
Expand Down Expand Up @@ -32,11 +33,9 @@ public class QueryableComparableInHandler
}

return FilterExpressionBuilder.In(
property,
context.RuntimeTypes.Peek().Source,
parsedValue);

throw new InvalidOperationException();
property,
context.RuntimeTypes.Peek().Source,
parsedValue);
}
}
}
Expand Up @@ -12,6 +12,8 @@ namespace HotChocolate.Data.Filters.Expressions
public class QueryableFilterProvider
: FilterProvider<QueryableFilterContext>
{
public static readonly string ContextDataKeys = nameof(QueryableFilterProvider);

public QueryableFilterProvider()
{
}
Expand All @@ -36,9 +38,13 @@ public override FieldMiddleware CreateExecutor<TEntityType>(NameString argumentN
// first we let the pipeline run and produce a result.
await next(context).ConfigureAwait(false);

// next we get the filter argument.
// next we get the filter argument. If the filter argument is already on the context
// we use this. This enabled overriding the context with LocalContextData
IInputField argument = context.Field.Arguments[argumentName];
IValueNode filter = context.ArgumentLiteral<IValueNode>(argumentName);
IValueNode filter = context.LocalContextData.ContainsKey(ContextDataKeys) &&
context.LocalContextData[ContextDataKeys] is IValueNode node
? node
: context.ArgumentLiteral<IValueNode>(argumentName);

// if no filter is defined we can stop here and yield back control.
if (filter.IsNull())
Expand All @@ -60,7 +66,8 @@ public override FieldMiddleware CreateExecutor<TEntityType>(NameString argumentN
if (source != null && argument.Type is IFilterInputType filterInput)
{
var visitorContext = new QueryableFilterContext(
filterInput, source is EnumerableQuery);
filterInput,
source is EnumerableQuery);

// rewrite GraphQL input object into expression tree.
Visitor.Visit(filter, visitorContext);
Expand Down
289 changes: 289 additions & 0 deletions src/HotChocolate/Spatial/HotChocolate.Spatial.sln

Large diffs are not rendered by default.

453 changes: 0 additions & 453 deletions src/HotChocolate/Spatial/SpatialTypes.sln

This file was deleted.

18 changes: 0 additions & 18 deletions src/HotChocolate/Spatial/demo/Directory.Build.props

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

111 changes: 0 additions & 111 deletions src/HotChocolate/Spatial/demo/Types.Spatial.Playground/GeoQueries.cs

This file was deleted.

26 changes: 0 additions & 26 deletions src/HotChocolate/Spatial/demo/Types.Spatial.Playground/Program.cs

This file was deleted.

0 comments on commit 2497709

Please sign in to comment.