mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-16 08:25:28 +00:00
.NET 10 (#3482)
* Initial .NET 10 bump * Use KnownIPNetworks * .NET 10 library updates * First round of trimming fixes * Fix docker in .NET 10 * Resolve trimming warning * Bump packages to rc2
This commit is contained in:
committed by
GitHub
parent
245daec72e
commit
c8e8cd27b8
@@ -22,10 +22,9 @@
|
||||
// limitations under the License.
|
||||
|
||||
using System;
|
||||
using System.Text.Json.Nodes;
|
||||
using JetBrains.Annotations;
|
||||
using Microsoft.OpenApi.Any;
|
||||
using Microsoft.OpenApi.Extensions;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Microsoft.OpenApi;
|
||||
|
||||
namespace ArchiSteamFarm.IPC.Integration;
|
||||
|
||||
@@ -36,10 +35,20 @@ public sealed class SwaggerSecurityCriticalAttribute : CustomSwaggerAttribute {
|
||||
public override void Apply(OpenApiSchema schema) {
|
||||
ArgumentNullException.ThrowIfNull(schema);
|
||||
|
||||
if (schema.Items is { Reference: null }) {
|
||||
schema.Items.AddExtension(ExtensionName, new OpenApiBoolean(true));
|
||||
} else {
|
||||
schema.AddExtension(ExtensionName, new OpenApiBoolean(true));
|
||||
JsonValue value = JsonValue.Create(true);
|
||||
|
||||
if (schema.Items != null) {
|
||||
if (schema.Items is OpenApiSchema items) {
|
||||
items.AddExtension(ExtensionName, new JsonNodeExtension(value));
|
||||
} else if (schema.Items.Extensions != null) {
|
||||
schema.Items.Extensions[ExtensionName] = new JsonNodeExtension(value);
|
||||
} else {
|
||||
throw new InvalidOperationException(nameof(schema.Items));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
schema.AddExtension(ExtensionName, new JsonNodeExtension(value));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user