Browse Source

Nullable fix.

pull/566/head
Sebastian 5 years ago
parent
commit
bc06171505
  1. 2
      backend/src/Squidex.Domain.Apps.Core.Operations/GenerateJsonSchema/JsonSchemaExtensions.cs
  2. 8
      backend/src/Squidex.Domain.Apps.Core.Operations/GenerateJsonSchema/JsonTypeVisitor.cs
  3. 14
      backend/src/Squidex.Domain.Apps.Core.Operations/GenerateJsonSchema/SchemaBuilder.cs
  4. 1
      backend/src/Squidex.Domain.Apps.Entities/Apps/AppHistoryEventsCreator.cs
  5. 1
      backend/src/Squidex.Domain.Apps.Entities/Assets/AssetHistoryEventsCreator.cs
  6. 1
      backend/src/Squidex.Domain.Apps.Entities/Contents/ContentHistoryEventsCreator.cs
  7. 1
      backend/src/Squidex.Domain.Apps.Entities/Schemas/SchemaHistoryEventsCreator.cs
  8. 1
      backend/src/Squidex.Web/Pipeline/ApiCostsFilter.cs
  9. 7
      backend/src/Squidex/Areas/Api/Controllers/Rules/Models/RuleActionProcessor.cs
  10. 1
      backend/src/Squidex/Areas/Api/Controllers/Statistics/Models/CallsUsageDtoDto.cs

2
backend/src/Squidex.Domain.Apps.Core.Operations/GenerateJsonSchema/JsonSchemaExtensions.cs

@ -69,7 +69,7 @@ namespace Squidex.Domain.Apps.Core.GenerateJsonSchema
jsonProperty.Description = field.Name; jsonProperty.Description = field.Name;
} }
jsonProperty.IsRequired = field.RawProperties.IsRequired; jsonProperty.SetRequired(field.RawProperties.IsRequired);
return jsonProperty; return jsonProperty;
} }

8
backend/src/Squidex.Domain.Apps.Core.Operations/GenerateJsonSchema/JsonTypeVisitor.cs

@ -69,20 +69,16 @@ namespace Squidex.Domain.Apps.Core.GenerateJsonSchema
geolocationSchema.Properties.Add("latitude", new JsonSchemaProperty geolocationSchema.Properties.Add("latitude", new JsonSchemaProperty
{ {
Type = JsonObjectType.Number, Type = JsonObjectType.Number,
IsNullableRaw = false,
IsRequired = true,
Maximum = 90, Maximum = 90,
Minimum = -90 Minimum = -90
}); }.SetRequired(true));
geolocationSchema.Properties.Add("longitude", new JsonSchemaProperty geolocationSchema.Properties.Add("longitude", new JsonSchemaProperty
{ {
Type = JsonObjectType.Number, Type = JsonObjectType.Number,
IsNullableRaw = false,
IsRequired = true,
Maximum = 180, Maximum = 180,
Minimum = -180 Minimum = -180
}); }.SetRequired(true));
var reference = schemaResolver("GeolocationDto", geolocationSchema); var reference = schemaResolver("GeolocationDto", geolocationSchema);

14
backend/src/Squidex.Domain.Apps.Core.Operations/GenerateJsonSchema/SchemaBuilder.cs

@ -74,16 +74,12 @@ namespace Squidex.Domain.Apps.Core.GenerateJsonSchema
return property; return property;
} }
public static void SetRequired(this JsonSchemaProperty property, bool isRequired) public static JsonSchemaProperty SetRequired(this JsonSchemaProperty property, bool isRequired)
{ {
if (isRequired) property.IsRequired = isRequired;
{ property.IsNullableRaw = !isRequired;
property.IsRequired = true;
} return property;
else
{
property.IsNullableRaw = true;
}
} }
} }
} }

1
backend/src/Squidex.Domain.Apps.Entities/Apps/AppHistoryEventsCreator.cs

