Headless CMS and Content Managment Hub
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

31 lines
1.1 KiB

// ==========================================================================
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex UG (haftungsbeschraenkt)
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using NJsonSchema;
using NSwag.Generation.Processors;
using NSwag.Generation.Processors.Contexts;
namespace Squidex.Areas.Api.Config.OpenApi
{
public sealed class FixProcessor : IOperationProcessor
{
private static readonly JsonSchema StringSchema = new JsonSchema { Type = JsonObjectType.String };
public bool Process(OperationProcessorContext context)
{
foreach (var (_, parameter) in context.Parameters)
{
if (parameter.IsRequired && parameter.Schema != null && parameter.Schema.Type == JsonObjectType.String)
{
parameter.Schema = StringSchema;
}
}
return true;
}
}
}