Browse Source

Fix open api.

pull/708/head
Sebastian Stehle 5 years ago
parent
commit
315dc8e29a
  1. 2
      backend/src/Squidex/Areas/Api/Config/OpenApi/OpenApiServices.cs
  2. 38
      backend/src/Squidex/Areas/Api/Config/OpenApi/ReflectionServices.cs

2
backend/src/Squidex/Areas/Api/Config/OpenApi/OpenApiServices.cs

@ -103,6 +103,8 @@ namespace Squidex.Areas.Api.Config.OpenApi
{
settings.AllowReferencesWithProperties = true;
settings.ReflectionService = new ReflectionServices();
settings.TypeMappers = new List<ITypeMapper>
{
CreateStringMap<DomainId>(),

38
backend/src/Squidex/Areas/Api/Config/OpenApi/ReflectionServices.cs

@ -0,0 +1,38 @@
// ==========================================================================
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex UG (haftungsbeschraenkt)
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using Namotion.Reflection;
using NJsonSchema.Generation;
using Squidex.Infrastructure.Collections;
namespace Squidex.Areas.Api.Config.OpenApi
{
public class ReflectionServices : DefaultReflectionService
{
protected override bool IsArrayType(ContextualType contextualType)
{
if (contextualType.Type.IsGenericType &&
contextualType.Type.GetGenericTypeDefinition() == typeof(ImmutableList<>))
{
return true;
}
return base.IsArrayType(contextualType);
}
protected override bool IsDictionaryType(ContextualType contextualType)
{
if (contextualType.Type.IsGenericType &&
contextualType.Type.GetGenericTypeDefinition() == typeof(ImmutableDictionary<,>))
{
return true;
}
return base.IsDictionaryType(contextualType);
}
}
}
Loading…
Cancel
Save