mirror of https://github.com/Squidex/squidex.git
Browse Source
* Exception handling for scheduler. * Image hover * Fix transfer. * Fixes * Flush write. * OpenApi fixespull/995/head
committed by
GitHub
164 changed files with 843 additions and 477 deletions
@ -0,0 +1,96 @@ |
|||
// ==========================================================================
|
|||
// Squidex Headless CMS
|
|||
// ==========================================================================
|
|||
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|||
// All rights reserved. Licensed under the MIT license.
|
|||
// ==========================================================================
|
|||
|
|||
using NJsonSchema; |
|||
using NSwag; |
|||
using NSwag.Annotations; |
|||
using NSwag.Generation.Processors; |
|||
using NSwag.Generation.Processors.Contexts; |
|||
using Squidex.Domain.Apps.Entities; |
|||
using Squidex.Domain.Apps.Entities.Contents; |
|||
|
|||
#pragma warning disable MA0048 // File name must match type name
|
|||
|
|||
namespace Squidex.Areas.Api.Config.OpenApi; |
|||
|
|||
public sealed class AcceptHeader_Unpublished : AcceptHeaderAttribute |
|||
{ |
|||
public AcceptHeader_Unpublished() |
|||
: base(ContentHeaders.Unpublished, "Return unpublished content items.", JsonObjectType.Boolean) |
|||
{ |
|||
} |
|||
} |
|||
|
|||
public sealed class AcceptHeader_Flatten : AcceptHeaderAttribute |
|||
{ |
|||
public AcceptHeader_Flatten() |
|||
: base(ContentHeaders.Flatten, "Provide the data as flat object.", JsonObjectType.Boolean) |
|||
{ |
|||
} |
|||
} |
|||
|
|||
public sealed class AcceptHeader_Languages : AcceptHeaderAttribute |
|||
{ |
|||
public AcceptHeader_Languages() |
|||
: base(ContentHeaders.Languages, "Only resolve these languages (comma-separated).") |
|||
{ |
|||
} |
|||
} |
|||
|
|||
public sealed class AcceptHeader_NoTotal : AcceptHeaderAttribute |
|||
{ |
|||
public AcceptHeader_NoTotal() |
|||
: base(ContextHeaders.NoTotal, "Do not return the total amount.", JsonObjectType.Boolean) |
|||
{ |
|||
} |
|||
} |
|||
|
|||
public sealed class AcceptHeader_NoSlowTotal : AcceptHeaderAttribute |
|||
{ |
|||
public AcceptHeader_NoSlowTotal() |
|||
: base(ContextHeaders.NoSlowTotal, "Do not return the total amount, if it would be slow.", JsonObjectType.Boolean) |
|||
{ |
|||
} |
|||
} |
|||
|
|||
public class AcceptHeaderAttribute : OpenApiOperationProcessorAttribute |
|||
{ |
|||
public AcceptHeaderAttribute(string name, string description, JsonObjectType type = JsonObjectType.String) |
|||
: base(typeof(Processor), name, description, type) |
|||
{ |
|||
} |
|||
|
|||
public sealed class Processor : IOperationProcessor |
|||
{ |
|||
private readonly string name; |
|||
private readonly string description; |
|||
private readonly JsonObjectType type; |
|||
|
|||
public Processor(string name, string description, JsonObjectType type) |
|||
{ |
|||
this.name = name; |
|||
this.description = description; |
|||
this.type = type; |
|||
} |
|||
|
|||
public bool Process(OperationProcessorContext context) |
|||
{ |
|||
context.OperationDescription.Operation.Parameters.Add(new OpenApiParameter |
|||
{ |
|||
Name = name, |
|||
Kind = OpenApiParameterKind.Header, |
|||
Schema = new JsonSchema |
|||
{ |
|||
Type = type |
|||
}, |
|||
Description = description, |
|||
}); |
|||
|
|||
return true; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,36 @@ |
|||
// ==========================================================================
|
|||
// Squidex Headless CMS
|
|||
// ==========================================================================
|
|||
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|||
// All rights reserved. Licensed under the MIT license.
|
|||
// ==========================================================================
|
|||
|
|||
using NSwag.Annotations; |
|||
using NSwag.Generation.Processors; |
|||
using NSwag.Generation.Processors.Contexts; |
|||
|
|||
namespace Squidex.Areas.Api.Config.OpenApi; |
|||
|
|||
public sealed class AcceptQueryAttribute : OpenApiOperationProcessorAttribute |
|||
{ |
|||
public AcceptQueryAttribute(bool supportsSearch) |
|||
: base(typeof(Processor), supportsSearch) |
|||
{ |
|||
} |
|||
|
|||
public sealed class Processor : IOperationProcessor |
|||
{ |
|||
private readonly bool supportsSearch; |
|||
|
|||
public Processor(bool supportsSearch) |
|||
{ |
|||
this.supportsSearch = supportsSearch; |
|||
} |
|||
|
|||
public bool Process(OperationProcessorContext context) |
|||
{ |
|||
context.OperationDescription.Operation.AddQuery(supportsSearch); |
|||
return true; |
|||
} |
|||
} |
|||
} |
|||
@ -1,34 +0,0 @@ |
|||
// ==========================================================================
|
|||
// Squidex Headless CMS
|
|||
// ==========================================================================
|
|||
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|||
// All rights reserved. Licensed under the MIT license.
|
|||
// ==========================================================================
|
|||
|
|||
using NSwag; |
|||
using NSwag.Generation.Processors; |
|||
using NSwag.Generation.Processors.Contexts; |
|||
|
|||
namespace Squidex.Areas.Api.Config.OpenApi; |
|||
|
|||
public sealed class QueryParamsProcessor : IOperationProcessor |
|||
{ |
|||
private readonly string path; |
|||
|
|||
public QueryParamsProcessor(string path) |
|||
{ |
|||
this.path = path; |
|||
} |
|||
|
|||
public bool Process(OperationProcessorContext context) |
|||
{ |
|||
if (context.OperationDescription.Path == path && context.OperationDescription.Method == OpenApiOperationMethod.Get) |
|||
{ |
|||
var operation = context.OperationDescription.Operation; |
|||
|
|||
operation.AddQuery(false); |
|||
} |
|||
|
|||
return true; |
|||
} |
|||
} |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue