From e099db52ba2300bcf9c3bd526a5e9eca8ea708ff Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 16 Jul 2021 17:41:04 +0200 Subject: [PATCH] Fix graphql issue. --- .../Contents/GraphQL/Types/Assets/AssetGraphType.cs | 1 + .../Contents/GraphQL/Types/Assets/AssetsResultGraphType.cs | 1 + .../Contents/GraphQL/Types/Contents/ComponentGraphType.cs | 1 + .../GraphQL/Types/Contents/ComponentInterfaceGraphType.cs | 1 + .../GraphQL/Types/Contents/ComponentUnionGraphType.cs | 1 + .../Contents/GraphQL/Types/Contents/ContentGraphType.cs | 7 ++++--- .../GraphQL/Types/Contents/ContentInterfaceGraphType.cs | 1 + .../GraphQL/Types/Contents/ContentResultGraphType.cs | 1 + .../Contents/GraphQL/Types/Contents/DataFlatGraphType.cs | 1 + .../Contents/GraphQL/Types/Contents/DataGraphType.cs | 3 +++ .../Contents/GraphQL/Types/Contents/DataInputGraphType.cs | 2 ++ .../Contents/GraphQL/Types/Contents/NestedGraphType.cs | 1 + .../GraphQL/Types/Contents/NestedInputGraphType.cs | 1 + .../GraphQL/Types/Contents/ReferenceUnionGraphType.cs | 1 + .../GraphQL/Types/Primitives/EntitySavedGraphType.cs | 1 + .../Contents/GraphQL/Types/Primitives/JsonNoopGraphType.cs | 1 + .../Contents/GraphQL/Types/UserGraphType.cs | 1 + 17 files changed, 23 insertions(+), 3 deletions(-) diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Assets/AssetGraphType.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Assets/AssetGraphType.cs index 41ff12ea9..c545ba152 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Assets/AssetGraphType.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Assets/AssetGraphType.cs @@ -20,6 +20,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.Assets { public AssetGraphType(bool canGenerateSourceUrl) { + // The name is used for equal comparison. Therefore it is important to treat it as readonly. Name = "Asset"; AddField(new FieldType diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Assets/AssetsResultGraphType.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Assets/AssetsResultGraphType.cs index 1b60992b1..4ca01240e 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Assets/AssetsResultGraphType.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Assets/AssetsResultGraphType.cs @@ -17,6 +17,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.Assets { public AssetsResultGraphType(IGraphType assetsList) { + // The name is used for equal comparison. Therefore it is important to treat it as readonly. Name = "AssetResultDto"; AddField(new FieldType diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ComponentGraphType.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ComponentGraphType.cs index cd0b72186..4ced5c670 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ComponentGraphType.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ComponentGraphType.cs @@ -17,6 +17,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.Contents { public ComponentGraphType(SchemaInfo schemaInfo) { + // The name is used for equal comparison. Therefore it is important to treat it as readonly. Name = schemaInfo.ComponentType; IsTypeOf = CheckType(schemaInfo.Schema.Id.ToString()); diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ComponentInterfaceGraphType.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ComponentInterfaceGraphType.cs index c56a440a6..cf3b9c51b 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ComponentInterfaceGraphType.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ComponentInterfaceGraphType.cs @@ -14,6 +14,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.Contents { public ComponentInterfaceGraphType() { + // The name is used for equal comparison. Therefore it is important to treat it as readonly. Name = "Component"; AddField(ContentFields.SchemaId); diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ComponentUnionGraphType.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ComponentUnionGraphType.cs index 0f5c31e03..0e12aebf8 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ComponentUnionGraphType.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ComponentUnionGraphType.cs @@ -23,6 +23,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.Contents public ComponentUnionGraphType(Builder builder, FieldInfo fieldInfo, ImmutableList? schemaIds) { + // The name is used for equal comparison. Therefore it is important to treat it as readonly. Name = fieldInfo.ReferenceType; if (schemaIds?.Any() == true) diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ContentGraphType.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ContentGraphType.cs index aeb86d7e0..2949ab385 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ContentGraphType.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ContentGraphType.cs @@ -19,9 +19,12 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.Contents public ContentGraphType(SchemaInfo schemaInfo) { - schemaId = schemaInfo.Schema.Id; + // The name is used for equal comparison. Therefore it is important to treat it as readonly. + Name = schemaInfo.ContentType; IsTypeOf = CheckType; + + schemaId = schemaInfo.Schema.Id; } private bool CheckType(object value) @@ -31,8 +34,6 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.Contents public void Initialize(Builder builder, SchemaInfo schemaInfo, IEnumerable allSchemas) { - Name = schemaInfo.ContentType; - AddField(ContentFields.Id); AddField(ContentFields.Version); AddField(ContentFields.Created); diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ContentInterfaceGraphType.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ContentInterfaceGraphType.cs index 363408c12..5411178f3 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ContentInterfaceGraphType.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ContentInterfaceGraphType.cs @@ -13,6 +13,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.Contents { public ContentInterfaceGraphType() { + // The name is used for equal comparison. Therefore it is important to treat it as readonly. Name = "Content"; AddField(ContentFields.Id); diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ContentResultGraphType.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ContentResultGraphType.cs index 6dbb55433..19c8a3fea 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ContentResultGraphType.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ContentResultGraphType.cs @@ -14,6 +14,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.Contents { public ContentResultGraphType(ContentGraphType contentType, SchemaInfo schemaInfo) { + // The name is used for equal comparison. Therefore it is important to treat it as readonly. Name = schemaInfo.ResultType; AddField(new FieldType diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/DataFlatGraphType.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/DataFlatGraphType.cs index 9f3667532..5478fbf40 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/DataFlatGraphType.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/DataFlatGraphType.cs @@ -15,6 +15,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.Contents { public DataFlatGraphType(Builder builder, SchemaInfo schemaInfo) { + // The name is used for equal comparison. Therefore it is important to treat it as readonly. Name = schemaInfo.DataFlatType; foreach (var fieldInfo in schemaInfo.Fields) diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/DataGraphType.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/DataGraphType.cs index bb52c087f..26dc39c83 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/DataGraphType.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/DataGraphType.cs @@ -16,6 +16,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.Contents { public DataGraphType(Builder builder, SchemaInfo schemaInfo) { + // The name is used for equal comparison. Therefore it is important to treat it as readonly. Name = schemaInfo.DataType; foreach (var fieldInfo in schemaInfo.Fields) @@ -26,6 +27,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.Contents { var fieldGraphType = new ObjectGraphType { + // The name is used for equal comparison. Therefore it is important to treat it as readonly. Name = fieldInfo.LocalizedType }; @@ -57,6 +59,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.Contents { var fieldGraphType = new ObjectGraphType { + // The name is used for equal comparison. Therefore it is important to treat it as readonly. Name = fieldInfo.LocalizedType }; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/DataInputGraphType.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/DataInputGraphType.cs index 0e18c6f49..279dce559 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/DataInputGraphType.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/DataInputGraphType.cs @@ -20,6 +20,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.Contents { public DataInputGraphType(Builder builder, SchemaInfo schemaInfo) { + // The name is used for equal comparison. Therefore it is important to treat it as readonly. Name = schemaInfo.DataInputType; foreach (var fieldInfo in schemaInfo.Fields) @@ -30,6 +31,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.Contents { var fieldGraphType = new InputObjectGraphType { + // The name is used for equal comparison. Therefore it is important to treat it as readonly. Name = fieldInfo.LocalizedInputType }; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/NestedGraphType.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/NestedGraphType.cs index 361526a8d..ab76e94a6 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/NestedGraphType.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/NestedGraphType.cs @@ -15,6 +15,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.Contents { public NestedGraphType(Builder builder, FieldInfo fieldInfo) { + // The name is used for equal comparison. Therefore it is important to treat it as readonly. Name = fieldInfo.NestedType; foreach (var nestedFieldInfo in fieldInfo.Fields) diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/NestedInputGraphType.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/NestedInputGraphType.cs index d286a3896..e85571dca 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/NestedInputGraphType.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/NestedInputGraphType.cs @@ -16,6 +16,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.Contents { public NestedInputGraphType(Builder builder, FieldInfo fieldInfo) { + // The name is used for equal comparison. Therefore it is important to treat it as readonly. Name = fieldInfo.NestedInputType; foreach (var nestedFieldInfo in fieldInfo.Fields) diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ReferenceUnionGraphType.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ReferenceUnionGraphType.cs index 9c0646348..28fc3335c 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ReferenceUnionGraphType.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Contents/ReferenceUnionGraphType.cs @@ -21,6 +21,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.Contents public ReferenceUnionGraphType(Builder builder, FieldInfo fieldInfo, ImmutableList? schemaIds) { + // The name is used for equal comparison. Therefore it is important to treat it as readonly. Name = fieldInfo.ReferenceType; if (schemaIds?.Any() == true) diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Primitives/EntitySavedGraphType.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Primitives/EntitySavedGraphType.cs index 00e8c8e5d..235a1149e 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Primitives/EntitySavedGraphType.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Primitives/EntitySavedGraphType.cs @@ -19,6 +19,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.Primitives private EntitySavedGraphType() { + // The name is used for equal comparison. Therefore it is important to treat it as readonly. Name = "EntitySavedResultDto"; AddField(new FieldType diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Primitives/JsonNoopGraphType.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Primitives/JsonNoopGraphType.cs index e37e39628..820812e93 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Primitives/JsonNoopGraphType.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/Primitives/JsonNoopGraphType.cs @@ -14,6 +14,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.Primitives { public JsonNoopGraphType() { + // The name is used for equal comparison. Therefore it is important to treat it as readonly. Name = "JsonScalar"; Description = "Unstructured Json object"; diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/UserGraphType.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/UserGraphType.cs index 484feae8e..070fd72b9 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/UserGraphType.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/GraphQL/Types/UserGraphType.cs @@ -21,6 +21,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types public UserGraphType() { + // The name is used for equal comparison. Therefore it is important to treat it as readonly. Name = "User"; AddField(new FieldType