From 034f67802985d5731a9ec58512b409f7d6b60b3e Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 12 Nov 2025 11:25:17 +0100 Subject: [PATCH 01/15] Migrate to .NET 10 --- .editorconfig | 2 ++ .github/.github.csproj | 2 +- Directory.Build.props | 2 +- Directory.Packages.props | 29 +++++++++---------- aspire/aspire.csproj | 2 +- build/build.fsproj | 2 +- docs/docs.csproj | 2 +- global.json | 2 +- src/Elastic.ApiExplorer/ApiRenderContext.cs | 2 +- .../Elastic.ApiExplorer.csproj | 3 +- .../Endpoints/ApiEndpoint.cs | 2 +- .../Landing/LandingViewModel.cs | 2 +- src/Elastic.ApiExplorer/OpenApiGenerator.cs | 11 ++++--- src/Elastic.ApiExplorer/OpenApiReader.cs | 2 +- .../Operations/OperationNavigationItem.cs | 5 ++-- .../Operations/OperationView.cshtml | 9 +++--- .../Assembler/GoogleTagManager.cs | 8 ++--- .../BuildContext.cs | 6 ++-- .../Builder/ConfigurationFile.cs | 6 ++-- ...Elastic.Documentation.Configuration.csproj | 2 +- .../Elastic.Documentation.LegacyDocs.csproj | 2 +- .../Elastic.Documentation.LinkIndex.csproj | 2 +- .../Elastic.Documentation.Links.csproj | 2 +- .../Elastic.Documentation.Navigation.csproj | 2 +- .../Node/DocumentationSetNavigation.cs | 11 +++---- ...astic.Documentation.ServiceDefaults.csproj | 2 +- .../Elastic.Documentation.Site.csproj | 2 +- .../Elastic.Documentation.csproj | 2 +- .../ProcessorDiagnosticExtensions.cs | 4 +-- src/Elastic.Markdown/Elastic.Markdown.csproj | 2 +- src/Elastic.Markdown/IO/MarkdownFile.cs | 13 ++++----- .../Myst/CodeBlocks/EnhancedCodeBlock.cs | 2 +- .../Myst/Directives/Image/ImageViewModel.cs | 6 ++-- src/Elastic.Markdown/Myst/MarkdownParser.cs | 25 +++++++--------- .../Elastic.Documentation.Api.Core.csproj | 2 +- ...ic.Documentation.Api.Infrastructure.csproj | 2 +- .../Elastic.Documentation.Api.Lambda.csproj | 2 +- .../Elastic.Documentation.Refactor.csproj | 2 +- .../docs-lambda-index-publisher.csproj | 2 +- .../Elastic.Documentation.Assembler.csproj | 2 +- .../Elastic.Documentation.Isolated.csproj | 2 +- .../Elastic.Documentation.Services.csproj | 2 +- .../Console/GithubAnnotationOutput.cs | 2 +- src/tooling/docs-builder/Http/LiveReload.cs | 2 ++ src/tooling/docs-builder/docs-builder.csproj | 4 ++- .../Elastic.Assembler.IntegrationTests.csproj | 2 +- .../Elastic.ApiExplorer.Tests.csproj | 2 +- ...umentation.Api.Infrastructure.Tests.csproj | 2 +- ...c.Documentation.Configuration.Tests.csproj | 2 +- ...stic.Documentation.LegacyDocs.Tests.csproj | 2 +- .../Elastic.Markdown.Tests.csproj | 2 +- .../Navigation.Tests/Navigation.Tests.csproj | 2 +- tests/authoring/authoring.fsproj | 2 +- 53 files changed, 105 insertions(+), 113 deletions(-) diff --git a/.editorconfig b/.editorconfig index 65d0ce884..ee3cd1dd4 100644 --- a/.editorconfig +++ b/.editorconfig @@ -246,6 +246,8 @@ dotnet_diagnostic.IDE0305.severity = none # CS8509 already warns dotnet_diagnostic.IDE0072.severity = none +dotnet_diagnostic.CA1873.severity = suggestion + [src/api/Elastic.Documentation.Api.Lambda/**.cs] dotnet_diagnostic.IL3050.severity = none dotnet_diagnostic.IL2026.severity = none diff --git a/.github/.github.csproj b/.github/.github.csproj index ea6821a8f..9e1058015 100644 --- a/.github/.github.csproj +++ b/.github/.github.csproj @@ -1,6 +1,6 @@ - net9.0 + net10.0 False diff --git a/Directory.Build.props b/Directory.Build.props index 34acca458..3f89a0761 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -14,7 +14,7 @@ true canary.0 0.1 - latest + preview true true $([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), build.sh)) diff --git a/Directory.Packages.props b/Directory.Packages.props index b08adf805..47d3772ad 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -20,24 +20,23 @@ - - + + - + - - - + + @@ -48,17 +47,17 @@ - + - + - - + + @@ -68,7 +67,7 @@ - + @@ -76,8 +75,8 @@ - - + + @@ -85,14 +84,14 @@ - + - + diff --git a/aspire/aspire.csproj b/aspire/aspire.csproj index d460ba9a5..6c7254720 100644 --- a/aspire/aspire.csproj +++ b/aspire/aspire.csproj @@ -4,7 +4,7 @@ Exe - net9.0 + net10.0 enable enable 72f50f33-6fb9-4d08-bff3-39568fe370b3 diff --git a/build/build.fsproj b/build/build.fsproj index 1f1caa585..2afdd4670 100644 --- a/build/build.fsproj +++ b/build/build.fsproj @@ -1,6 +1,6 @@ - net9.0 + net10.0 Exe $(NoWarn);NU1701 false diff --git a/docs/docs.csproj b/docs/docs.csproj index 36ca01444..1dd24ff8c 100644 --- a/docs/docs.csproj +++ b/docs/docs.csproj @@ -1,6 +1,6 @@ - net9.0 + net10.0 False diff --git a/global.json b/global.json index 00b67caef..fe7e453b1 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "9.0.100", + "version": "10.0.100", "rollForward": "latestFeature", "allowPrerelease": false } diff --git a/src/Elastic.ApiExplorer/ApiRenderContext.cs b/src/Elastic.ApiExplorer/ApiRenderContext.cs index 749ebc42a..3017c3dc5 100644 --- a/src/Elastic.ApiExplorer/ApiRenderContext.cs +++ b/src/Elastic.ApiExplorer/ApiRenderContext.cs @@ -7,7 +7,7 @@ using Elastic.Documentation.Navigation; using Elastic.Documentation.Site.FileProviders; using Elastic.Documentation.Site.Navigation; -using Microsoft.OpenApi.Models; +using Microsoft.OpenApi; namespace Elastic.ApiExplorer; diff --git a/src/Elastic.ApiExplorer/Elastic.ApiExplorer.csproj b/src/Elastic.ApiExplorer/Elastic.ApiExplorer.csproj index e3268592a..3cf18fdd4 100644 --- a/src/Elastic.ApiExplorer/Elastic.ApiExplorer.csproj +++ b/src/Elastic.ApiExplorer/Elastic.ApiExplorer.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 enable enable true @@ -15,7 +15,6 @@ - diff --git a/src/Elastic.ApiExplorer/Endpoints/ApiEndpoint.cs b/src/Elastic.ApiExplorer/Endpoints/ApiEndpoint.cs index b79b83b14..d0aa50c1d 100644 --- a/src/Elastic.ApiExplorer/Endpoints/ApiEndpoint.cs +++ b/src/Elastic.ApiExplorer/Endpoints/ApiEndpoint.cs @@ -5,7 +5,7 @@ using System.IO.Abstractions; using Elastic.Documentation.Navigation; using Elastic.Documentation.Site.Navigation; -using Microsoft.OpenApi.Models.Interfaces; +using Microsoft.OpenApi; using RazorSlices; namespace Elastic.ApiExplorer.Endpoints; diff --git a/src/Elastic.ApiExplorer/Landing/LandingViewModel.cs b/src/Elastic.ApiExplorer/Landing/LandingViewModel.cs index e4579ce25..541a7bfa8 100644 --- a/src/Elastic.ApiExplorer/Landing/LandingViewModel.cs +++ b/src/Elastic.ApiExplorer/Landing/LandingViewModel.cs @@ -2,7 +2,7 @@ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information -using Microsoft.OpenApi.Models; +using Microsoft.OpenApi; namespace Elastic.ApiExplorer.Landing; diff --git a/src/Elastic.ApiExplorer/OpenApiGenerator.cs b/src/Elastic.ApiExplorer/OpenApiGenerator.cs index 639346e04..51c98df66 100644 --- a/src/Elastic.ApiExplorer/OpenApiGenerator.cs +++ b/src/Elastic.ApiExplorer/OpenApiGenerator.cs @@ -12,8 +12,7 @@ using Elastic.Documentation.Site.FileProviders; using Elastic.Documentation.Site.Navigation; using Microsoft.Extensions.Logging; -using Microsoft.OpenApi.Any; -using Microsoft.OpenApi.Models; +using Microsoft.OpenApi; namespace Elastic.ApiExplorer; @@ -51,19 +50,19 @@ public LandingNavigationItem CreateNavigation(string apiUrlSuffix, OpenApiDocume var rootNavigation = new LandingNavigationItem(url); var ops = openApiDocument.Paths - .SelectMany(p => p.Value.Operations.Select(op => (Path: p, Operation: op))) + .SelectMany(p => (p.Value.Operations ?? []).Select(op => (Path: p, Operation: op))) .Select(pair => { var op = pair.Operation; var extensions = op.Value.Extensions; - var ns = (extensions?.TryGetValue("x-namespace", out var n) ?? false) && n is OpenApiAny anyNs + var ns = (extensions?.TryGetValue("x-namespace", out var n) ?? false) && n is JsonNodeExtension anyNs ? anyNs.Node.GetValue() : null; - var api = (extensions?.TryGetValue("x-api-name", out var a) ?? false) && a is OpenApiAny anyApi + var api = (extensions?.TryGetValue("x-api-name", out var a) ?? false) && a is JsonNodeExtension anyApi ? anyApi.Node.GetValue() : null; var tag = op.Value.Tags?.FirstOrDefault()?.Reference.Id; - var tagClassification = (extensions?.TryGetValue("x-tag-group", out var g) ?? false) && g is OpenApiAny anyTagGroup + var tagClassification = (extensions?.TryGetValue("x-tag-group", out var g) ?? false) && g is JsonNodeExtension anyTagGroup ? anyTagGroup.Node.GetValue() : openApiDocument.Info.Title == "Elasticsearch Request & Response Specification" ? ClassifyElasticsearchTag(tag ?? "unknown") diff --git a/src/Elastic.ApiExplorer/OpenApiReader.cs b/src/Elastic.ApiExplorer/OpenApiReader.cs index 64f749a10..1bd3d2ccd 100644 --- a/src/Elastic.ApiExplorer/OpenApiReader.cs +++ b/src/Elastic.ApiExplorer/OpenApiReader.cs @@ -3,7 +3,7 @@ // See the LICENSE file in the project root for more information using System.IO.Abstractions; -using Microsoft.OpenApi.Models; +using Microsoft.OpenApi; using Microsoft.OpenApi.Reader; namespace Elastic.ApiExplorer; diff --git a/src/Elastic.ApiExplorer/Operations/OperationNavigationItem.cs b/src/Elastic.ApiExplorer/Operations/OperationNavigationItem.cs index 27ec0a8c9..679a17fcc 100644 --- a/src/Elastic.ApiExplorer/Operations/OperationNavigationItem.cs +++ b/src/Elastic.ApiExplorer/Operations/OperationNavigationItem.cs @@ -6,8 +6,7 @@ using Elastic.ApiExplorer.Landing; using Elastic.Documentation.Extensions; using Elastic.Documentation.Navigation; -using Microsoft.OpenApi.Models; -using Microsoft.OpenApi.Models.Interfaces; +using Microsoft.OpenApi; using RazorSlices; namespace Elastic.ApiExplorer.Operations; @@ -25,7 +24,7 @@ public record ApiObject -public record ApiOperation(OperationType OperationType, OpenApiOperation Operation, string Route, IOpenApiPathItem Path, string ApiName) : IApiModel +public record ApiOperation(HttpMethod OperationType, OpenApiOperation Operation, string Route, IOpenApiPathItem Path, string ApiName) : IApiModel { public async Task RenderAsync(FileSystemStream stream, ApiRenderContext context, Cancel ctx = default) { diff --git a/src/Elastic.ApiExplorer/Operations/OperationView.cshtml b/src/Elastic.ApiExplorer/Operations/OperationView.cshtml index 198641c48..377a9f1b5 100644 --- a/src/Elastic.ApiExplorer/Operations/OperationView.cshtml +++ b/src/Elastic.ApiExplorer/Operations/OperationView.cshtml @@ -1,7 +1,6 @@ @using Elastic.ApiExplorer.Landing @using Elastic.ApiExplorer.Operations -@using Microsoft.OpenApi.Models -@using Microsoft.OpenApi.Models.Interfaces +@using Microsoft.OpenApi @inherits RazorSliceHttpResult @implements IUsesLayout @functions { @@ -47,7 +46,7 @@ } if (propertyValue.Schema is not null) - return propertyValue.Schema; + return propertyValue.Schema.ToString(); if (propertyValue.Enum is { Count: >0 } e) return "enum"; @@ -121,13 +120,13 @@ @if (operation.RequestBody is not null) {