@ -12,7 +12,6 @@ using Squidex.Domain.Apps.Events.Apps;
using Squidex.Infrastructure; using Squidex.Infrastructure;
using Squidex.Infrastructure.EventSourcing; using Squidex.Infrastructure.EventSourcing;
using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.Reflection;
using Squidex.Infrastructure.Translations;
namespace Squidex.Domain.Apps.Entities.Apps namespace Squidex.Domain.Apps.Entities.Apps
{ {

1
backend/src/Squidex.Domain.Apps.Entities/Assets/AssetHistoryEventsCreator.cs

@ -10,7 +10,6 @@ using Squidex.Domain.Apps.Entities.History;
using Squidex.Domain.Apps.Events.Assets; using Squidex.Domain.Apps.Events.Assets;
using Squidex.Infrastructure.EventSourcing; using Squidex.Infrastructure.EventSourcing;
using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.Reflection;
using Squidex.Infrastructure.Translations;
namespace Squidex.Domain.Apps.Entities.Assets namespace Squidex.Domain.Apps.Entities.Assets
{ {

1
backend/src/Squidex.Domain.Apps.Entities/Contents/ContentHistoryEventsCreator.cs

@ -11,7 +11,6 @@ using Squidex.Domain.Apps.Events;
using Squidex.Domain.Apps.Events.Contents; using Squidex.Domain.Apps.Events.Contents;
using Squidex.Infrastructure.EventSourcing; using Squidex.Infrastructure.EventSourcing;
using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.Reflection;
using Squidex.Infrastructure.Translations;
namespace Squidex.Domain.Apps.Entities.Contents namespace Squidex.Domain.Apps.Entities.Contents
{ {

1
backend/src/Squidex.Domain.Apps.Entities/Schemas/SchemaHistoryEventsCreator.cs

@ -11,7 +11,6 @@ using Squidex.Domain.Apps.Events;
using Squidex.Domain.Apps.Events.Schemas; using Squidex.Domain.Apps.Events.Schemas;
using Squidex.Infrastructure.EventSourcing; using Squidex.Infrastructure.EventSourcing;
using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.Reflection;
using Squidex.Infrastructure.Translations;
namespace Squidex.Domain.Apps.Entities.Schemas namespace Squidex.Domain.Apps.Entities.Schemas
{ {

1
backend/src/Squidex.Web/Pipeline/ApiCostsFilter.cs

@ -12,7 +12,6 @@ using Microsoft.AspNetCore.Mvc.Filters;
using Squidex.Domain.Apps.Entities.Apps.Plans; using Squidex.Domain.Apps.Entities.Apps.Plans;
using Squidex.Infrastructure; using Squidex.Infrastructure;
using Squidex.Infrastructure.Log; using Squidex.Infrastructure.Log;
using Squidex.Infrastructure.Security;
namespace Squidex.Web.Pipeline namespace Squidex.Web.Pipeline
{ {

7
backend/src/Squidex/Areas/Api/Controllers/Rules/Models/RuleActionProcessor.cs

@ -11,6 +11,7 @@ using Namotion.Reflection;
using NJsonSchema; using NJsonSchema;
using NSwag.Generation.Processors; using NSwag.Generation.Processors;
using NSwag.Generation.Processors.Contexts; using NSwag.Generation.Processors.Contexts;
using Squidex.Domain.Apps.Core.GenerateJsonSchema;
using Squidex.Domain.Apps.Core.HandleRules; using Squidex.Domain.Apps.Core.HandleRules;
using Squidex.Domain.Apps.Core.Rules; using Squidex.Domain.Apps.Core.Rules;
using Squidex.Infrastructure; using Squidex.Infrastructure;
@ -43,10 +44,8 @@ namespace Squidex.Areas.Api.Controllers.Rules.Models
schema.Properties["actionType"] = new JsonSchemaProperty schema.Properties["actionType"] = new JsonSchemaProperty
{ {
Type = JsonObjectType.String, Type = JsonObjectType.String
IsRequired = true, }.SetRequired(true);
IsNullableRaw = null
};
foreach (var (key, value) in ruleRegistry.Actions) foreach (var (key, value) in ruleRegistry.Actions)
{ {

1
backend/src/Squidex/Areas/Api/Controllers/Statistics/Models/CallsUsageDtoDto.cs

@ -5,7 +5,6 @@
// All rights reserved. Licensed under the MIT license. // All rights reserved. Licensed under the MIT license.
// ========================================================================== // ==========================================================================
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;

Loading…
Cancel
Save