mirror of https://github.com/Squidex/squidex.git
13 changed files with 58 additions and 22 deletions
@ -0,0 +1,33 @@ |
|||
// ==========================================================================
|
|||
// Squidex Headless CMS
|
|||
// ==========================================================================
|
|||
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|||
// All rights reserved. Licensed under the MIT license.
|
|||
// ==========================================================================
|
|||
|
|||
using System.Threading.Tasks; |
|||
using NJsonSchema; |
|||
using NSwag.SwaggerGeneration.Processors; |
|||
using NSwag.SwaggerGeneration.Processors.Contexts; |
|||
using Squidex.Infrastructure.Tasks; |
|||
|
|||
namespace Squidex.Areas.Api.Config.Swagger |
|||
{ |
|||
public class FixProcessor : IOperationProcessor |
|||
{ |
|||
private static readonly JsonSchema4 StringSchema = new JsonSchema4 { Type = JsonObjectType.String }; |
|||
|
|||
public Task<bool> ProcessAsync(OperationProcessorContext context) |
|||
{ |
|||
foreach (var parameter in context.Parameters.Values) |
|||
{ |
|||
if (parameter.IsRequired && parameter.Schema != null && parameter.Schema.Type == JsonObjectType.String) |
|||
{ |
|||
parameter.Schema = StringSchema; |
|||
} |
|||
} |
|||
|
|||
return TaskHelper.True; |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue