mirror of https://github.com/Squidex/squidex.git
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.
39 lines
1.3 KiB
39 lines
1.3 KiB
// ==========================================================================
|
|
// Squidex Headless CMS
|
|
// ==========================================================================
|
|
// Copyright (c) Squidex UG (haftungsbeschränkt)
|
|
// All rights reserved. Licensed under the MIT license.
|
|
// ==========================================================================
|
|
|
|
using NSwag.Generation.Processors;
|
|
using NSwag.Generation.Processors.Contexts;
|
|
|
|
namespace Squidex.Areas.Api.Config.OpenApi
|
|
{
|
|
public sealed class ODataQueryParamsProcessor : IOperationProcessor
|
|
{
|
|
private readonly string supportedPath;
|
|
private readonly string entity;
|
|
private readonly bool supportSearch;
|
|
|
|
public ODataQueryParamsProcessor(string supportedPath, string entity, bool supportSearch)
|
|
{
|
|
this.entity = entity;
|
|
|
|
this.supportSearch = supportSearch;
|
|
this.supportedPath = supportedPath;
|
|
}
|
|
|
|
public bool Process(OperationProcessorContext context)
|
|
{
|
|
if (context.OperationDescription.Path == supportedPath)
|
|
{
|
|
var operation = context.OperationDescription.Operation;
|
|
|
|
operation.AddOData(entity, supportSearch);
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
|