diff --git a/src/Squidex.Domain.Apps.Read/Contents/GraphQL/GraphQLModel.cs b/src/Squidex.Domain.Apps.Read/Contents/GraphQL/GraphQLModel.cs index 7e0d2b282..4fae34e62 100644 --- a/src/Squidex.Domain.Apps.Read/Contents/GraphQL/GraphQLModel.cs +++ b/src/Squidex.Domain.Apps.Read/Contents/GraphQL/GraphQLModel.cs @@ -172,12 +172,9 @@ namespace Squidex.Domain.Apps.Read.Contents.GraphQL public IGraphType GetSchemaType(Guid schemaId) { - return schemaTypes.GetOrAdd(schemaId, k => - { - var schemaEntity = schemas.GetOrDefault(k); + var schemaEntity = schemas.GetOrDefault(schemaId); - return schemaEntity != null ? new ContentGraphType(schemaEntity.Schema, this) : null; - }); + return schemaEntity != null ? schemaTypes.GetOrAdd(schemaId, k => new ContentGraphType(schemaEntity.Schema, this)) : null; } } } diff --git a/src/Squidex.Domain.Apps.Read/Contents/GraphQL/Types/GeolocationScalarType.cs b/src/Squidex.Domain.Apps.Read/Contents/GraphQL/Types/GeolocationScalarType.cs deleted file mode 100644 index b2bfcd388..000000000 --- a/src/Squidex.Domain.Apps.Read/Contents/GraphQL/Types/GeolocationScalarType.cs +++ /dev/null @@ -1,37 +0,0 @@ -// ========================================================================== -// GeolocationScalarType.cs -// Squidex Headless CMS -// ========================================================================== -// Copyright (c) Squidex Group -// All rights reserved. -// ========================================================================== - -using GraphQL.Language.AST; -using GraphQL.Types; -using Newtonsoft.Json.Linq; - -namespace Squidex.Domain.Apps.Read.Contents.GraphQL.Types -{ - public sealed class GeolocationScalarType : ScalarGraphType - { - public GeolocationScalarType() - { - Name = "Json"; - } - - public override object Serialize(object value) - { - return value; - } - - public override object ParseValue(object value) - { - return value != null ? value is JObject ? value : JObject.FromObject(value) : null; - } - - public override object ParseLiteral(IValue value) - { - return null; - } - } -} diff --git a/src/Squidex.Domain.Apps.Read/Contents/GraphQL/Types/JsonScalarType.cs b/src/Squidex.Domain.Apps.Read/Contents/GraphQL/Types/JsonScalarType.cs deleted file mode 100644 index ff40c0786..000000000 --- a/src/Squidex.Domain.Apps.Read/Contents/GraphQL/Types/JsonScalarType.cs +++ /dev/null @@ -1,37 +0,0 @@ -// ========================================================================== -// JsonScalarType.cs -// Squidex Headless CMS -// ========================================================================== -// Copyright (c) Squidex Group -// All rights reserved. -// ========================================================================== - -using GraphQL.Language.AST; -using GraphQL.Types; -using Newtonsoft.Json.Linq; - -namespace Squidex.Domain.Apps.Read.Contents.GraphQL.Types -{ - public sealed class JsonScalarType : ScalarGraphType - { - public JsonScalarType() - { - Name = "Json"; - } - - public override object Serialize(object value) - { - return value; - } - - public override object ParseValue(object value) - { - return value != null ? value is JObject ? value : JObject.FromObject(value) : null; - } - - public override object ParseLiteral(IValue value) - { - return null; - } - } -} diff --git a/tests/Squidex.Domain.Apps.Read.Tests/Contents/GraphQLTests.cs b/tests/Squidex.Domain.Apps.Read.Tests/Contents/GraphQLTests.cs index 3b776b689..ebc231141 100644 --- a/tests/Squidex.Domain.Apps.Read.Tests/Contents/GraphQLTests.cs +++ b/tests/Squidex.Domain.Apps.Read.Tests/Contents/GraphQLTests.cs @@ -52,7 +52,9 @@ namespace Squidex.Domain.Apps.Read.Contents new DateTimeFieldProperties())) .AddOrUpdateField(new ReferencesField(7, "my-references", Partitioning.Invariant, new ReferencesFieldProperties { SchemaId = schemaId })) - .AddOrUpdateField(new GeolocationField(8, "my-geolocation", Partitioning.Invariant, + .AddOrUpdateField(new ReferencesField(9, "my-invalid", Partitioning.Invariant, + new ReferencesFieldProperties { SchemaId = Guid.NewGuid() })) + .AddOrUpdateField(new GeolocationField(9, "my-geolocation", Partitioning.Invariant, new GeolocationFieldProperties())); private readonly Mock schemaRepository = new Mock();