Request Body

- var content = operation.RequestBody.Content.FirstOrDefault().Value; + var content = operation.RequestBody.Content?.FirstOrDefault().Value; if (!string.IsNullOrEmpty(operation.RequestBody.Description)) {

@operation.RequestBody.Description

} - if (content.Schema is not null) + if (content?.Schema?.Properties is not null) {
@foreach (var property in content.Schema.Properties) diff --git a/src/Elastic.Documentation.Configuration/Assembler/GoogleTagManager.cs b/src/Elastic.Documentation.Configuration/Assembler/GoogleTagManager.cs index 4e39c659c..95ad3d0ad 100644 --- a/src/Elastic.Documentation.Configuration/Assembler/GoogleTagManager.cs +++ b/src/Elastic.Documentation.Configuration/Assembler/GoogleTagManager.cs @@ -11,17 +11,15 @@ public record GoogleTagManager [YamlMember(Alias = "enabled")] public bool Enabled { get; set; } - private string _id = string.Empty; - [YamlMember(Alias = "id")] - public string Id + public string? Id { - get => _id; + get; set { if (Enabled && string.IsNullOrEmpty(value)) throw new ArgumentException("Id is required when Enabled is true."); - _id = value; + field = value; } } diff --git a/src/Elastic.Documentation.Configuration/BuildContext.cs b/src/Elastic.Documentation.Configuration/BuildContext.cs index 0b650a703..bd61ecf24 100644 --- a/src/Elastic.Documentation.Configuration/BuildContext.cs +++ b/src/Elastic.Documentation.Configuration/BuildContext.cs @@ -58,12 +58,10 @@ public record BuildContext : IDocumentationSetContext, IDocumentationConfigurati // This property is used for the canonical URL public Uri? CanonicalBaseUrl { get; init; } - private readonly string? _urlPathPrefix; - public string? UrlPathPrefix { - get => string.IsNullOrWhiteSpace(_urlPathPrefix) ? "" : $"/{_urlPathPrefix.Trim('/')}"; - init => _urlPathPrefix = value; + get => string.IsNullOrWhiteSpace(field) ? "" : $"/{field.Trim('/')}"; + init; } public BuildContext( diff --git a/src/Elastic.Documentation.Configuration/Builder/ConfigurationFile.cs b/src/Elastic.Documentation.Configuration/Builder/ConfigurationFile.cs index 8b3cf896f..bd9926518 100644 --- a/src/Elastic.Documentation.Configuration/Builder/ConfigurationFile.cs +++ b/src/Elastic.Documentation.Configuration/Builder/ConfigurationFile.cs @@ -2,6 +2,7 @@ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information +using System.Diagnostics.CodeAnalysis; using System.IO.Abstractions; using DotNet.Globbing; using Elastic.Documentation.Configuration.Products; @@ -36,8 +37,9 @@ public record ConfigurationFile public IReadOnlyDictionary Substitutions => _substitutions; private readonly Dictionary _features = new(StringComparer.OrdinalIgnoreCase); - private FeatureFlags? _featureFlags; - public FeatureFlags Features => _featureFlags ??= new FeatureFlags(_features); + + [field: AllowNull, MaybeNull] + public FeatureFlags Features => field ??= new FeatureFlags(_features); public IDirectoryInfo ScopeDirectory { get; } diff --git a/src/Elastic.Documentation.Configuration/Elastic.Documentation.Configuration.csproj b/src/Elastic.Documentation.Configuration/Elastic.Documentation.Configuration.csproj index f48dbe4de..5b2423c7e 100644 --- a/src/Elastic.Documentation.Configuration/Elastic.Documentation.Configuration.csproj +++ b/src/Elastic.Documentation.Configuration/Elastic.Documentation.Configuration.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 enable enable diff --git a/src/Elastic.Documentation.LegacyDocs/Elastic.Documentation.LegacyDocs.csproj b/src/Elastic.Documentation.LegacyDocs/Elastic.Documentation.LegacyDocs.csproj index 9f12bff58..62dcadb8d 100644 --- a/src/Elastic.Documentation.LegacyDocs/Elastic.Documentation.LegacyDocs.csproj +++ b/src/Elastic.Documentation.LegacyDocs/Elastic.Documentation.LegacyDocs.csproj @@ -1,7 +1,7 @@ - net9.0 + net10.0 Library enable enable diff --git a/src/Elastic.Documentation.LinkIndex/Elastic.Documentation.LinkIndex.csproj b/src/Elastic.Documentation.LinkIndex/Elastic.Documentation.LinkIndex.csproj index 4a0d944f1..9a7e9c11b 100644 --- a/src/Elastic.Documentation.LinkIndex/Elastic.Documentation.LinkIndex.csproj +++ b/src/Elastic.Documentation.LinkIndex/Elastic.Documentation.LinkIndex.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 enable enable diff --git a/src/Elastic.Documentation.Links/Elastic.Documentation.Links.csproj b/src/Elastic.Documentation.Links/Elastic.Documentation.Links.csproj index bef44c557..ade5da323 100644 --- a/src/Elastic.Documentation.Links/Elastic.Documentation.Links.csproj +++ b/src/Elastic.Documentation.Links/Elastic.Documentation.Links.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 enable enable diff --git a/src/Elastic.Documentation.Navigation/Elastic.Documentation.Navigation.csproj b/src/Elastic.Documentation.Navigation/Elastic.Documentation.Navigation.csproj index 4a57206c2..4b7075ec9 100644 --- a/src/Elastic.Documentation.Navigation/Elastic.Documentation.Navigation.csproj +++ b/src/Elastic.Documentation.Navigation/Elastic.Documentation.Navigation.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 enable enable diff --git a/src/Elastic.Documentation.Navigation/Isolated/Node/DocumentationSetNavigation.cs b/src/Elastic.Documentation.Navigation/Isolated/Node/DocumentationSetNavigation.cs index 56ec4412b..e23e05bcd 100644 --- a/src/Elastic.Documentation.Navigation/Isolated/Node/DocumentationSetNavigation.cs +++ b/src/Elastic.Documentation.Navigation/Isolated/Node/DocumentationSetNavigation.cs @@ -39,9 +39,9 @@ public DocumentationSetNavigation( _context = context; _factory = factory; _crossLinkResolver = crossLinkResolver ?? NoopCrossLinkResolver.Instance; - _pathPrefix = pathPrefix ?? string.Empty; + PathPrefix = pathPrefix ?? string.Empty; // Initialize root properties - _navigationRoot = root ?? this; + NavigationRoot = root ?? this; Parent = parent; Hidden = false; HomeProvider = this; @@ -94,14 +94,11 @@ public DocumentationSetNavigation( } - private readonly string _pathPrefix; - private readonly IRootNavigationItem _navigationRoot; - /// /// Gets the path prefix. When HomeProvider is set to a different instance, it returns that provider's prefix. /// Otherwise, returns the prefix set during construction. /// - public string PathPrefix => HomeProvider == this ? _pathPrefix : HomeProvider.PathPrefix; + public string PathPrefix => HomeProvider == this ? field : HomeProvider.PathPrefix; public INavigationHomeProvider HomeProvider { get; set; } @@ -121,7 +118,7 @@ public DocumentationSetNavigation( public string NavigationTitle => Index.NavigationTitle; public IRootNavigationItem NavigationRoot => - HomeProvider == this ? _navigationRoot : HomeProvider.NavigationRoot; + HomeProvider == this ? field : HomeProvider.NavigationRoot; /// public INodeNavigationItem? Parent { get; set; } diff --git a/src/Elastic.Documentation.ServiceDefaults/Elastic.Documentation.ServiceDefaults.csproj b/src/Elastic.Documentation.ServiceDefaults/Elastic.Documentation.ServiceDefaults.csproj index 1091489a9..155e8056c 100644 --- a/src/Elastic.Documentation.ServiceDefaults/Elastic.Documentation.ServiceDefaults.csproj +++ b/src/Elastic.Documentation.ServiceDefaults/Elastic.Documentation.ServiceDefaults.csproj @@ -1,7 +1,7 @@ - net9.0 + net10.0 enable enable true diff --git a/src/Elastic.Documentation.Site/Elastic.Documentation.Site.csproj b/src/Elastic.Documentation.Site/Elastic.Documentation.Site.csproj index a0036194f..f7e56843d 100644 --- a/src/Elastic.Documentation.Site/Elastic.Documentation.Site.csproj +++ b/src/Elastic.Documentation.Site/Elastic.Documentation.Site.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 enable enable true diff --git a/src/Elastic.Documentation/Elastic.Documentation.csproj b/src/Elastic.Documentation/Elastic.Documentation.csproj index 0aa9e7fe6..99b59c073 100644 --- a/src/Elastic.Documentation/Elastic.Documentation.csproj +++ b/src/Elastic.Documentation/Elastic.Documentation.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 enable enable Elastic.Documentation diff --git a/src/Elastic.Markdown/Diagnostics/ProcessorDiagnosticExtensions.cs b/src/Elastic.Markdown/Diagnostics/ProcessorDiagnosticExtensions.cs index ca97f6963..9d14eb6c8 100644 --- a/src/Elastic.Markdown/Diagnostics/ProcessorDiagnosticExtensions.cs +++ b/src/Elastic.Markdown/Diagnostics/ProcessorDiagnosticExtensions.cs @@ -33,9 +33,9 @@ public static void Emit(this BlockProcessor processor, Severity severity, string Severity = severity, File = processor.GetContext().MarkdownSourcePath.FullName, Column = column ?? 1, - Line = line ?? processor.LineIndex + 1, + Line = line ?? (processor.LineIndex + 1), Message = message, - Length = length ?? processor.Line.Length + 1 + Length = length ?? (processor.Line.Length + 1) }; context.Build.Collector.Write(d); } diff --git a/src/Elastic.Markdown/Elastic.Markdown.csproj b/src/Elastic.Markdown/Elastic.Markdown.csproj index 117d86c3f..382b8c652 100644 --- a/src/Elastic.Markdown/Elastic.Markdown.csproj +++ b/src/Elastic.Markdown/Elastic.Markdown.csproj @@ -1,7 +1,7 @@ - net9.0 + net10.0 enable enable true diff --git a/src/Elastic.Markdown/IO/MarkdownFile.cs b/src/Elastic.Markdown/IO/MarkdownFile.cs index f1323ceef..07f7bf7d0 100644 --- a/src/Elastic.Markdown/IO/MarkdownFile.cs +++ b/src/Elastic.Markdown/IO/MarkdownFile.cs @@ -2,6 +2,7 @@ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information +using System.Diagnostics.CodeAnalysis; using System.IO.Abstractions; using Elastic.Documentation.Configuration; using Elastic.Documentation.Configuration.Products; @@ -22,8 +23,6 @@ namespace Elastic.Markdown.IO; public record MarkdownFile : DocumentationFile, ITableOfContentsScope, IDocumentationFile { - private string? _navigationTitle; - private readonly IFileInfo _configurationFile; private readonly IReadOnlyDictionary _globalSubstitutions; @@ -64,18 +63,19 @@ BuildContext build public string? Title { - get => _title; + get; protected set { - _title = value?.StripMarkdown(); + field = value?.StripMarkdown(); TitleRaw = value; } } + [field: AllowNull, MaybeNull] public string NavigationTitle { - get => !string.IsNullOrEmpty(_navigationTitle) ? _navigationTitle : Title ?? string.Empty; - private set => _navigationTitle = value.StripMarkdown(); + get => !string.IsNullOrEmpty(field) ? field : Title ?? string.Empty; + private set => field = value.StripMarkdown(); } @@ -90,7 +90,6 @@ public string NavigationTitle public string FileName { get; } private bool _instructionsParsed; - private string? _title; /// this get set by documentationset when validating redirects /// because we need to minimally parse to see the anchors anchor validation is deferred. diff --git a/src/Elastic.Markdown/Myst/CodeBlocks/EnhancedCodeBlock.cs b/src/Elastic.Markdown/Myst/CodeBlocks/EnhancedCodeBlock.cs index ffc8aae5b..bf8dad361 100644 --- a/src/Elastic.Markdown/Myst/CodeBlocks/EnhancedCodeBlock.cs +++ b/src/Elastic.Markdown/Myst/CodeBlocks/EnhancedCodeBlock.cs @@ -27,7 +27,7 @@ public class EnhancedCodeBlock(BlockParser parser, ParserContext context) public bool SkipValidation { get; } = context.SkipValidation; - public int OpeningLength => Info?.Length ?? 0 + 3; + public int OpeningLength => Info?.Length ?? (0 + 3); public List CallOuts { get; set; } = []; diff --git a/src/Elastic.Markdown/Myst/Directives/Image/ImageViewModel.cs b/src/Elastic.Markdown/Myst/Directives/Image/ImageViewModel.cs index 95ed7ee2e..21cf5ee8c 100644 --- a/src/Elastic.Markdown/Myst/Directives/Image/ImageViewModel.cs +++ b/src/Elastic.Markdown/Myst/Directives/Image/ImageViewModel.cs @@ -2,6 +2,7 @@ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information +using System.Diagnostics.CodeAnalysis; using System.Text; using Elastic.Documentation.Extensions; @@ -19,10 +20,9 @@ public class ImageViewModel : DirectiveViewModel public required string? Width { get; init; } public required string? ImageUrl { get; init; } - private string? _uniqueImageId; - + [field: AllowNull, MaybeNull] public string UniqueImageId => - _uniqueImageId ??= string.IsNullOrEmpty(ImageUrl) + field ??= string.IsNullOrEmpty(ImageUrl) ? Guid.NewGuid().ToString("N")[..8] // fallback to a random ID if ImageUrl is null or empty : ShortId.Create(ImageUrl); public required string? Screenshot { get; init; } diff --git a/src/Elastic.Markdown/Myst/MarkdownParser.cs b/src/Elastic.Markdown/Myst/MarkdownParser.cs index b065e23c5..d1120c4eb 100644 --- a/src/Elastic.Markdown/Myst/MarkdownParser.cs +++ b/src/Elastic.Markdown/Myst/MarkdownParser.cs @@ -2,6 +2,7 @@ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information +using System.Diagnostics.CodeAnalysis; using System.IO.Abstractions; using Cysharp.IO; using Elastic.Documentation.Configuration; @@ -122,15 +123,13 @@ private static async Task ParseAsync( return markdownDocument; } - // ReSharper disable once InconsistentNaming - private static MarkdownPipeline? MinimalPipelineCached; - + [field: AllowNull, MaybeNull] private static MarkdownPipeline MinimalPipeline { get { - if (MinimalPipelineCached is not null) - return MinimalPipelineCached; + if (field is not null) + return field; var builder = new MarkdownPipelineBuilder() .UseYamlFrontMatter() .UseInlineAnchors() @@ -138,20 +137,18 @@ private static MarkdownPipeline MinimalPipeline .UseDirectives(); _ = builder.BlockParsers.TryRemove(); - MinimalPipelineCached = builder.Build(); - return MinimalPipelineCached; + field = builder.Build(); + return field; } } - // ReSharper disable once InconsistentNaming - private static MarkdownPipeline? PipelineCached; - + [field: AllowNull, MaybeNull] public static MarkdownPipeline Pipeline { get { - if (PipelineCached is not null) - return PipelineCached; + if (field is not null) + return field; var builder = new MarkdownPipelineBuilder() .UseInlineAnchors() @@ -176,8 +173,8 @@ public static MarkdownPipeline Pipeline .UseSpaceNormalizer() .UseHardBreaks(); _ = builder.BlockParsers.TryRemove(); - PipelineCached = builder.Build(); - return PipelineCached; + field = builder.Build(); + return field; } } diff --git a/src/api/Elastic.Documentation.Api.Core/Elastic.Documentation.Api.Core.csproj b/src/api/Elastic.Documentation.Api.Core/Elastic.Documentation.Api.Core.csproj index a4ad652a2..d2b322021 100644 --- a/src/api/Elastic.Documentation.Api.Core/Elastic.Documentation.Api.Core.csproj +++ b/src/api/Elastic.Documentation.Api.Core/Elastic.Documentation.Api.Core.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 enable enable Elastic.Documentation.Api.Core diff --git a/src/api/Elastic.Documentation.Api.Infrastructure/Elastic.Documentation.Api.Infrastructure.csproj b/src/api/Elastic.Documentation.Api.Infrastructure/Elastic.Documentation.Api.Infrastructure.csproj index 5d1c6c895..7724ea935 100644 --- a/src/api/Elastic.Documentation.Api.Infrastructure/Elastic.Documentation.Api.Infrastructure.csproj +++ b/src/api/Elastic.Documentation.Api.Infrastructure/Elastic.Documentation.Api.Infrastructure.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 enable enable true diff --git a/src/api/Elastic.Documentation.Api.Lambda/Elastic.Documentation.Api.Lambda.csproj b/src/api/Elastic.Documentation.Api.Lambda/Elastic.Documentation.Api.Lambda.csproj index 62326f3ff..b209a46ba 100644 --- a/src/api/Elastic.Documentation.Api.Lambda/Elastic.Documentation.Api.Lambda.csproj +++ b/src/api/Elastic.Documentation.Api.Lambda/Elastic.Documentation.Api.Lambda.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable true diff --git a/src/authoring/Elastic.Documentation.Refactor/Elastic.Documentation.Refactor.csproj b/src/authoring/Elastic.Documentation.Refactor/Elastic.Documentation.Refactor.csproj index d516d72ff..f8c18faad 100644 --- a/src/authoring/Elastic.Documentation.Refactor/Elastic.Documentation.Refactor.csproj +++ b/src/authoring/Elastic.Documentation.Refactor/Elastic.Documentation.Refactor.csproj @@ -1,7 +1,7 @@ - net9.0 + net10.0 enable enable diff --git a/src/infra/docs-lambda-index-publisher/docs-lambda-index-publisher.csproj b/src/infra/docs-lambda-index-publisher/docs-lambda-index-publisher.csproj index e8994b9aa..40c28fe9a 100644 --- a/src/infra/docs-lambda-index-publisher/docs-lambda-index-publisher.csproj +++ b/src/infra/docs-lambda-index-publisher/docs-lambda-index-publisher.csproj @@ -1,7 +1,7 @@ Exe - net9.0 + net10.0 enable enable true diff --git a/src/services/Elastic.Documentation.Assembler/Elastic.Documentation.Assembler.csproj b/src/services/Elastic.Documentation.Assembler/Elastic.Documentation.Assembler.csproj index 412e5276b..1bc349f21 100644 --- a/src/services/Elastic.Documentation.Assembler/Elastic.Documentation.Assembler.csproj +++ b/src/services/Elastic.Documentation.Assembler/Elastic.Documentation.Assembler.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 enable enable diff --git a/src/services/Elastic.Documentation.Isolated/Elastic.Documentation.Isolated.csproj b/src/services/Elastic.Documentation.Isolated/Elastic.Documentation.Isolated.csproj index 70954467c..090ef0e77 100644 --- a/src/services/Elastic.Documentation.Isolated/Elastic.Documentation.Isolated.csproj +++ b/src/services/Elastic.Documentation.Isolated/Elastic.Documentation.Isolated.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 enable enable diff --git a/src/services/Elastic.Documentation.Services/Elastic.Documentation.Services.csproj b/src/services/Elastic.Documentation.Services/Elastic.Documentation.Services.csproj index a271e6d09..bf808d354 100644 --- a/src/services/Elastic.Documentation.Services/Elastic.Documentation.Services.csproj +++ b/src/services/Elastic.Documentation.Services/Elastic.Documentation.Services.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 enable enable diff --git a/src/tooling/docs-builder/Diagnostics/Console/GithubAnnotationOutput.cs b/src/tooling/docs-builder/Diagnostics/Console/GithubAnnotationOutput.cs index 961a7f4f5..cd758bbfd 100644 --- a/src/tooling/docs-builder/Diagnostics/Console/GithubAnnotationOutput.cs +++ b/src/tooling/docs-builder/Diagnostics/Console/GithubAnnotationOutput.cs @@ -21,7 +21,7 @@ public void Write(Diagnostic diagnostic) File = diagnostic.File, StartColumn = diagnostic.Column, StartLine = diagnostic.Line, - EndColumn = diagnostic.Column + diagnostic.Length ?? 1 + EndColumn = (diagnostic.Column + diagnostic.Length) ?? 1 }; if (diagnostic.Severity == Severity.Error) githubActions.WriteError(diagnostic.Message, properties); diff --git a/src/tooling/docs-builder/Http/LiveReload.cs b/src/tooling/docs-builder/Http/LiveReload.cs index c0b165f4b..8b8ce5d4a 100644 --- a/src/tooling/docs-builder/Http/LiveReload.cs +++ b/src/tooling/docs-builder/Http/LiveReload.cs @@ -29,8 +29,10 @@ public static IServiceCollection AddAotLiveReload(this IServiceCollection servic var provider = services.BuildServiceProvider(); var configuration = provider.GetService(); +#pragma warning disable syslib1100 var config = new LiveReloadConfiguration(); configuration!.Bind("LiveReload", config); +#pragma warning restore syslib1100 LiveReloadConfiguration.Current = config; diff --git a/src/tooling/docs-builder/docs-builder.csproj b/src/tooling/docs-builder/docs-builder.csproj index 8e39b842c..8822532bd 100644 --- a/src/tooling/docs-builder/docs-builder.csproj +++ b/src/tooling/docs-builder/docs-builder.csproj @@ -1,7 +1,7 @@ - net9.0 + net10.0 Exe docs-builder Documentation.Builder @@ -17,6 +17,8 @@ true true false + + $(NoWarn);SYSLIB1100;SYSLIB1101 diff --git a/tests-integration/Elastic.Assembler.IntegrationTests/Elastic.Assembler.IntegrationTests.csproj b/tests-integration/Elastic.Assembler.IntegrationTests/Elastic.Assembler.IntegrationTests.csproj index 73d9c4b12..f08de4757 100644 --- a/tests-integration/Elastic.Assembler.IntegrationTests/Elastic.Assembler.IntegrationTests.csproj +++ b/tests-integration/Elastic.Assembler.IntegrationTests/Elastic.Assembler.IntegrationTests.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 enable enable diff --git a/tests/Elastic.ApiExplorer.Tests/Elastic.ApiExplorer.Tests.csproj b/tests/Elastic.ApiExplorer.Tests/Elastic.ApiExplorer.Tests.csproj index c7d7bd4a3..f326f6d0c 100644 --- a/tests/Elastic.ApiExplorer.Tests/Elastic.ApiExplorer.Tests.csproj +++ b/tests/Elastic.ApiExplorer.Tests/Elastic.ApiExplorer.Tests.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 diff --git a/tests/Elastic.Documentation.Api.Infrastructure.Tests/Elastic.Documentation.Api.Infrastructure.Tests.csproj b/tests/Elastic.Documentation.Api.Infrastructure.Tests/Elastic.Documentation.Api.Infrastructure.Tests.csproj index 7743c944a..c39a65021 100644 --- a/tests/Elastic.Documentation.Api.Infrastructure.Tests/Elastic.Documentation.Api.Infrastructure.Tests.csproj +++ b/tests/Elastic.Documentation.Api.Infrastructure.Tests/Elastic.Documentation.Api.Infrastructure.Tests.csproj @@ -1,7 +1,7 @@ - net9.0 + net10.0 diff --git a/tests/Elastic.Documentation.Configuration.Tests/Elastic.Documentation.Configuration.Tests.csproj b/tests/Elastic.Documentation.Configuration.Tests/Elastic.Documentation.Configuration.Tests.csproj index f5acc84c4..0dc80a953 100644 --- a/tests/Elastic.Documentation.Configuration.Tests/Elastic.Documentation.Configuration.Tests.csproj +++ b/tests/Elastic.Documentation.Configuration.Tests/Elastic.Documentation.Configuration.Tests.csproj @@ -1,7 +1,7 @@ - net9.0 + net10.0 diff --git a/tests/Elastic.Documentation.LegacyDocs.Tests/Elastic.Documentation.LegacyDocs.Tests.csproj b/tests/Elastic.Documentation.LegacyDocs.Tests/Elastic.Documentation.LegacyDocs.Tests.csproj index ae6ce021d..198efb037 100644 --- a/tests/Elastic.Documentation.LegacyDocs.Tests/Elastic.Documentation.LegacyDocs.Tests.csproj +++ b/tests/Elastic.Documentation.LegacyDocs.Tests/Elastic.Documentation.LegacyDocs.Tests.csproj @@ -1,6 +1,6 @@  - net9.0 + net10.0 diff --git a/tests/Elastic.Markdown.Tests/Elastic.Markdown.Tests.csproj b/tests/Elastic.Markdown.Tests/Elastic.Markdown.Tests.csproj index 01b287269..3c3a200e3 100644 --- a/tests/Elastic.Markdown.Tests/Elastic.Markdown.Tests.csproj +++ b/tests/Elastic.Markdown.Tests/Elastic.Markdown.Tests.csproj @@ -1,7 +1,7 @@ - net9.0 + net10.0 diff --git a/tests/Navigation.Tests/Navigation.Tests.csproj b/tests/Navigation.Tests/Navigation.Tests.csproj index a3c1bded4..8f849e8cc 100644 --- a/tests/Navigation.Tests/Navigation.Tests.csproj +++ b/tests/Navigation.Tests/Navigation.Tests.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 enable enable Elastic.Documentation.Navigation.Tests diff --git a/tests/authoring/authoring.fsproj b/tests/authoring/authoring.fsproj index 4bf239acb..14d0cbd3d 100644 --- a/tests/authoring/authoring.fsproj +++ b/tests/authoring/authoring.fsproj @@ -1,7 +1,7 @@ - net9.0 + net10.0 false true From 85c66359283f86a613f6c2f40ada9362c889ed21 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 12 Nov 2025 11:35:53 +0100 Subject: [PATCH 02/15] Update lambda.DockerFile --- src/api/Elastic.Documentation.Api.Lambda/Dockerfile | 2 +- src/infra/docs-lambda-index-publisher/lambda.DockerFile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/Elastic.Documentation.Api.Lambda/Dockerfile b/src/api/Elastic.Documentation.Api.Lambda/Dockerfile index 07ac09d4a..fc8a9f1f6 100644 --- a/src/api/Elastic.Documentation.Api.Lambda/Dockerfile +++ b/src/api/Elastic.Documentation.Api.Lambda/Dockerfile @@ -10,7 +10,7 @@ RUN rpm --import https://packages.microsoft.com/keys/microsoft.asc RUN curl -o /etc/yum.repos.d/microsoft-prod.repo https://packages.microsoft.com/config/fedora/39/prod.repo RUN dnf update -y -RUN dnf install -y dotnet-sdk-9.0 +RUN dnf install -y dotnet-sdk-10.0 RUN dnf install -y npm RUN dnf install -y git RUN dnf install -y clang diff --git a/src/infra/docs-lambda-index-publisher/lambda.DockerFile b/src/infra/docs-lambda-index-publisher/lambda.DockerFile index 0066279df..0d58f90aa 100644 --- a/src/infra/docs-lambda-index-publisher/lambda.DockerFile +++ b/src/infra/docs-lambda-index-publisher/lambda.DockerFile @@ -10,7 +10,7 @@ RUN rpm --import https://packages.microsoft.com/keys/microsoft.asc RUN curl -o /etc/yum.repos.d/microsoft-prod.repo https://packages.microsoft.com/config/fedora/39/prod.repo RUN dnf update -y -RUN dnf install -y dotnet-sdk-9.0 +RUN dnf install -y dotnet-sdk-10.0 RUN dnf install -y npm RUN dnf install -y git RUN dnf install -y clang From f30c95f8d9f1b97d1457ee9919ab3897c7de3246 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 12 Nov 2025 11:42:56 +0100 Subject: [PATCH 03/15] depend on higher fedora package repo --- src/api/Elastic.Documentation.Api.Lambda/Dockerfile | 2 +- src/infra/docs-lambda-index-publisher/lambda.DockerFile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/Elastic.Documentation.Api.Lambda/Dockerfile b/src/api/Elastic.Documentation.Api.Lambda/Dockerfile index fc8a9f1f6..7c30c50ba 100644 --- a/src/api/Elastic.Documentation.Api.Lambda/Dockerfile +++ b/src/api/Elastic.Documentation.Api.Lambda/Dockerfile @@ -7,7 +7,7 @@ WORKDIR /app RUN rpm --import https://packages.microsoft.com/keys/microsoft.asc -RUN curl -o /etc/yum.repos.d/microsoft-prod.repo https://packages.microsoft.com/config/fedora/39/prod.repo +RUN curl -o /etc/yum.repos.d/microsoft-prod.repo https://packages.microsoft.com/config/fedora/43/prod.repo RUN dnf update -y RUN dnf install -y dotnet-sdk-10.0 diff --git a/src/infra/docs-lambda-index-publisher/lambda.DockerFile b/src/infra/docs-lambda-index-publisher/lambda.DockerFile index 0d58f90aa..40ab02d03 100644 --- a/src/infra/docs-lambda-index-publisher/lambda.DockerFile +++ b/src/infra/docs-lambda-index-publisher/lambda.DockerFile @@ -7,7 +7,7 @@ WORKDIR /app RUN rpm --import https://packages.microsoft.com/keys/microsoft.asc -RUN curl -o /etc/yum.repos.d/microsoft-prod.repo https://packages.microsoft.com/config/fedora/39/prod.repo +RUN curl -o /etc/yum.repos.d/microsoft-prod.repo https://packages.microsoft.com/config/fedora/43/prod.repo RUN dnf update -y RUN dnf install -y dotnet-sdk-10.0 From 8cf5ca761c87249a96a66dd25b8431d829758d20 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 12 Nov 2025 11:46:29 +0100 Subject: [PATCH 04/15] fedora 41 --- src/api/Elastic.Documentation.Api.Lambda/Dockerfile | 2 +- src/infra/docs-lambda-index-publisher/lambda.DockerFile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/Elastic.Documentation.Api.Lambda/Dockerfile b/src/api/Elastic.Documentation.Api.Lambda/Dockerfile index 7c30c50ba..c24926eee 100644 --- a/src/api/Elastic.Documentation.Api.Lambda/Dockerfile +++ b/src/api/Elastic.Documentation.Api.Lambda/Dockerfile @@ -7,7 +7,7 @@ WORKDIR /app RUN rpm --import https://packages.microsoft.com/keys/microsoft.asc -RUN curl -o /etc/yum.repos.d/microsoft-prod.repo https://packages.microsoft.com/config/fedora/43/prod.repo +RUN curl -o /etc/yum.repos.d/microsoft-prod.repo https://packages.microsoft.com/config/fedora/41/prod.repo RUN dnf update -y RUN dnf install -y dotnet-sdk-10.0 diff --git a/src/infra/docs-lambda-index-publisher/lambda.DockerFile b/src/infra/docs-lambda-index-publisher/lambda.DockerFile index 40ab02d03..aae5455dd 100644 --- a/src/infra/docs-lambda-index-publisher/lambda.DockerFile +++ b/src/infra/docs-lambda-index-publisher/lambda.DockerFile @@ -7,7 +7,7 @@ WORKDIR /app RUN rpm --import https://packages.microsoft.com/keys/microsoft.asc -RUN curl -o /etc/yum.repos.d/microsoft-prod.repo https://packages.microsoft.com/config/fedora/43/prod.repo +RUN curl -o /etc/yum.repos.d/microsoft-prod.repo https://packages.microsoft.com/config/fedora/41/prod.repo RUN dnf update -y RUN dnf install -y dotnet-sdk-10.0 From d31cc228487aaf2834dfd47e6b5f553854b7fa35 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 12 Nov 2025 11:51:12 +0100 Subject: [PATCH 05/15] attempt script install of dotnet 10 on aws2023 --- src/api/Elastic.Documentation.Api.Lambda/Dockerfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/api/Elastic.Documentation.Api.Lambda/Dockerfile b/src/api/Elastic.Documentation.Api.Lambda/Dockerfile index c24926eee..df94f8e10 100644 --- a/src/api/Elastic.Documentation.Api.Lambda/Dockerfile +++ b/src/api/Elastic.Documentation.Api.Lambda/Dockerfile @@ -7,10 +7,14 @@ WORKDIR /app RUN rpm --import https://packages.microsoft.com/keys/microsoft.asc -RUN curl -o /etc/yum.repos.d/microsoft-prod.repo https://packages.microsoft.com/config/fedora/41/prod.repo +#RUN curl -o /etc/yum.repos.d/microsoft-prod.repo https://packages.microsoft.com/config/fedora/41/prod.repo + +RUN curl -L https://dot.net/v1/dotnet-install.sh -o dotnet-install.sh + +RUN chmod +x ./dotnet-install.sh RUN dnf update -y -RUN dnf install -y dotnet-sdk-10.0 +#RUN dnf install -y dotnet-sdk-10.0 RUN dnf install -y npm RUN dnf install -y git RUN dnf install -y clang From 29dc6068a51e62ad0b58160598e310dfd30b516d Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 12 Nov 2025 11:55:16 +0100 Subject: [PATCH 06/15] actually call install.sh --- src/api/Elastic.Documentation.Api.Lambda/Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/api/Elastic.Documentation.Api.Lambda/Dockerfile b/src/api/Elastic.Documentation.Api.Lambda/Dockerfile index df94f8e10..fc9f9fed3 100644 --- a/src/api/Elastic.Documentation.Api.Lambda/Dockerfile +++ b/src/api/Elastic.Documentation.Api.Lambda/Dockerfile @@ -13,6 +13,8 @@ RUN curl -L https://dot.net/v1/dotnet-install.sh -o dotnet-install.sh RUN chmod +x ./dotnet-install.sh +RUN ./dotnet-install.sh --version latest + RUN dnf update -y #RUN dnf install -y dotnet-sdk-10.0 RUN dnf install -y npm From 6757760be9a652a52716872433257a69718e97fa Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 12 Nov 2025 12:04:49 +0100 Subject: [PATCH 07/15] add tar/find --- src/api/Elastic.Documentation.Api.Lambda/Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/api/Elastic.Documentation.Api.Lambda/Dockerfile b/src/api/Elastic.Documentation.Api.Lambda/Dockerfile index fc9f9fed3..9782afb29 100644 --- a/src/api/Elastic.Documentation.Api.Lambda/Dockerfile +++ b/src/api/Elastic.Documentation.Api.Lambda/Dockerfile @@ -13,14 +13,16 @@ RUN curl -L https://dot.net/v1/dotnet-install.sh -o dotnet-install.sh RUN chmod +x ./dotnet-install.sh -RUN ./dotnet-install.sh --version latest - RUN dnf update -y #RUN dnf install -y dotnet-sdk-10.0 +RUN dnf install -y find +RUN dnf install -y tar RUN dnf install -y npm RUN dnf install -y git RUN dnf install -y clang +RUN ./dotnet-install.sh --version latest + COPY . . ENV DOTNET_NOLOGO=true \ From a9eca382683941052ce72e66edb65d72995abfed Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 12 Nov 2025 12:12:59 +0100 Subject: [PATCH 08/15] update package name --- src/api/Elastic.Documentation.Api.Lambda/Dockerfile | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/api/Elastic.Documentation.Api.Lambda/Dockerfile b/src/api/Elastic.Documentation.Api.Lambda/Dockerfile index 9782afb29..7cffa38d3 100644 --- a/src/api/Elastic.Documentation.Api.Lambda/Dockerfile +++ b/src/api/Elastic.Documentation.Api.Lambda/Dockerfile @@ -9,19 +9,17 @@ RUN rpm --import https://packages.microsoft.com/keys/microsoft.asc #RUN curl -o /etc/yum.repos.d/microsoft-prod.repo https://packages.microsoft.com/config/fedora/41/prod.repo -RUN curl -L https://dot.net/v1/dotnet-install.sh -o dotnet-install.sh - -RUN chmod +x ./dotnet-install.sh - RUN dnf update -y #RUN dnf install -y dotnet-sdk-10.0 -RUN dnf install -y find -RUN dnf install -y tar RUN dnf install -y npm RUN dnf install -y git RUN dnf install -y clang -RUN ./dotnet-install.sh --version latest +## temporary see: https://github.com/amazonlinux/amazon-linux-2023/issues/1025 +RUN dnf install -y tar +RUN dnf install -y findutils +RUN curl -L https://dot.net/v1/dotnet-install.sh -o dotnet-install.sh +RUN chmod +x ./dotnet-install.sh COPY . . From 6fb7eb10afb4020c8a8e096f7b67dc423ae9714e Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 12 Nov 2025 12:17:37 +0100 Subject: [PATCH 09/15] invoke dotnet-install.sh --- src/api/Elastic.Documentation.Api.Lambda/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/src/api/Elastic.Documentation.Api.Lambda/Dockerfile b/src/api/Elastic.Documentation.Api.Lambda/Dockerfile index 7cffa38d3..d46bab62a 100644 --- a/src/api/Elastic.Documentation.Api.Lambda/Dockerfile +++ b/src/api/Elastic.Documentation.Api.Lambda/Dockerfile @@ -20,6 +20,7 @@ RUN dnf install -y tar RUN dnf install -y findutils RUN curl -L https://dot.net/v1/dotnet-install.sh -o dotnet-install.sh RUN chmod +x ./dotnet-install.sh +RUN ./dotnet-install.sh COPY . . From 305fcfc869ba5c041a418d67539b954c0cfd6518 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 12 Nov 2025 12:21:02 +0100 Subject: [PATCH 10/15] update PATH --- src/api/Elastic.Documentation.Api.Lambda/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/src/api/Elastic.Documentation.Api.Lambda/Dockerfile b/src/api/Elastic.Documentation.Api.Lambda/Dockerfile index d46bab62a..d7b9e0949 100644 --- a/src/api/Elastic.Documentation.Api.Lambda/Dockerfile +++ b/src/api/Elastic.Documentation.Api.Lambda/Dockerfile @@ -21,6 +21,7 @@ RUN dnf install -y findutils RUN curl -L https://dot.net/v1/dotnet-install.sh -o dotnet-install.sh RUN chmod +x ./dotnet-install.sh RUN ./dotnet-install.sh +ENV PATH="$PATH:/root/.dotnet" COPY . . From 197175e76b28afa47bd12bc957f5dc06b092af69 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 12 Nov 2025 12:31:28 +0100 Subject: [PATCH 11/15] DOTNET_SYSTEM_GLOBALIZATION_INVARIANT --- src/api/Elastic.Documentation.Api.Lambda/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/src/api/Elastic.Documentation.Api.Lambda/Dockerfile b/src/api/Elastic.Documentation.Api.Lambda/Dockerfile index d7b9e0949..b7da74ae5 100644 --- a/src/api/Elastic.Documentation.Api.Lambda/Dockerfile +++ b/src/api/Elastic.Documentation.Api.Lambda/Dockerfile @@ -22,6 +22,7 @@ RUN curl -L https://dot.net/v1/dotnet-install.sh -o dotnet-install.sh RUN chmod +x ./dotnet-install.sh RUN ./dotnet-install.sh ENV PATH="$PATH:/root/.dotnet" +ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 COPY . . From dcda2d11d02c3ab949b5ed4bbc394aba4e5ac020 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 12 Nov 2025 12:38:48 +0100 Subject: [PATCH 12/15] GeneratedRegex for CutOffGitExtensions does not need to specify cultureinfo --- src/Elastic.Documentation/GitCheckoutInformation.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Elastic.Documentation/GitCheckoutInformation.cs b/src/Elastic.Documentation/GitCheckoutInformation.cs index aa0dda3b7..a71e49809 100644 --- a/src/Elastic.Documentation/GitCheckoutInformation.cs +++ b/src/Elastic.Documentation/GitCheckoutInformation.cs @@ -161,6 +161,6 @@ string BranchTrackingRemote(string b, IniFile c) } } - [GeneratedRegex(@"\.git$", RegexOptions.IgnoreCase, "en-US")] + [GeneratedRegex(@"\.git$", RegexOptions.IgnoreCase)] private static partial Regex CutOffGitExtension(); } From c04e2d744cf8e2a68f25feb0623af37e05254e89 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 12 Nov 2025 12:44:16 +0100 Subject: [PATCH 13/15] clean up more generatedregex's defaulting to invariant culture --- src/Elastic.Markdown/Myst/CodeBlocks/CallOutParser.cs | 4 ++-- .../Myst/InlineParsers/DiagnosticLinkInlineParser.cs | 2 +- .../Myst/InlineParsers/HeadingBlockWithSlugParser.cs | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Elastic.Markdown/Myst/CodeBlocks/CallOutParser.cs b/src/Elastic.Markdown/Myst/CodeBlocks/CallOutParser.cs index afafef40d..5864c55dd 100644 --- a/src/Elastic.Markdown/Myst/CodeBlocks/CallOutParser.cs +++ b/src/Elastic.Markdown/Myst/CodeBlocks/CallOutParser.cs @@ -8,9 +8,9 @@ namespace Elastic.Markdown.Myst.CodeBlocks; public static partial class CallOutParser { - [GeneratedRegex(@"^.+\S+.*?\s<\d+>$", RegexOptions.IgnoreCase, 2000, "en-US")] + [GeneratedRegex(@"^.+\S+.*?\s<\d+>$", RegexOptions.IgnoreCase, 2000)] public static partial Regex CallOutNumber(); - [GeneratedRegex(@"^.+\S+.*?\s(?:\/\/|#)\s[^""\/#]+$", RegexOptions.IgnoreCase, 2000, "en-US")] + [GeneratedRegex(@"^.+\S+.*?\s(?:\/\/|#)\s[^""\/#]+$", RegexOptions.IgnoreCase, 2000)] public static partial Regex MathInlineAnnotation(); } diff --git a/src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs b/src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs index f73721d42..eb70bbc76 100644 --- a/src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs +++ b/src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs @@ -41,7 +41,7 @@ public void Setup(MarkdownPipeline pipeline, IMarkdownRenderer renderer) { } internal sealed partial class LinkRegexExtensions { - [GeneratedRegex(@"(?:^|\s)\=(?\d+%?)(?:x(?\d+%?))?$", RegexOptions.IgnoreCase, "en-US")] + [GeneratedRegex(@"(?:^|\s)\=(?\d+%?)(?:x(?\d+%?))?$", RegexOptions.IgnoreCase)] public static partial Regex MatchTitleStylingInstructions(); } diff --git a/src/Elastic.Markdown/Myst/InlineParsers/HeadingBlockWithSlugParser.cs b/src/Elastic.Markdown/Myst/InlineParsers/HeadingBlockWithSlugParser.cs index ca767febc..14b4cf445 100644 --- a/src/Elastic.Markdown/Myst/InlineParsers/HeadingBlockWithSlugParser.cs +++ b/src/Elastic.Markdown/Myst/InlineParsers/HeadingBlockWithSlugParser.cs @@ -76,13 +76,13 @@ public override bool Close(BlockProcessor processor, Block block) public static partial class HeadingAnchorParser { - [GeneratedRegex(@"^.*(?:\[[^[]+\])\s*$", RegexOptions.IgnoreCase, "en-US")] + [GeneratedRegex(@"^.*(?:\[[^[]+\])\s*$", RegexOptions.IgnoreCase)] public static partial Regex MatchAnchorLine(); - [GeneratedRegex(@"(?:\[[^[]+\])\s*$", RegexOptions.IgnoreCase, "en-US")] + [GeneratedRegex(@"(?:\[[^[]+\])\s*$", RegexOptions.IgnoreCase)] public static partial Regex MatchAnchor(); - [GeneratedRegex(@"\$\$\$[^\$]+\$\$\$", RegexOptions.IgnoreCase, "en-US")] + [GeneratedRegex(@"\$\$\$[^\$]+\$\$\$", RegexOptions.IgnoreCase)] public static partial Regex InlineAnchors(); } From b4299ba43526d85abf6593f30aa7b6b4bb33790a Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 12 Nov 2025 12:44:46 +0100 Subject: [PATCH 14/15] clean up more generatedregex's defaulting to invariant culture --- .../Assembler/AssemblyConfiguration.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Elastic.Documentation.Configuration/Assembler/AssemblyConfiguration.cs b/src/Elastic.Documentation.Configuration/Assembler/AssemblyConfiguration.cs index 6917db5d6..822b5b716 100644 --- a/src/Elastic.Documentation.Configuration/Assembler/AssemblyConfiguration.cs +++ b/src/Elastic.Documentation.Configuration/Assembler/AssemblyConfiguration.cs @@ -261,6 +261,6 @@ public record ContentSourceMatch(ContentSource? Current, ContentSource? Next, Co internal static partial class ContentSourceRegex { - [GeneratedRegex(@"^\d+\.\d+$", RegexOptions.IgnoreCase, "en-US")] + [GeneratedRegex(@"^\d+\.\d+$", RegexOptions.IgnoreCase)] public static partial Regex MatchVersionBranch(); } From 28d2e4ca4f67f575495cbf40e539ff6f320bfcee Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 12 Nov 2025 12:54:50 +0100 Subject: [PATCH 15/15] update index-publisher lambda as well --- .../Dockerfile | 1 + .../lambda.DockerFile | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/api/Elastic.Documentation.Api.Lambda/Dockerfile b/src/api/Elastic.Documentation.Api.Lambda/Dockerfile index b7da74ae5..0153d0aeb 100644 --- a/src/api/Elastic.Documentation.Api.Lambda/Dockerfile +++ b/src/api/Elastic.Documentation.Api.Lambda/Dockerfile @@ -23,6 +23,7 @@ RUN chmod +x ./dotnet-install.sh RUN ./dotnet-install.sh ENV PATH="$PATH:/root/.dotnet" ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 +# /end temporary COPY . . diff --git a/src/infra/docs-lambda-index-publisher/lambda.DockerFile b/src/infra/docs-lambda-index-publisher/lambda.DockerFile index aae5455dd..5fc45421c 100644 --- a/src/infra/docs-lambda-index-publisher/lambda.DockerFile +++ b/src/infra/docs-lambda-index-publisher/lambda.DockerFile @@ -7,20 +7,23 @@ WORKDIR /app RUN rpm --import https://packages.microsoft.com/keys/microsoft.asc -RUN curl -o /etc/yum.repos.d/microsoft-prod.repo https://packages.microsoft.com/config/fedora/41/prod.repo +#RUN curl -o /etc/yum.repos.d/microsoft-prod.repo https://packages.microsoft.com/config/fedora/41/prod.repo RUN dnf update -y -RUN dnf install -y dotnet-sdk-10.0 +#RUN dnf install -y dotnet-sdk-10.0 RUN dnf install -y npm RUN dnf install -y git RUN dnf install -y clang -#COPY ./src/ ./src/ -#COPY ./tests/ ./tests/ -#COPY ./docs/*.csproj ./docs/ -#COPY ./.github/*.csproj ./.github/ -#COPY ./build/*.fsproj ./build/ -#COPY ./*.sln ./ +## temporary see: https://github.com/amazonlinux/amazon-linux-2023/issues/1025 +RUN dnf install -y tar +RUN dnf install -y findutils +RUN curl -L https://dot.net/v1/dotnet-install.sh -o dotnet-install.sh +RUN chmod +x ./dotnet-install.sh +RUN ./dotnet-install.sh +ENV PATH="$PATH:/root/.dotnet" +ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 +# /end temporary COPY . .