Browse Source

Fallback handling for list fields.

pull/440/head
Sebastian Stehle 6 years ago
parent
commit
36f15a87ce
  1. 7
      backend/src/Squidex.Domain.Apps.Core.Model/Schemas/FieldProperties.cs
  2. 12
      backend/src/Squidex.Domain.Apps.Core.Model/Schemas/Json/JsonSchemaModel.cs

7
backend/src/Squidex.Domain.Apps.Core.Model/Schemas/FieldProperties.cs

@ -5,12 +5,19 @@
// All rights reserved. Licensed under the MIT license. // All rights reserved. Licensed under the MIT license.
// ========================================================================== // ==========================================================================
using System;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
namespace Squidex.Domain.Apps.Core.Schemas namespace Squidex.Domain.Apps.Core.Schemas
{ {
public abstract class FieldProperties : NamedElementPropertiesBase public abstract class FieldProperties : NamedElementPropertiesBase
{ {
[Obsolete]
public bool IsListField { get; set; }
[Obsolete]
public bool IsReferenceField { get; set; }
public bool IsRequired { get; set; } public bool IsRequired { get; set; }
public string? Placeholder { get; set; } public string? Placeholder { get; set; }

12
backend/src/Squidex.Domain.Apps.Core.Model/Schemas/Json/JsonSchemaModel.cs

@ -12,6 +12,8 @@ using Newtonsoft.Json;
using Squidex.Infrastructure; using Squidex.Infrastructure;
using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.Reflection;
#pragma warning disable CS0612 // Type or member is obsolete
namespace Squidex.Domain.Apps.Core.Schemas.Json namespace Squidex.Domain.Apps.Core.Schemas.Json
{ {
public sealed class JsonSchemaModel public sealed class JsonSchemaModel
@ -106,11 +108,21 @@ namespace Squidex.Domain.Apps.Core.Schemas.Json
schema = schema.ConfigureScripts(Scripts); schema = schema.ConfigureScripts(Scripts);
} }
if (FieldsInLists == null)
{
FieldsInLists = new FieldNames(Fields.Where(x => x.Properties.IsListField).Select(x => x.Name).ToArray());
}
if (FieldsInLists?.Count > 0) if (FieldsInLists?.Count > 0)
{ {
schema = schema.ConfigureFieldsInLists(FieldsInLists); schema = schema.ConfigureFieldsInLists(FieldsInLists);
} }
if (FieldsInReferences == null)
{
FieldsInLists = new FieldNames(Fields.Where(x => x.Properties.IsReferenceField).Select(x => x.Name).ToArray());
}
if (FieldsInReferences?.Count > 0) if (FieldsInReferences?.Count > 0)
{ {
schema = schema.ConfigureFieldsInReferences(FieldsInReferences); schema = schema.ConfigureFieldsInReferences(FieldsInReferences);

Loading…
Cancel
Save