From 3147fe87eb0b0862933cb6bc18d69e6f45c4c4d4 Mon Sep 17 00:00:00 2001 From: Apollo3zehn Date: Sat, 2 Mar 2024 23:36:02 +0100 Subject: [PATCH] Add workaround for https://github.com/RicoSuter/NSwag/issues/4681 --- openapi.json | 2 +- src/Nexus/Core/Models_Public.cs | 4 ++++ .../dotnet-extensibility/DataModel/Representation.cs | 2 ++ .../dotnet-extensibility/DataModel/Resource.cs | 7 +++++++ .../dotnet-extensibility/DataModel/ResourceCatalog.cs | 5 +++++ 5 files changed, 19 insertions(+), 1 deletion(-) diff --git a/openapi.json b/openapi.json index 486aeb2a..56d74ebe 100644 --- a/openapi.json +++ b/openapi.json @@ -1,5 +1,5 @@ { - "x-generator": "NSwag v13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))", + "x-generator": "NSwag v14.0.3.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))", "openapi": "3.0.0", "info": { "title": "Nexus REST API", diff --git a/src/Nexus/Core/Models_Public.cs b/src/Nexus/Core/Models_Public.cs index 19b8283a..572e05a2 100644 --- a/src/Nexus/Core/Models_Public.cs +++ b/src/Nexus/Core/Models_Public.cs @@ -123,8 +123,12 @@ public RefreshToken(Guid id, string token, DateTime expires, string description) /// public string Description { get; init; } + [JsonIgnore] + #warning Remove this when https://github.com/RicoSuter/NSwag/issues/4681 is solved internal bool IsExpired => DateTime.UtcNow >= Expires; + [JsonIgnore] + #warning Remove this when https://github.com/RicoSuter/NSwag/issues/4681 is solved internal InternalRefreshToken InternalRefreshToken { get; } #pragma warning disable CS1591 diff --git a/src/extensibility/dotnet-extensibility/DataModel/Representation.cs b/src/extensibility/dotnet-extensibility/DataModel/Representation.cs index 02b0cf0f..12abd97a 100644 --- a/src/extensibility/dotnet-extensibility/DataModel/Representation.cs +++ b/src/extensibility/dotnet-extensibility/DataModel/Representation.cs @@ -117,6 +117,8 @@ public IReadOnlyDictionary? Parameters /// /// The representation kind. /// + [JsonIgnore] + #warning Remove this when https://github.com/RicoSuter/NSwag/issues/4681 is solved internal RepresentationKind Kind { get; } /// diff --git a/src/extensibility/dotnet-extensibility/DataModel/Resource.cs b/src/extensibility/dotnet-extensibility/DataModel/Resource.cs index 5cbf2092..dce5bef3 100644 --- a/src/extensibility/dotnet-extensibility/DataModel/Resource.cs +++ b/src/extensibility/dotnet-extensibility/DataModel/Resource.cs @@ -1,5 +1,6 @@ using System.Diagnostics; using System.Text.Json; +using System.Text.Json.Serialization; using System.Text.RegularExpressions; namespace Nexus.DataModel @@ -43,16 +44,22 @@ public Resource( /// /// Gets a regular expression to validate a resource identifier. /// + [JsonIgnore] + #warning Remove this when https://github.com/RicoSuter/NSwag/issues/4681 is solved public static Regex ValidIdExpression { get; } = new Regex(@"^[a-zA-Z_][a-zA-Z_0-9]*$"); /// /// Gets a regular expression to find invalid characters in a resource identifier. /// + [JsonIgnore] + #warning Remove this when https://github.com/RicoSuter/NSwag/issues/4681 is solved public static Regex InvalidIdCharsExpression { get; } = new Regex(@"[^a-zA-Z_0-9]", RegexOptions.Compiled); /// /// Gets a regular expression to find invalid start characters in a resource identifier. /// + [JsonIgnore] + #warning Remove this when https://github.com/RicoSuter/NSwag/issues/4681 is solved public static Regex InvalidIdStartCharsExpression { get; } = new Regex(@"^[^a-zA-Z_]+", RegexOptions.Compiled); /// diff --git a/src/extensibility/dotnet-extensibility/DataModel/ResourceCatalog.cs b/src/extensibility/dotnet-extensibility/DataModel/ResourceCatalog.cs index 447cb007..6c75786e 100644 --- a/src/extensibility/dotnet-extensibility/DataModel/ResourceCatalog.cs +++ b/src/extensibility/dotnet-extensibility/DataModel/ResourceCatalog.cs @@ -2,6 +2,7 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Text.Json; +using System.Text.Json.Serialization; using System.Text.RegularExpressions; namespace Nexus.DataModel @@ -45,8 +46,12 @@ public ResourceCatalog( /// /// Gets a regular expression to validate a resource catalog identifier. /// + [JsonIgnore] + #warning Remove this when https://github.com/RicoSuter/NSwag/issues/4681 is solved public static Regex ValidIdExpression { get; } = new Regex(@"^(?:\/[a-zA-Z_][a-zA-Z_0-9]*)+$", RegexOptions.Compiled); + [JsonIgnore] + #warning Remove this when https://github.com/RicoSuter/NSwag/issues/4681 is solved private static Regex _matchSingleParametersExpression { get; } = new Regex(@"\s*(.+?)\s*=\s*([^,\)]+)\s*,?", RegexOptions.Compiled); ///