From dde5b9c9413253d22988a4ad246605e62ee1d778 Mon Sep 17 00:00:00 2001 From: Ivar Nesje Date: Thu, 21 Nov 2024 12:16:54 +0100 Subject: [PATCH] Fix nullability and update a few minor things in the generated swagger --- .../Extensions/ServiceCollectionExtensions.cs | 4 ++-- .../Extensions/ServiceCollectionExtensions.cs | 2 ++ test/Altinn.App.Api.Tests/OpenApi/swagger.json | 17 +++++------------ test/Altinn.App.Api.Tests/OpenApi/swagger.yaml | 8 +------- 4 files changed, 10 insertions(+), 21 deletions(-) diff --git a/src/Altinn.App.Api/Extensions/ServiceCollectionExtensions.cs b/src/Altinn.App.Api/Extensions/ServiceCollectionExtensions.cs index 77e581da3..2b4e41f47 100644 --- a/src/Altinn.App.Api/Extensions/ServiceCollectionExtensions.cs +++ b/src/Altinn.App.Api/Extensions/ServiceCollectionExtensions.cs @@ -362,12 +362,12 @@ internal sealed class OtelPropagator : TextMapPropagator public OtelPropagator(TextMapPropagator inner) => _inner = inner; - public override ISet Fields => _inner.Fields; + public override ISet? Fields => _inner.Fields; public override PropagationContext Extract( PropagationContext context, T carrier, - Func> getter + Func?> getter ) { if (carrier is HttpRequest) diff --git a/src/Altinn.App.Core/Extensions/ServiceCollectionExtensions.cs b/src/Altinn.App.Core/Extensions/ServiceCollectionExtensions.cs index 5edb3fe70..e74a0bf38 100644 --- a/src/Altinn.App.Core/Extensions/ServiceCollectionExtensions.cs +++ b/src/Altinn.App.Core/Extensions/ServiceCollectionExtensions.cs @@ -106,7 +106,9 @@ IWebHostEnvironment env #pragma warning restore CS0618 // Type or member is obsolete services.AddHttpClient(); services.AddHttpClient(); +#pragma warning disable EXTEXP0018 // is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. services.AddHybridCache(); +#pragma warning restore EXTEXP0018 services.TryAddTransient(); services.TryAddTransient(); diff --git a/test/Altinn.App.Api.Tests/OpenApi/swagger.json b/test/Altinn.App.Api.Tests/OpenApi/swagger.json index 56aebd1b2..4a445daf5 100644 --- a/test/Altinn.App.Api.Tests/OpenApi/swagger.json +++ b/test/Altinn.App.Api.Tests/OpenApi/swagger.json @@ -5259,8 +5259,7 @@ "actions": { "type": "object", "additionalProperties": { - "type": "boolean", - "nullable": true + "type": "boolean" }, "nullable": true }, @@ -5479,8 +5478,7 @@ "features": { "type": "object", "additionalProperties": { - "type": "boolean", - "nullable": true + "type": "boolean" }, "nullable": true }, @@ -6503,12 +6501,8 @@ "JsonNodeOptions": { "type": "object", "properties": { - "hasValue": { - "type": "boolean", - "readOnly": true - }, - "value": { - "$ref": "#/components/schemas/JsonNodeOptions" + "propertyNameCaseInsensitive": { + "type": "boolean" } }, "additionalProperties": false @@ -7349,8 +7343,7 @@ "items": { "$ref": "#/components/schemas/ValidationIssueWithSource" } - }, - "nullable": true + } }, "nullable": true }, diff --git a/test/Altinn.App.Api.Tests/OpenApi/swagger.yaml b/test/Altinn.App.Api.Tests/OpenApi/swagger.yaml index d4db12244..6b3ff672b 100644 --- a/test/Altinn.App.Api.Tests/OpenApi/swagger.yaml +++ b/test/Altinn.App.Api.Tests/OpenApi/swagger.yaml @@ -3215,7 +3215,6 @@ components: type: object additionalProperties: type: boolean - nullable: true nullable: true userActions: type: array @@ -3374,7 +3373,6 @@ components: type: object additionalProperties: type: boolean - nullable: true nullable: true logo: $ref: '#/components/schemas/Logo' @@ -4115,11 +4113,8 @@ components: JsonNodeOptions: type: object properties: - hasValue: + propertyNameCaseInsensitive: type: boolean - readOnly: true - value: - $ref: '#/components/schemas/JsonNodeOptions' additionalProperties: false JsonPatch: type: object @@ -4727,7 +4722,6 @@ components: type: array items: $ref: '#/components/schemas/ValidationIssueWithSource' - nullable: true nullable: true clientActions: type: array