diff --git a/docs-builder.slnx b/docs-builder.slnx index fcced43299..12215d0721 100644 --- a/docs-builder.slnx +++ b/docs-builder.slnx @@ -72,7 +72,10 @@ - + + + + diff --git a/src/Elastic.ApiExplorer/Elasticsearch/OpenApiDocumentExporter.cs b/src/Elastic.ApiExplorer/Elasticsearch/OpenApiDocumentExporter.cs index 8c17cc0223..38a90d901e 100644 --- a/src/Elastic.ApiExplorer/Elasticsearch/OpenApiDocumentExporter.cs +++ b/src/Elastic.ApiExplorer/Elasticsearch/OpenApiDocumentExporter.cs @@ -11,6 +11,7 @@ using Elastic.Documentation.Configuration.Inference; using Elastic.Documentation.Configuration.Versions; using Elastic.Documentation.Search; +using Elastic.Documentation.Versions; using Microsoft.OpenApi; using Microsoft.OpenApi.Reader; @@ -177,7 +178,7 @@ private IEnumerable ConvertToDocuments(OpenApiDocument op StrippedBody = body, Headings = headings, Links = [], - Applies = applies, + Applies = applies?.ToAppliesTo(), Parents = [ new ParentDocument { Title = "API Reference", Url = "/docs/api" }, diff --git a/src/Elastic.ApiExplorer/Operations/AvailabilityBadgeHelper.cs b/src/Elastic.ApiExplorer/Operations/AvailabilityBadgeHelper.cs index bd1b0cb869..ba8cbf3cdd 100644 --- a/src/Elastic.ApiExplorer/Operations/AvailabilityBadgeHelper.cs +++ b/src/Elastic.ApiExplorer/Operations/AvailabilityBadgeHelper.cs @@ -8,6 +8,7 @@ using Elastic.Documentation.AppliesTo; using Elastic.Documentation.Configuration.Versions; using Elastic.Documentation.Diagnostics; +using Elastic.Documentation.Versions; using Microsoft.OpenApi; namespace Elastic.ApiExplorer.Operations; diff --git a/src/Elastic.Codex/Building/CodexBuildService.cs b/src/Elastic.Codex/Building/CodexBuildService.cs index 5d2efb8222..8a5ba281d0 100644 --- a/src/Elastic.Codex/Building/CodexBuildService.cs +++ b/src/Elastic.Codex/Building/CodexBuildService.cs @@ -10,6 +10,7 @@ using Elastic.Codex.Sourcing; using Elastic.Documentation; using Elastic.Documentation.Configuration; +using Elastic.Documentation.Configuration.Builder; using Elastic.Documentation.Configuration.Codex; using Elastic.Documentation.Diagnostics; using Elastic.Documentation.Isolated; diff --git a/src/Elastic.Documentation.Configuration/Assembler/AssemblyConfiguration.cs b/src/Elastic.Documentation.Configuration/Assembler/AssemblyConfiguration.cs index 133ab98db6..f9833a0772 100644 --- a/src/Elastic.Documentation.Configuration/Assembler/AssemblyConfiguration.cs +++ b/src/Elastic.Documentation.Configuration/Assembler/AssemblyConfiguration.cs @@ -5,6 +5,7 @@ using System.Text.RegularExpressions; using Elastic.Documentation.Configuration.Products; using Elastic.Documentation.Extensions; +using Elastic.Documentation.Versions; using Microsoft.Extensions.Logging; using YamlDotNet.Serialization; diff --git a/src/Elastic.Documentation.Configuration/Builder/ConfigurationFile.cs b/src/Elastic.Documentation.Configuration/Builder/ConfigurationFile.cs index d3a0b8eec8..f20055f83b 100644 --- a/src/Elastic.Documentation.Configuration/Builder/ConfigurationFile.cs +++ b/src/Elastic.Documentation.Configuration/Builder/ConfigurationFile.cs @@ -11,7 +11,7 @@ using Elastic.Documentation.Diagnostics; using Elastic.Documentation.Extensions; using Elastic.Documentation.Links; -using static Elastic.Documentation.Configuration.SymlinkValidator; +using static Elastic.Documentation.SymlinkValidator; namespace Elastic.Documentation.Configuration.Builder; diff --git a/src/Elastic.Documentation.Configuration/CrossLinkEntry.cs b/src/Elastic.Documentation.Configuration/Builder/CrossLinkEntry.cs similarity index 91% rename from src/Elastic.Documentation.Configuration/CrossLinkEntry.cs rename to src/Elastic.Documentation.Configuration/Builder/CrossLinkEntry.cs index 9dc66af13d..88e2e591d4 100644 --- a/src/Elastic.Documentation.Configuration/CrossLinkEntry.cs +++ b/src/Elastic.Documentation.Configuration/Builder/CrossLinkEntry.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 -namespace Elastic.Documentation.Configuration; +namespace Elastic.Documentation.Configuration.Builder; /// /// A parsed cross-link entry from docset.yml, with the target registry for lookup. diff --git a/src/Elastic.Documentation.Configuration/DocSetRegistry.cs b/src/Elastic.Documentation.Configuration/Builder/DocSetRegistry.cs similarity index 93% rename from src/Elastic.Documentation.Configuration/DocSetRegistry.cs rename to src/Elastic.Documentation.Configuration/Builder/DocSetRegistry.cs index cfcf9bbf23..ae06ae372d 100644 --- a/src/Elastic.Documentation.Configuration/DocSetRegistry.cs +++ b/src/Elastic.Documentation.Configuration/Builder/DocSetRegistry.cs @@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations; using NetEscapades.EnumGenerators; -namespace Elastic.Documentation.Configuration; +namespace Elastic.Documentation.Configuration.Builder; /// /// Registry type for cross-link resolution. Maps to the link index source: diff --git a/src/Elastic.Documentation.Configuration/Builder/RedirectFile.cs b/src/Elastic.Documentation.Configuration/Builder/RedirectFile.cs index ca43dadb84..ebb6a12597 100644 --- a/src/Elastic.Documentation.Configuration/Builder/RedirectFile.cs +++ b/src/Elastic.Documentation.Configuration/Builder/RedirectFile.cs @@ -5,7 +5,7 @@ using System.IO.Abstractions; using Elastic.Documentation.Links; using YamlDotNet.RepresentationModel; -using static Elastic.Documentation.Configuration.SymlinkValidator; +using static Elastic.Documentation.SymlinkValidator; namespace Elastic.Documentation.Configuration.Builder; diff --git a/src/Elastic.Documentation.Configuration/Changelog/ChangelogConfiguration.cs b/src/Elastic.Documentation.Configuration/Changelog/ChangelogConfiguration.cs index 6b52229a0a..f24c55019c 100644 --- a/src/Elastic.Documentation.Configuration/Changelog/ChangelogConfiguration.cs +++ b/src/Elastic.Documentation.Configuration/Changelog/ChangelogConfiguration.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information using Elastic.Documentation.Configuration.Products; +using Elastic.Documentation.ReleaseNotes; namespace Elastic.Documentation.Configuration.Changelog; diff --git a/src/services/Elastic.Changelog/Configuration/ChangelogConfigurationLoader.cs b/src/Elastic.Documentation.Configuration/Changelog/ChangelogConfigurationLoader.cs similarity index 99% rename from src/services/Elastic.Changelog/Configuration/ChangelogConfigurationLoader.cs rename to src/Elastic.Documentation.Configuration/Changelog/ChangelogConfigurationLoader.cs index 4c866be716..38a73ee728 100644 --- a/src/services/Elastic.Changelog/Configuration/ChangelogConfigurationLoader.cs +++ b/src/Elastic.Documentation.Configuration/Changelog/ChangelogConfigurationLoader.cs @@ -3,11 +3,10 @@ // See the LICENSE file in the project root for more information using System.IO.Abstractions; -using Elastic.Changelog.Serialization; using Elastic.Documentation; using Elastic.Documentation.Configuration; -using Elastic.Documentation.Configuration.Changelog; using Elastic.Documentation.Configuration.Products; +using Elastic.Documentation.Configuration.Serialization; using Elastic.Documentation.Diagnostics; using Elastic.Documentation.ReleaseNotes; using Microsoft.Extensions.Logging; @@ -15,7 +14,7 @@ using YamlDotNet.Serialization; using YamlDotNet.Serialization.NamingConventions; -namespace Elastic.Changelog.Configuration; +namespace Elastic.Documentation.Configuration.Changelog; /// /// Service for loading and validating changelog configuration @@ -25,7 +24,7 @@ public class ChangelogConfigurationLoader(ILoggerFactory logFactory, IConfigurat private readonly ILogger _logger = logFactory.CreateLogger(); private static readonly IDeserializer ConfigurationDeserializer = - new StaticDeserializerBuilder(new ChangelogYamlStaticContext()) + new StaticDeserializerBuilder(new YamlStaticContext()) .WithNamingConvention(UnderscoredNamingConvention.Instance) .WithTypeConverter(new YamlLenientListConverter()) .WithTypeConverter(new TypeEntryYamlConverter()) diff --git a/src/services/Elastic.Changelog/Serialization/ChangelogConfigurationYaml.cs b/src/Elastic.Documentation.Configuration/Changelog/ChangelogConfigurationYaml.cs similarity index 95% rename from src/services/Elastic.Changelog/Serialization/ChangelogConfigurationYaml.cs rename to src/Elastic.Documentation.Configuration/Changelog/ChangelogConfigurationYaml.cs index 03c56e9b8e..80521f6742 100644 --- a/src/services/Elastic.Changelog/Serialization/ChangelogConfigurationYaml.cs +++ b/src/Elastic.Documentation.Configuration/Changelog/ChangelogConfigurationYaml.cs @@ -2,13 +2,13 @@ // 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 -namespace Elastic.Changelog.Serialization; +namespace Elastic.Documentation.Configuration.Changelog; /// /// Internal DTO for YAML deserialization of changelog configuration. /// Maps directly to the YAML file structure. /// -internal record ChangelogConfigurationYaml +internal sealed record ChangelogConfigurationYaml { /// /// Filename strategy for generated changelog files (pr, issue, timestamp). @@ -57,7 +57,7 @@ internal record ChangelogConfigurationYaml /// /// Internal DTO for rules configuration in YAML. /// -internal record RulesConfigurationYaml +internal sealed record RulesConfigurationYaml { /// /// Global match mode for multi-valued fields ("any" or "all"). Default: "any". @@ -83,7 +83,7 @@ internal record RulesConfigurationYaml /// /// Internal DTO for bundle rules in YAML. /// -internal record BundleRulesYaml +internal sealed record BundleRulesYaml { /// /// Product IDs to exclude from the bundle (string or list). Cannot be combined with IncludeProducts. @@ -134,7 +134,7 @@ internal record BundleRulesYaml /// /// Internal DTO for create rules in YAML. /// -internal record CreateRulesYaml +internal sealed record CreateRulesYaml { /// /// Labels to exclude (string or list). Cannot be combined with Include. @@ -161,7 +161,7 @@ internal record CreateRulesYaml /// /// Internal DTO for publish rules in YAML. /// -internal record PublishRulesYaml +internal sealed record PublishRulesYaml { /// /// Match mode for areas ("any" or "all"). Inherits from rules.match if not set. @@ -198,7 +198,7 @@ internal record PublishRulesYaml /// /// Internal DTO for pivot configuration in YAML. /// -internal record PivotConfigurationYaml +internal sealed record PivotConfigurationYaml { /// /// Type definitions with optional labels and subtypes. @@ -231,7 +231,7 @@ internal record PivotConfigurationYaml /// /// Internal DTO for products configuration in YAML. /// -internal record ProductsConfigYaml +internal sealed record ProductsConfigYaml { /// /// List of available product IDs (string or list, empty = all from products.yml). @@ -247,7 +247,7 @@ internal record ProductsConfigYaml /// /// Internal DTO for default product specification in YAML. /// -internal record DefaultProductYaml +internal sealed record DefaultProductYaml { /// /// Product ID. @@ -263,7 +263,7 @@ internal record DefaultProductYaml /// /// Internal DTO for bundle configuration in YAML. /// -internal record BundleConfigurationYaml +internal sealed record BundleConfigurationYaml { /// /// Input directory containing changelog YAML files. @@ -314,7 +314,7 @@ internal record BundleConfigurationYaml /// /// Internal DTO for bundle profile in YAML. /// -internal record BundleProfileYaml +internal sealed record BundleProfileYaml { /// /// Product filter pattern for input changelogs. @@ -371,7 +371,7 @@ internal record BundleProfileYaml /// /// Internal DTO for extract configuration in YAML. /// -internal record ExtractConfigurationYaml +internal sealed record ExtractConfigurationYaml { /// /// Whether to extract release note text from PR or issue descriptions for the changelog entry description by default. @@ -397,7 +397,7 @@ internal record ExtractConfigurationYaml /// Internal DTO for type entry in YAML. /// Can represent either a simple label string or an object with labels and subtypes. /// -internal record TypeEntryYaml +internal sealed record TypeEntryYaml { /// /// Labels for this type (comma-separated string). diff --git a/src/services/Elastic.Changelog/Serialization/TypeEntryYamlConverter.cs b/src/Elastic.Documentation.Configuration/Changelog/TypeEntryYamlConverter.cs similarity index 98% rename from src/services/Elastic.Changelog/Serialization/TypeEntryYamlConverter.cs rename to src/Elastic.Documentation.Configuration/Changelog/TypeEntryYamlConverter.cs index 57c328b24f..135a5ffd78 100644 --- a/src/services/Elastic.Changelog/Serialization/TypeEntryYamlConverter.cs +++ b/src/Elastic.Documentation.Configuration/Changelog/TypeEntryYamlConverter.cs @@ -6,7 +6,7 @@ using YamlDotNet.Core.Events; using YamlDotNet.Serialization; -namespace Elastic.Changelog.Serialization; +namespace Elastic.Documentation.Configuration.Changelog; /// /// YAML type converter for TypeEntryYaml that handles both string and object forms. diff --git a/src/services/Elastic.Changelog/Serialization/YamlLenientList.cs b/src/Elastic.Documentation.Configuration/Changelog/YamlLenientList.cs similarity index 86% rename from src/services/Elastic.Changelog/Serialization/YamlLenientList.cs rename to src/Elastic.Documentation.Configuration/Changelog/YamlLenientList.cs index 724f8538fb..58c77ce908 100644 --- a/src/services/Elastic.Changelog/Serialization/YamlLenientList.cs +++ b/src/Elastic.Documentation.Configuration/Changelog/YamlLenientList.cs @@ -2,14 +2,14 @@ // 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 -namespace Elastic.Changelog.Serialization; +namespace Elastic.Documentation.Configuration.Changelog; /// /// Wrapper type for YAML fields that can be specified as either a comma-separated string /// or a YAML list/sequence. Deserialized by . /// Uses mutable property for compatibility with YamlDotNet source generator. /// -internal class YamlLenientList +internal sealed class YamlLenientList { public List? Values { get; set; } diff --git a/src/services/Elastic.Changelog/Serialization/YamlLenientListConverter.cs b/src/Elastic.Documentation.Configuration/Changelog/YamlLenientListConverter.cs similarity index 98% rename from src/services/Elastic.Changelog/Serialization/YamlLenientListConverter.cs rename to src/Elastic.Documentation.Configuration/Changelog/YamlLenientListConverter.cs index 49bbbb2d53..8facb13be3 100644 --- a/src/services/Elastic.Changelog/Serialization/YamlLenientListConverter.cs +++ b/src/Elastic.Documentation.Configuration/Changelog/YamlLenientListConverter.cs @@ -6,7 +6,7 @@ using YamlDotNet.Core.Events; using YamlDotNet.Serialization; -namespace Elastic.Changelog.Serialization; +namespace Elastic.Documentation.Configuration.Changelog; /// /// YAML type converter for that accepts both string and list forms. diff --git a/src/Elastic.Documentation.Configuration/Inference/VersionInference.cs b/src/Elastic.Documentation.Configuration/Inference/VersionInference.cs index 68f9b6ffd4..c7d176f59a 100644 --- a/src/Elastic.Documentation.Configuration/Inference/VersionInference.cs +++ b/src/Elastic.Documentation.Configuration/Inference/VersionInference.cs @@ -6,6 +6,7 @@ using Elastic.Documentation.Configuration.LegacyUrlMappings; using Elastic.Documentation.Configuration.Products; using Elastic.Documentation.Configuration.Versions; +using Elastic.Documentation.Versions; namespace Elastic.Documentation.Configuration.Inference; diff --git a/src/Elastic.Documentation.Configuration/ReleaseNotes/BundleLoader.cs b/src/Elastic.Documentation.Configuration/ReleaseNotes/BundleLoader.cs index 7956d58190..9dabf2d9ed 100644 --- a/src/Elastic.Documentation.Configuration/ReleaseNotes/BundleLoader.cs +++ b/src/Elastic.Documentation.Configuration/ReleaseNotes/BundleLoader.cs @@ -5,6 +5,7 @@ using System.IO.Abstractions; using System.Text.RegularExpressions; using Elastic.Documentation.ReleaseNotes; +using Elastic.Documentation.Versions; using YamlDotNet.Core; namespace Elastic.Documentation.Configuration.ReleaseNotes; diff --git a/src/Elastic.Documentation.Configuration/Serialization/LenientStringListConverter.cs b/src/Elastic.Documentation.Configuration/Serialization/LenientStringListConverter.cs deleted file mode 100644 index 9b10e71934..0000000000 --- a/src/Elastic.Documentation.Configuration/Serialization/LenientStringListConverter.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// 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 YamlDotNet.Core; -using YamlDotNet.Core.Events; -using YamlDotNet.Serialization; - -namespace Elastic.Documentation.Configuration.Serialization; - -/// -/// YAML type converter for List<string> that accepts both comma-separated strings and YAML sequences. -/// Used by the minimal changelog DTO deserializer so that publish blocker fields like types and areas -/// can be specified as either "deprecation, known-issue" or a YAML list. -/// -public class LenientStringListConverter : IYamlTypeConverter -{ - public bool Accepts(Type type) => type == typeof(List); - - public object? ReadYaml(IParser parser, Type type, ObjectDeserializer rootDeserializer) - { - if (parser.TryConsume(out var scalar)) - { - if (string.IsNullOrEmpty(scalar.Value) || scalar.Value == "~") - return null; - - var items = scalar.Value - .Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries) - .ToList(); - - return items.Count > 0 ? items : null; - } - - if (parser.TryConsume(out _)) - { - var items = new List(); - - while (!parser.TryConsume(out _)) - { - var item = parser.Consume(); - if (!string.IsNullOrWhiteSpace(item.Value)) - items.Add(item.Value.Trim()); - } - - return items.Count > 0 ? items : null; - } - - return null; - } - - public void WriteYaml(IEmitter emitter, object? value, Type type, ObjectSerializer serializer) - { - if (value is not List { Count: > 0 } items) - { - emitter.Emit(new Scalar(null, null, string.Empty, ScalarStyle.Plain, true, false)); - return; - } - - emitter.Emit(new SequenceStart(null, null, false, SequenceStyle.Block)); - - foreach (var item in items) - emitter.Emit(new Scalar(null, null, item, ScalarStyle.Plain, true, false)); - - emitter.Emit(new SequenceEnd()); - } -} diff --git a/src/Elastic.Documentation.Configuration/Serialization/YamlStaticContext.cs b/src/Elastic.Documentation.Configuration/Serialization/YamlStaticContext.cs index 3bb5d61f93..21cab10863 100644 --- a/src/Elastic.Documentation.Configuration/Serialization/YamlStaticContext.cs +++ b/src/Elastic.Documentation.Configuration/Serialization/YamlStaticContext.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information using Elastic.Documentation.Configuration.Assembler; +using Elastic.Documentation.Configuration.Changelog; using Elastic.Documentation.Configuration.Codex; using Elastic.Documentation.Configuration.LegacyUrlMappings; using Elastic.Documentation.Configuration.Products; @@ -61,4 +62,18 @@ namespace Elastic.Documentation.Configuration.Serialization; [YamlSerializable(typeof(ChangelogConfigMinimalDto))] [YamlSerializable(typeof(RulesConfigMinimalDto))] [YamlSerializable(typeof(PublishRulesMinimalDto))] +// Changelog YAML DTOs for CLI configuration (changelog.yml) +[YamlSerializable(typeof(ChangelogConfigurationYaml))] +[YamlSerializable(typeof(PivotConfigurationYaml))] +[YamlSerializable(typeof(TypeEntryYaml))] +[YamlSerializable(typeof(RulesConfigurationYaml))] +[YamlSerializable(typeof(CreateRulesYaml))] +[YamlSerializable(typeof(BundleRulesYaml))] +[YamlSerializable(typeof(PublishRulesYaml))] +[YamlSerializable(typeof(ProductsConfigYaml))] +[YamlSerializable(typeof(DefaultProductYaml))] +[YamlSerializable(typeof(BundleConfigurationYaml))] +[YamlSerializable(typeof(BundleProfileYaml))] +[YamlSerializable(typeof(ExtractConfigurationYaml))] +[YamlSerializable(typeof(YamlLenientList))] public partial class YamlStaticContext; diff --git a/src/Elastic.Documentation.Configuration/SystemEnvironmentVariables.cs b/src/Elastic.Documentation.Configuration/SystemEnvironmentVariables.cs index b8e2d010d9..c9a7228981 100644 --- a/src/Elastic.Documentation.Configuration/SystemEnvironmentVariables.cs +++ b/src/Elastic.Documentation.Configuration/SystemEnvironmentVariables.cs @@ -2,6 +2,8 @@ // 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 Elastic.Documentation; + namespace Elastic.Documentation.Configuration; /// diff --git a/src/Elastic.Documentation.Configuration/Toc/DocumentationSetFile.cs b/src/Elastic.Documentation.Configuration/Toc/DocumentationSetFile.cs index 78e024151a..7e06c6c24d 100644 --- a/src/Elastic.Documentation.Configuration/Toc/DocumentationSetFile.cs +++ b/src/Elastic.Documentation.Configuration/Toc/DocumentationSetFile.cs @@ -10,7 +10,7 @@ using Elastic.Documentation.Extensions; using Nullean.ScopedFileSystem; using YamlDotNet.Serialization; -using static Elastic.Documentation.Configuration.SymlinkValidator; +using static Elastic.Documentation.SymlinkValidator; namespace Elastic.Documentation.Configuration.Toc; diff --git a/src/Elastic.Documentation.Configuration/Versions/VersionConfiguration.cs b/src/Elastic.Documentation.Configuration/Versions/VersionConfiguration.cs index f3ab2edf5d..48af422a4e 100644 --- a/src/Elastic.Documentation.Configuration/Versions/VersionConfiguration.cs +++ b/src/Elastic.Documentation.Configuration/Versions/VersionConfiguration.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information using System.ComponentModel.DataAnnotations; +using Elastic.Documentation.Versions; using NetEscapades.EnumGenerators; using YamlDotNet.Serialization; diff --git a/src/Elastic.Documentation.Configuration/Versions/VersionsConfigurationExtensions.cs b/src/Elastic.Documentation.Configuration/Versions/VersionsConfigurationExtensions.cs index 290b88c752..3458a686ea 100644 --- a/src/Elastic.Documentation.Configuration/Versions/VersionsConfigurationExtensions.cs +++ b/src/Elastic.Documentation.Configuration/Versions/VersionsConfigurationExtensions.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 Elastic.Documentation.Versions; using YamlDotNet.Serialization; namespace Elastic.Documentation.Configuration.Versions; diff --git a/src/Elastic.Documentation.Links/CrossLinks/CrossLinkFetcher.cs b/src/Elastic.Documentation.Links/CrossLinks/CrossLinkFetcher.cs index 2c54f1d374..d4dc8d5cca 100644 --- a/src/Elastic.Documentation.Links/CrossLinks/CrossLinkFetcher.cs +++ b/src/Elastic.Documentation.Links/CrossLinks/CrossLinkFetcher.cs @@ -7,6 +7,7 @@ using System.IO.Abstractions; using System.Text.Json; using Elastic.Documentation.Configuration; +using Elastic.Documentation.Configuration.Builder; using Elastic.Documentation.LinkIndex; using Elastic.Documentation.Serialization; using Microsoft.Extensions.Logging; diff --git a/src/Elastic.Documentation.Links/CrossLinks/CrossLinkResolver.cs b/src/Elastic.Documentation.Links/CrossLinks/CrossLinkResolver.cs index abaf584c2b..d329393b40 100644 --- a/src/Elastic.Documentation.Links/CrossLinks/CrossLinkResolver.cs +++ b/src/Elastic.Documentation.Links/CrossLinks/CrossLinkResolver.cs @@ -5,6 +5,7 @@ using System.Collections.Frozen; using System.Diagnostics.CodeAnalysis; using Elastic.Documentation.Configuration; +using Elastic.Documentation.Configuration.Builder; namespace Elastic.Documentation.Links.CrossLinks; diff --git a/src/Elastic.Documentation.Tooling/Elastic.Documentation.Tooling.csproj b/src/Elastic.Documentation.Tooling/Elastic.Documentation.Tooling.csproj index db831eb93d..1ab221484e 100644 --- a/src/Elastic.Documentation.Tooling/Elastic.Documentation.Tooling.csproj +++ b/src/Elastic.Documentation.Tooling/Elastic.Documentation.Tooling.csproj @@ -6,6 +6,8 @@ enable Elastic.Documentation true + true + $(NoWarn);CS1591;CS1573;CS1572;CS1571;CS1570;CS1574 diff --git a/src/Elastic.Documentation/GlobalCliOptions.cs b/src/Elastic.Documentation.Tooling/GlobalCliOptions.cs similarity index 84% rename from src/Elastic.Documentation/GlobalCliOptions.cs rename to src/Elastic.Documentation.Tooling/GlobalCliOptions.cs index cc0af96f8b..c6c203b8b8 100644 --- a/src/Elastic.Documentation/GlobalCliOptions.cs +++ b/src/Elastic.Documentation.Tooling/GlobalCliOptions.cs @@ -4,6 +4,8 @@ using Microsoft.Extensions.Logging; +// ReSharper disable once CheckNamespace — intentionally preserving the namespace so consumers need no using changes +#pragma warning disable IDE0130 namespace Elastic.Documentation; /// diff --git a/src/Elastic.Documentation/AppliesTo/Applicability.cs b/src/Elastic.Documentation/AppliesTo/Applicability.cs index af0c5f447d..10eb1c4b74 100644 --- a/src/Elastic.Documentation/AppliesTo/Applicability.cs +++ b/src/Elastic.Documentation/AppliesTo/Applicability.cs @@ -6,6 +6,7 @@ using System.Diagnostics.CodeAnalysis; using System.Text; using Elastic.Documentation.Diagnostics; +using Elastic.Documentation.Versions; namespace Elastic.Documentation.AppliesTo; diff --git a/src/Elastic.Documentation/AppliesTo/ApplicabilitySelector.cs b/src/Elastic.Documentation/AppliesTo/ApplicabilitySelector.cs index eb4a0f7f36..aa70d28259 100644 --- a/src/Elastic.Documentation/AppliesTo/ApplicabilitySelector.cs +++ b/src/Elastic.Documentation/AppliesTo/ApplicabilitySelector.cs @@ -2,6 +2,8 @@ // 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 Elastic.Documentation.Versions; + namespace Elastic.Documentation.AppliesTo; /// diff --git a/src/Elastic.Documentation/AppliesTo/ApplicableTo.cs b/src/Elastic.Documentation/AppliesTo/ApplicableTo.cs index 137687bdc1..c5a971b9cb 100644 --- a/src/Elastic.Documentation/AppliesTo/ApplicableTo.cs +++ b/src/Elastic.Documentation/AppliesTo/ApplicableTo.cs @@ -3,9 +3,12 @@ // See the LICENSE file in the project root for more information using System.Collections; +using System.Reflection; using System.Text; using System.Text.Json.Serialization; using Elastic.Documentation.Diagnostics; +using Elastic.Documentation.Search; +using Elastic.Documentation.Versions; namespace Elastic.Documentation.AppliesTo; @@ -65,6 +68,83 @@ public record ApplicableTo Serverless = ServerlessProjectApplicability.All }; + /// + /// Convert this rich applicability description into the flat wire-format entries indexed in Elasticsearch + /// under applies_to. Produces the same JSON shape as ApplicableToJsonConverter. + /// + public IReadOnlyCollection ToAppliesTo() + { + var entries = new List(); + + if (Stack is not null) + AddEntries(entries, "stack", "stack", Stack); + + if (Deployment is not null) + { + if (Deployment.Self is not null) + AddEntries(entries, "deployment", "self", Deployment.Self); + if (Deployment.Ece is not null) + AddEntries(entries, "deployment", "ece", Deployment.Ece); + if (Deployment.Eck is not null) + AddEntries(entries, "deployment", "eck", Deployment.Eck); + if (Deployment.Ess is not null) + AddEntries(entries, "deployment", "ess", Deployment.Ess); + } + + if (Serverless is not null) + { + if (Serverless.Elasticsearch is not null) + AddEntries(entries, "serverless", "elasticsearch", Serverless.Elasticsearch); + if (Serverless.Observability is not null) + AddEntries(entries, "serverless", "observability", Serverless.Observability); + if (Serverless.Security is not null) + AddEntries(entries, "serverless", "security", Serverless.Security); + } + + if (Product is not null) + AddEntries(entries, "product", "product", Product); + + if (ProductApplicability is not null) + { + foreach (var prop in typeof(ProductApplicability).GetProperties()) + { + var name = prop.GetCustomAttribute()?.Name; + if (name is null) + continue; + if (prop.GetValue(ProductApplicability) is AppliesCollection coll) + AddEntries(entries, "product", name, coll); + } + } + + return entries; + } + + private static void AddEntries(List sink, string type, string subType, AppliesCollection coll) + { + foreach (var a in coll) + sink.Add(new AppliesToEntry + { + Type = type, + SubType = subType, + Lifecycle = LifecycleName(a.Lifecycle), + Version = a.Version?.ToString() + }); + } + + private static string LifecycleName(ProductLifecycle lc) => lc switch + { + ProductLifecycle.TechnicalPreview => "preview", + ProductLifecycle.Beta => "beta", + ProductLifecycle.GenerallyAvailable => "ga", + ProductLifecycle.Deprecated => "deprecated", + ProductLifecycle.Removed => "removed", + ProductLifecycle.Unavailable => "unavailable", + ProductLifecycle.Development => "development", + ProductLifecycle.Planned => "planned", + ProductLifecycle.Discontinued => "discontinued", + _ => "ga" + }; + /// public override string ToString() { diff --git a/src/Elastic.Documentation/AppliesTo/ApplicableToJsonConverter.cs b/src/Elastic.Documentation/AppliesTo/ApplicableToJsonConverter.cs index 7d8860b470..acafa95a4e 100644 --- a/src/Elastic.Documentation/AppliesTo/ApplicableToJsonConverter.cs +++ b/src/Elastic.Documentation/AppliesTo/ApplicableToJsonConverter.cs @@ -5,6 +5,7 @@ using System.Reflection; using System.Text.Json; using System.Text.Json.Serialization; +using Elastic.Documentation.Versions; namespace Elastic.Documentation.AppliesTo; diff --git a/src/Elastic.Documentation/Elastic.Documentation.csproj b/src/Elastic.Documentation/Elastic.Documentation.csproj index fb45c3f3a5..cf4182443a 100644 --- a/src/Elastic.Documentation/Elastic.Documentation.csproj +++ b/src/Elastic.Documentation/Elastic.Documentation.csproj @@ -11,7 +11,10 @@ - + + + + diff --git a/src/Elastic.Documentation.Configuration/IEnvironmentVariables.cs b/src/Elastic.Documentation/IEnvironmentVariables.cs similarity index 98% rename from src/Elastic.Documentation.Configuration/IEnvironmentVariables.cs rename to src/Elastic.Documentation/IEnvironmentVariables.cs index 1781abe626..b79944b8bc 100644 --- a/src/Elastic.Documentation.Configuration/IEnvironmentVariables.cs +++ b/src/Elastic.Documentation/IEnvironmentVariables.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 -namespace Elastic.Documentation.Configuration; +namespace Elastic.Documentation; /// /// Abstracts access to environment variables for testability. diff --git a/src/Elastic.Documentation/ChangelogEntrySubtype.cs b/src/Elastic.Documentation/ReleaseNotes/ChangelogEntrySubtype.cs similarity index 96% rename from src/Elastic.Documentation/ChangelogEntrySubtype.cs rename to src/Elastic.Documentation/ReleaseNotes/ChangelogEntrySubtype.cs index dc51d8ce6f..f59d52833b 100644 --- a/src/Elastic.Documentation/ChangelogEntrySubtype.cs +++ b/src/Elastic.Documentation/ReleaseNotes/ChangelogEntrySubtype.cs @@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations; using NetEscapades.EnumGenerators; -namespace Elastic.Documentation; +namespace Elastic.Documentation.ReleaseNotes; /// /// Enum representing changelog entry subtypes (only applicable to breaking changes) diff --git a/src/Elastic.Documentation/ChangelogEntryType.cs b/src/Elastic.Documentation/ReleaseNotes/ChangelogEntryType.cs similarity index 97% rename from src/Elastic.Documentation/ChangelogEntryType.cs rename to src/Elastic.Documentation/ReleaseNotes/ChangelogEntryType.cs index 73c3bf9df6..32ce2ae362 100644 --- a/src/Elastic.Documentation/ChangelogEntryType.cs +++ b/src/Elastic.Documentation/ReleaseNotes/ChangelogEntryType.cs @@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations; using NetEscapades.EnumGenerators; -namespace Elastic.Documentation; +namespace Elastic.Documentation.ReleaseNotes; /// /// Enum representing changelog entry types diff --git a/src/Elastic.Documentation/Serialization/SourceGenerationContext.cs b/src/Elastic.Documentation/Serialization/SourceGenerationContext.cs index cde2ac16ee..40595dd689 100644 --- a/src/Elastic.Documentation/Serialization/SourceGenerationContext.cs +++ b/src/Elastic.Documentation/Serialization/SourceGenerationContext.cs @@ -7,6 +7,7 @@ using Elastic.Documentation.Links; using Elastic.Documentation.Search; using Elastic.Documentation.State; +using Elastic.Documentation.Versions; namespace Elastic.Documentation.Serialization; @@ -19,6 +20,7 @@ namespace Elastic.Documentation.Serialization; [JsonSerializable(typeof(LinkRegistry))] [JsonSerializable(typeof(LinkRegistryEntry))] [JsonSerializable(typeof(DocumentationDocument))] +[JsonSerializable(typeof(AppliesToEntry))] [JsonSerializable(typeof(Dictionary))] [JsonSerializable(typeof(ApplicableTo))] [JsonSerializable(typeof(AppliesCollection))] diff --git a/src/Elastic.Documentation.Configuration/SymlinkValidator.cs b/src/Elastic.Documentation/SymlinkValidator.cs similarity index 98% rename from src/Elastic.Documentation.Configuration/SymlinkValidator.cs rename to src/Elastic.Documentation/SymlinkValidator.cs index 0cbc6747ba..5612c577ab 100644 --- a/src/Elastic.Documentation.Configuration/SymlinkValidator.cs +++ b/src/Elastic.Documentation/SymlinkValidator.cs @@ -6,7 +6,7 @@ using System.Security; using Elastic.Documentation.Extensions; -namespace Elastic.Documentation.Configuration; +namespace Elastic.Documentation; /// /// Provides validation to ensure control files (docset.yml, toc.yml, redirects.yml) diff --git a/src/Elastic.Documentation/SemVersion.cs b/src/Elastic.Documentation/Versions/SemVersion.cs similarity index 99% rename from src/Elastic.Documentation/SemVersion.cs rename to src/Elastic.Documentation/Versions/SemVersion.cs index 6784bb4848..89e853f392 100644 --- a/src/Elastic.Documentation/SemVersion.cs +++ b/src/Elastic.Documentation/Versions/SemVersion.cs @@ -6,7 +6,7 @@ using System.Globalization; using System.Text.RegularExpressions; -namespace Elastic.Documentation; +namespace Elastic.Documentation.Versions; public class AllVersions() : SemVersion(99999, 0, 0) { @@ -307,4 +307,3 @@ private static int CompareComponent(string a, string b, bool lower = false) [GeneratedRegex(@"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$")] private static partial Regex MyRegex(); } - diff --git a/src/Elastic.Documentation/VersionOrDate.cs b/src/Elastic.Documentation/Versions/VersionOrDate.cs similarity index 99% rename from src/Elastic.Documentation/VersionOrDate.cs rename to src/Elastic.Documentation/Versions/VersionOrDate.cs index 7325e3c9d9..513c28c8d5 100644 --- a/src/Elastic.Documentation/VersionOrDate.cs +++ b/src/Elastic.Documentation/Versions/VersionOrDate.cs @@ -4,7 +4,7 @@ using System.Globalization; -namespace Elastic.Documentation; +namespace Elastic.Documentation.Versions; /// /// A version representation that can be either a semantic version or a date. diff --git a/src/Elastic.Documentation/VersionSpec.cs b/src/Elastic.Documentation/Versions/VersionSpec.cs similarity index 99% rename from src/Elastic.Documentation/VersionSpec.cs rename to src/Elastic.Documentation/Versions/VersionSpec.cs index 67881a2168..0fdf7f36ff 100644 --- a/src/Elastic.Documentation/VersionSpec.cs +++ b/src/Elastic.Documentation/Versions/VersionSpec.cs @@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis; -namespace Elastic.Documentation; +namespace Elastic.Documentation.Versions; public sealed class AllVersionsSpec : VersionSpec { diff --git a/src/Elastic.Markdown/Exporters/Elasticsearch/ElasticsearchMarkdownExporter.Export.cs b/src/Elastic.Markdown/Exporters/Elasticsearch/ElasticsearchMarkdownExporter.Export.cs index 1725c842a0..b44d144135 100644 --- a/src/Elastic.Markdown/Exporters/Elasticsearch/ElasticsearchMarkdownExporter.Export.cs +++ b/src/Elastic.Markdown/Exporters/Elasticsearch/ElasticsearchMarkdownExporter.Export.cs @@ -127,7 +127,7 @@ public async ValueTask ExportAsync(MarkdownExportFileContext fileContext, StrippedBody = strippedBody, Description = fileContext.SourceFile.YamlFrontMatter?.Description, Abstract = @abstract, - Applies = appliesTo, + Applies = appliesTo.ToAppliesTo(), Parents = navigation.GetParentsOfMarkdownFile(file).Select(i => new ParentDocument { Title = i.NavigationTitle, diff --git a/src/Elastic.Markdown/Myst/AppliesTo/ApplicableToYamlConverter.cs b/src/Elastic.Markdown/Myst/AppliesTo/ApplicableToYamlConverter.cs index cd64310620..d8523168a4 100644 --- a/src/Elastic.Markdown/Myst/AppliesTo/ApplicableToYamlConverter.cs +++ b/src/Elastic.Markdown/Myst/AppliesTo/ApplicableToYamlConverter.cs @@ -4,6 +4,7 @@ using System.Diagnostics.CodeAnalysis; using Elastic.Documentation.Diagnostics; +using Elastic.Documentation.Versions; using YamlDotNet.Core; using YamlDotNet.Core.Events; using YamlDotNet.Serialization; diff --git a/src/Elastic.Markdown/Myst/AppliesTo/SemVersionConverter.cs b/src/Elastic.Markdown/Myst/AppliesTo/SemVersionConverter.cs index 49ce33e0c4..aecb1a3d5d 100644 --- a/src/Elastic.Markdown/Myst/AppliesTo/SemVersionConverter.cs +++ b/src/Elastic.Markdown/Myst/AppliesTo/SemVersionConverter.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 Elastic.Documentation.Versions; using YamlDotNet.Core; using YamlDotNet.Core.Events; using YamlDotNet.Serialization; diff --git a/src/Elastic.Markdown/Myst/Components/ApplicabilityRenderer.cs b/src/Elastic.Markdown/Myst/Components/ApplicabilityRenderer.cs index a6a3dd4a6d..dcfcee4639 100644 --- a/src/Elastic.Markdown/Myst/Components/ApplicabilityRenderer.cs +++ b/src/Elastic.Markdown/Myst/Components/ApplicabilityRenderer.cs @@ -6,6 +6,7 @@ using Elastic.Documentation; using Elastic.Documentation.AppliesTo; using Elastic.Documentation.Configuration.Versions; +using Elastic.Documentation.Versions; namespace Elastic.Markdown.Myst.Components; diff --git a/src/Elastic.Markdown/Myst/Components/ApplicableToViewModel.cs b/src/Elastic.Markdown/Myst/Components/ApplicableToViewModel.cs index 82afa2ce5f..c7b858d396 100644 --- a/src/Elastic.Markdown/Myst/Components/ApplicableToViewModel.cs +++ b/src/Elastic.Markdown/Myst/Components/ApplicableToViewModel.cs @@ -5,6 +5,7 @@ using Elastic.Documentation; using Elastic.Documentation.AppliesTo; using Elastic.Documentation.Configuration.Versions; +using Elastic.Documentation.Versions; namespace Elastic.Markdown.Myst.Components; diff --git a/src/Elastic.Markdown/Myst/Directives/Changelog/ChangelogBlock.cs b/src/Elastic.Markdown/Myst/Directives/Changelog/ChangelogBlock.cs index 954c932d5a..ae1d2f67c4 100644 --- a/src/Elastic.Markdown/Myst/Directives/Changelog/ChangelogBlock.cs +++ b/src/Elastic.Markdown/Myst/Directives/Changelog/ChangelogBlock.cs @@ -9,6 +9,7 @@ using Elastic.Documentation.Configuration.ReleaseNotes; using Elastic.Documentation.Extensions; using Elastic.Documentation.ReleaseNotes; +using Elastic.Documentation.Versions; using Elastic.Markdown.Diagnostics; using Elastic.Markdown.Helpers; diff --git a/src/Elastic.Markdown/Myst/Directives/Changelog/ChangelogInlineRenderer.cs b/src/Elastic.Markdown/Myst/Directives/Changelog/ChangelogInlineRenderer.cs index f58e3f9f30..114f402bfe 100644 --- a/src/Elastic.Markdown/Myst/Directives/Changelog/ChangelogInlineRenderer.cs +++ b/src/Elastic.Markdown/Myst/Directives/Changelog/ChangelogInlineRenderer.cs @@ -6,6 +6,7 @@ using System.Text; using Elastic.Documentation; using Elastic.Documentation.ReleaseNotes; +using Elastic.Documentation.Versions; namespace Elastic.Markdown.Myst.Directives.Changelog; diff --git a/src/Elastic.Markdown/Myst/Directives/CsvInclude/CsvIncludeBlock.cs b/src/Elastic.Markdown/Myst/Directives/CsvInclude/CsvIncludeBlock.cs index 56e2d10416..4d4d7fcc6d 100644 --- a/src/Elastic.Markdown/Myst/Directives/CsvInclude/CsvIncludeBlock.cs +++ b/src/Elastic.Markdown/Myst/Directives/CsvInclude/CsvIncludeBlock.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information using System.IO.Abstractions; +using Elastic.Documentation; using Elastic.Documentation.Configuration; using Elastic.Documentation.Extensions; using Elastic.Markdown.Diagnostics; diff --git a/src/Elastic.Markdown/Myst/Directives/Include/IncludeBlock.cs b/src/Elastic.Markdown/Myst/Directives/Include/IncludeBlock.cs index 6f1a8efe41..3f5a4e81d5 100644 --- a/src/Elastic.Markdown/Myst/Directives/Include/IncludeBlock.cs +++ b/src/Elastic.Markdown/Myst/Directives/Include/IncludeBlock.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information using System.IO.Abstractions; +using Elastic.Documentation; using Elastic.Documentation.Configuration; using Elastic.Documentation.Extensions; using Elastic.Markdown.Diagnostics; diff --git a/src/Elastic.Markdown/Myst/Directives/Settings/SettingsBlock.cs b/src/Elastic.Markdown/Myst/Directives/Settings/SettingsBlock.cs index cff7043561..69ca93a98d 100644 --- a/src/Elastic.Markdown/Myst/Directives/Settings/SettingsBlock.cs +++ b/src/Elastic.Markdown/Myst/Directives/Settings/SettingsBlock.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information using System.IO.Abstractions; +using Elastic.Documentation; using Elastic.Documentation.Configuration; using Elastic.Documentation.Extensions; using Elastic.Markdown.Diagnostics; diff --git a/src/Elastic.Markdown/Myst/Directives/Version/VersionBlock.cs b/src/Elastic.Markdown/Myst/Directives/Version/VersionBlock.cs index 87bab6f033..e01293cbd5 100644 --- a/src/Elastic.Markdown/Myst/Directives/Version/VersionBlock.cs +++ b/src/Elastic.Markdown/Myst/Directives/Version/VersionBlock.cs @@ -4,6 +4,7 @@ using System.Globalization; using Elastic.Documentation; +using Elastic.Documentation.Versions; using Elastic.Markdown.Diagnostics; using static System.StringSplitOptions; diff --git a/src/Elastic.Markdown/Myst/InlineParsers/Substitution/SubstitutionMutationHelper.cs b/src/Elastic.Markdown/Myst/InlineParsers/Substitution/SubstitutionMutationHelper.cs index f5e696a9c3..6383623d98 100644 --- a/src/Elastic.Markdown/Myst/InlineParsers/Substitution/SubstitutionMutationHelper.cs +++ b/src/Elastic.Markdown/Myst/InlineParsers/Substitution/SubstitutionMutationHelper.cs @@ -4,6 +4,7 @@ using System.Text.Json; using Elastic.Documentation; +using Elastic.Documentation.Versions; namespace Elastic.Markdown.Myst.InlineParsers.Substitution; diff --git a/src/Elastic.Markdown/Myst/Roles/AppliesTo/AppliesToRole.cs b/src/Elastic.Markdown/Myst/Roles/AppliesTo/AppliesToRole.cs index d65d9dd06c..a2803228be 100644 --- a/src/Elastic.Markdown/Myst/Roles/AppliesTo/AppliesToRole.cs +++ b/src/Elastic.Markdown/Myst/Roles/AppliesTo/AppliesToRole.cs @@ -6,6 +6,7 @@ using Elastic.Documentation; using Elastic.Documentation.AppliesTo; using Elastic.Documentation.Configuration; +using Elastic.Documentation.Versions; using Elastic.Markdown.Diagnostics; using Markdig; using Markdig.Parsers; diff --git a/src/api/Elastic.Documentation.Api/Elastic.Documentation.Api.csproj b/src/api/Elastic.Documentation.Api/Elastic.Documentation.Api.csproj index 1c60dcab23..26d0be4ac5 100644 --- a/src/api/Elastic.Documentation.Api/Elastic.Documentation.Api.csproj +++ b/src/api/Elastic.Documentation.Api/Elastic.Documentation.Api.csproj @@ -20,7 +20,7 @@ - + diff --git a/src/api/Elastic.Documentation.Mcp.Remote/Elastic.Documentation.Mcp.Remote.csproj b/src/api/Elastic.Documentation.Mcp.Remote/Elastic.Documentation.Mcp.Remote.csproj index 9fc53017f1..f5a5b5bd5d 100644 --- a/src/api/Elastic.Documentation.Mcp.Remote/Elastic.Documentation.Mcp.Remote.csproj +++ b/src/api/Elastic.Documentation.Mcp.Remote/Elastic.Documentation.Mcp.Remote.csproj @@ -21,7 +21,7 @@ - + diff --git a/src/api/Elastic.Documentation.Mcp.Remote/McpBearerAuthMiddleware.cs b/src/api/Elastic.Documentation.Mcp.Remote/McpBearerAuthMiddleware.cs index c994a65ba5..2549f5b6ca 100644 --- a/src/api/Elastic.Documentation.Mcp.Remote/McpBearerAuthMiddleware.cs +++ b/src/api/Elastic.Documentation.Mcp.Remote/McpBearerAuthMiddleware.cs @@ -4,6 +4,7 @@ using System.IdentityModel.Tokens.Jwt; using System.Security.Cryptography; +using Elastic.Documentation; using Elastic.Documentation.Configuration; using Microsoft.IdentityModel.Tokens; diff --git a/src/api/Elastic.Documentation.Mcp.Remote/McpOAuthMetadata.cs b/src/api/Elastic.Documentation.Mcp.Remote/McpOAuthMetadata.cs index 3a0ec7e6ef..74130afdcd 100644 --- a/src/api/Elastic.Documentation.Mcp.Remote/McpOAuthMetadata.cs +++ b/src/api/Elastic.Documentation.Mcp.Remote/McpOAuthMetadata.cs @@ -4,6 +4,7 @@ using System.Security.Cryptography; using System.Text.Json.Serialization; +using Elastic.Documentation; using Elastic.Documentation.Configuration; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; diff --git a/src/services/Elastic.Changelog/Bundling/ChangelogBundleAmendService.cs b/src/services/Elastic.Changelog/Bundling/ChangelogBundleAmendService.cs index 4120b13a25..cf171799a8 100644 --- a/src/services/Elastic.Changelog/Bundling/ChangelogBundleAmendService.cs +++ b/src/services/Elastic.Changelog/Bundling/ChangelogBundleAmendService.cs @@ -6,7 +6,6 @@ using System.IO.Abstractions; using System.Text; using System.Text.RegularExpressions; -using Elastic.Changelog.Configuration; using Elastic.Changelog.Utilities; using Elastic.Documentation.Configuration; using Elastic.Documentation.Configuration.Assembler; diff --git a/src/services/Elastic.Changelog/Bundling/ChangelogBundlingService.cs b/src/services/Elastic.Changelog/Bundling/ChangelogBundlingService.cs index bd1adbe4e8..cf0b061e21 100644 --- a/src/services/Elastic.Changelog/Bundling/ChangelogBundlingService.cs +++ b/src/services/Elastic.Changelog/Bundling/ChangelogBundlingService.cs @@ -6,7 +6,6 @@ using System.Security.Cryptography; using System.Text; using System.Text.RegularExpressions; -using Elastic.Changelog.Configuration; using Elastic.Changelog.GitHub; using Elastic.Changelog.Rendering; using Elastic.Changelog.Utilities; diff --git a/src/services/Elastic.Changelog/Bundling/ChangelogRemoveService.cs b/src/services/Elastic.Changelog/Bundling/ChangelogRemoveService.cs index 3f66938565..2f867e3f1a 100644 --- a/src/services/Elastic.Changelog/Bundling/ChangelogRemoveService.cs +++ b/src/services/Elastic.Changelog/Bundling/ChangelogRemoveService.cs @@ -4,7 +4,6 @@ using System.IO.Abstractions; using System.Linq; -using Elastic.Changelog.Configuration; using Elastic.Changelog.GitHub; using Elastic.Documentation.Configuration; using Elastic.Documentation.Configuration.Changelog; diff --git a/src/services/Elastic.Changelog/Creation/ChangelogCreationService.cs b/src/services/Elastic.Changelog/Creation/ChangelogCreationService.cs index 6d247f2a1a..7462239ee1 100644 --- a/src/services/Elastic.Changelog/Creation/ChangelogCreationService.cs +++ b/src/services/Elastic.Changelog/Creation/ChangelogCreationService.cs @@ -3,8 +3,8 @@ // See the LICENSE file in the project root for more information using System.IO.Abstractions; -using Elastic.Changelog.Configuration; using Elastic.Changelog.GitHub; +using Elastic.Documentation; using Elastic.Documentation.Configuration; using Elastic.Documentation.Configuration.Changelog; using Elastic.Documentation.Configuration.Inference; diff --git a/src/services/Elastic.Changelog/Evaluation/ChangelogPrEvaluationService.cs b/src/services/Elastic.Changelog/Evaluation/ChangelogPrEvaluationService.cs index a6edeb8368..f140088ad8 100644 --- a/src/services/Elastic.Changelog/Evaluation/ChangelogPrEvaluationService.cs +++ b/src/services/Elastic.Changelog/Evaluation/ChangelogPrEvaluationService.cs @@ -5,7 +5,6 @@ using System.Globalization; using System.IO.Abstractions; using Actions.Core.Services; -using Elastic.Changelog.Configuration; using Elastic.Changelog.Creation; using Elastic.Changelog.GitHub; using Elastic.Documentation.Configuration; diff --git a/src/services/Elastic.Changelog/Evaluation/ChangelogPrepareArtifactService.cs b/src/services/Elastic.Changelog/Evaluation/ChangelogPrepareArtifactService.cs index 4308bf1e2c..aa932859dd 100644 --- a/src/services/Elastic.Changelog/Evaluation/ChangelogPrepareArtifactService.cs +++ b/src/services/Elastic.Changelog/Evaluation/ChangelogPrepareArtifactService.cs @@ -6,9 +6,9 @@ using System.Text; using System.Text.Json; using Actions.Core.Services; -using Elastic.Changelog.Configuration; using Elastic.Changelog.Utilities; using Elastic.Documentation.Configuration; +using Elastic.Documentation.Configuration.Changelog; using Elastic.Documentation.Diagnostics; using Elastic.Documentation.Services; using Microsoft.Extensions.Logging; diff --git a/src/services/Elastic.Changelog/GithubRelease/GitHubReleaseChangelogService.cs b/src/services/Elastic.Changelog/GithubRelease/GitHubReleaseChangelogService.cs index 2351414d40..1784f98dcb 100644 --- a/src/services/Elastic.Changelog/GithubRelease/GitHubReleaseChangelogService.cs +++ b/src/services/Elastic.Changelog/GithubRelease/GitHubReleaseChangelogService.cs @@ -6,7 +6,6 @@ using System.IO.Abstractions; using System.Text; using Elastic.Changelog.Bundling; -using Elastic.Changelog.Configuration; using Elastic.Changelog.GitHub; using Elastic.Changelog.Utilities; using Elastic.Documentation; diff --git a/src/services/Elastic.Changelog/Rendering/Asciidoc/ChangelogAsciidocRenderer.cs b/src/services/Elastic.Changelog/Rendering/Asciidoc/ChangelogAsciidocRenderer.cs index c5d400f046..f59297ac40 100644 --- a/src/services/Elastic.Changelog/Rendering/Asciidoc/ChangelogAsciidocRenderer.cs +++ b/src/services/Elastic.Changelog/Rendering/Asciidoc/ChangelogAsciidocRenderer.cs @@ -7,7 +7,7 @@ using System.IO.Abstractions; using System.Text; using static System.Globalization.CultureInfo; -using static Elastic.Documentation.ChangelogEntryType; +using static Elastic.Documentation.ReleaseNotes.ChangelogEntryType; namespace Elastic.Changelog.Rendering.Asciidoc; diff --git a/src/services/Elastic.Changelog/Rendering/ChangelogRenderingService.cs b/src/services/Elastic.Changelog/Rendering/ChangelogRenderingService.cs index 0c8188b41b..81a895618f 100644 --- a/src/services/Elastic.Changelog/Rendering/ChangelogRenderingService.cs +++ b/src/services/Elastic.Changelog/Rendering/ChangelogRenderingService.cs @@ -5,13 +5,13 @@ using System.ComponentModel.DataAnnotations; using System.IO.Abstractions; using System.Text.Json.Serialization; -using Elastic.Changelog.Configuration; using Elastic.Documentation; using Elastic.Documentation.Configuration; using Elastic.Documentation.Configuration.Changelog; using Elastic.Documentation.Diagnostics; using Elastic.Documentation.ReleaseNotes; using Elastic.Documentation.Services; +using Elastic.Documentation.Versions; using Microsoft.Extensions.Logging; using NetEscapades.EnumGenerators; using Nullean.ScopedFileSystem; diff --git a/src/services/Elastic.Changelog/Rendering/Markdown/BreakingChangesMarkdownRenderer.cs b/src/services/Elastic.Changelog/Rendering/Markdown/BreakingChangesMarkdownRenderer.cs index 0434f2c902..1eae9745d4 100644 --- a/src/services/Elastic.Changelog/Rendering/Markdown/BreakingChangesMarkdownRenderer.cs +++ b/src/services/Elastic.Changelog/Rendering/Markdown/BreakingChangesMarkdownRenderer.cs @@ -8,7 +8,7 @@ using Elastic.Documentation.ReleaseNotes; using Nullean.ScopedFileSystem; using static System.Globalization.CultureInfo; -using static Elastic.Documentation.ChangelogEntryType; +using static Elastic.Documentation.ReleaseNotes.ChangelogEntryType; namespace Elastic.Changelog.Rendering.Markdown; diff --git a/src/services/Elastic.Changelog/Rendering/Markdown/ChangelogGfmRenderer.cs b/src/services/Elastic.Changelog/Rendering/Markdown/ChangelogGfmRenderer.cs index 38a4afe3e5..9d0e40cfdd 100644 --- a/src/services/Elastic.Changelog/Rendering/Markdown/ChangelogGfmRenderer.cs +++ b/src/services/Elastic.Changelog/Rendering/Markdown/ChangelogGfmRenderer.cs @@ -8,7 +8,7 @@ using Elastic.Documentation.ReleaseNotes; using Nullean.ScopedFileSystem; using static System.Globalization.CultureInfo; -using static Elastic.Documentation.ChangelogEntryType; +using static Elastic.Documentation.ReleaseNotes.ChangelogEntryType; namespace Elastic.Changelog.Rendering.Markdown; diff --git a/src/services/Elastic.Changelog/Rendering/Markdown/DeprecationsMarkdownRenderer.cs b/src/services/Elastic.Changelog/Rendering/Markdown/DeprecationsMarkdownRenderer.cs index 048612f32d..43843594d8 100644 --- a/src/services/Elastic.Changelog/Rendering/Markdown/DeprecationsMarkdownRenderer.cs +++ b/src/services/Elastic.Changelog/Rendering/Markdown/DeprecationsMarkdownRenderer.cs @@ -7,7 +7,7 @@ using Elastic.Documentation.ReleaseNotes; using Nullean.ScopedFileSystem; using static System.Globalization.CultureInfo; -using static Elastic.Documentation.ChangelogEntryType; +using static Elastic.Documentation.ReleaseNotes.ChangelogEntryType; namespace Elastic.Changelog.Rendering.Markdown; diff --git a/src/services/Elastic.Changelog/Rendering/Markdown/IndexMarkdownRenderer.cs b/src/services/Elastic.Changelog/Rendering/Markdown/IndexMarkdownRenderer.cs index 73f92dee39..4531e47f9a 100644 --- a/src/services/Elastic.Changelog/Rendering/Markdown/IndexMarkdownRenderer.cs +++ b/src/services/Elastic.Changelog/Rendering/Markdown/IndexMarkdownRenderer.cs @@ -8,7 +8,7 @@ using Elastic.Documentation.ReleaseNotes; using Nullean.ScopedFileSystem; using static System.Globalization.CultureInfo; -using static Elastic.Documentation.ChangelogEntryType; +using static Elastic.Documentation.ReleaseNotes.ChangelogEntryType; namespace Elastic.Changelog.Rendering.Markdown; diff --git a/src/services/Elastic.Changelog/Rendering/Markdown/KnownIssuesMarkdownRenderer.cs b/src/services/Elastic.Changelog/Rendering/Markdown/KnownIssuesMarkdownRenderer.cs index 5b9dbe521a..b84e4945e7 100644 --- a/src/services/Elastic.Changelog/Rendering/Markdown/KnownIssuesMarkdownRenderer.cs +++ b/src/services/Elastic.Changelog/Rendering/Markdown/KnownIssuesMarkdownRenderer.cs @@ -7,7 +7,7 @@ using Elastic.Documentation.ReleaseNotes; using Nullean.ScopedFileSystem; using static System.Globalization.CultureInfo; -using static Elastic.Documentation.ChangelogEntryType; +using static Elastic.Documentation.ReleaseNotes.ChangelogEntryType; namespace Elastic.Changelog.Rendering.Markdown; diff --git a/src/services/Elastic.Changelog/Serialization/ChangelogYamlStaticContext.cs b/src/services/Elastic.Changelog/Serialization/ChangelogYamlStaticContext.cs deleted file mode 100644 index 1599702cfb..0000000000 --- a/src/services/Elastic.Changelog/Serialization/ChangelogYamlStaticContext.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// 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 YamlDotNet.Serialization; - -namespace Elastic.Changelog.Serialization; - -[YamlStaticContext] -// YAML DTOs for CLI configuration (changelog.yml) -[YamlSerializable(typeof(ChangelogConfigurationYaml))] -[YamlSerializable(typeof(PivotConfigurationYaml))] -[YamlSerializable(typeof(TypeEntryYaml))] -[YamlSerializable(typeof(RulesConfigurationYaml))] -[YamlSerializable(typeof(CreateRulesYaml))] -[YamlSerializable(typeof(BundleRulesYaml))] -[YamlSerializable(typeof(PublishRulesYaml))] -[YamlSerializable(typeof(ProductsConfigYaml))] -[YamlSerializable(typeof(DefaultProductYaml))] -[YamlSerializable(typeof(BundleConfigurationYaml))] -[YamlSerializable(typeof(BundleProfileYaml))] -[YamlSerializable(typeof(ExtractConfigurationYaml))] -[YamlSerializable(typeof(YamlLenientList))] -public partial class ChangelogYamlStaticContext; diff --git a/src/services/Elastic.Changelog/Uploading/ChangelogUploadService.cs b/src/services/Elastic.Changelog/Uploading/ChangelogUploadService.cs index b0baa6c81f..2c7f1bc838 100644 --- a/src/services/Elastic.Changelog/Uploading/ChangelogUploadService.cs +++ b/src/services/Elastic.Changelog/Uploading/ChangelogUploadService.cs @@ -5,7 +5,7 @@ using System.IO.Abstractions; using System.Text.RegularExpressions; using Amazon.S3; -using Elastic.Changelog.Configuration; +using Elastic.Documentation; using Elastic.Documentation.Configuration; using Elastic.Documentation.Configuration.Changelog; using Elastic.Documentation.Configuration.ReleaseNotes; diff --git a/src/services/Elastic.Documentation.Assembler/Building/AssemblerBuildService.cs b/src/services/Elastic.Documentation.Assembler/Building/AssemblerBuildService.cs index bc9615e18d..73b60ff407 100644 --- a/src/services/Elastic.Documentation.Assembler/Building/AssemblerBuildService.cs +++ b/src/services/Elastic.Documentation.Assembler/Building/AssemblerBuildService.cs @@ -5,6 +5,7 @@ using System.IO.Abstractions; using System.Text; using Actions.Core.Services; +using Elastic.Documentation; using Elastic.Documentation.Assembler.Navigation; using Elastic.Documentation.Assembler.Sourcing; using Elastic.Documentation.Configuration; diff --git a/src/services/Elastic.Documentation.Isolated/IsolatedBuildService.cs b/src/services/Elastic.Documentation.Isolated/IsolatedBuildService.cs index 4bb4bcbc63..204292009f 100644 --- a/src/services/Elastic.Documentation.Isolated/IsolatedBuildService.cs +++ b/src/services/Elastic.Documentation.Isolated/IsolatedBuildService.cs @@ -5,6 +5,7 @@ using System.IO.Abstractions; using Actions.Core.Services; using Elastic.ApiExplorer; +using Elastic.Documentation; using Elastic.Documentation.Configuration; using Elastic.Documentation.Configuration.Builder; using Elastic.Documentation.Configuration.Inference; diff --git a/src/services/search/Elastic.Documentation.Search.Contract/AppliesToEntry.cs b/src/services/search/Elastic.Documentation.Search.Contract/AppliesToEntry.cs new file mode 100644 index 0000000000..93eb0bdf59 --- /dev/null +++ b/src/services/search/Elastic.Documentation.Search.Contract/AppliesToEntry.cs @@ -0,0 +1,28 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// 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.Text.Json.Serialization; + +namespace Elastic.Documentation.Search; + +/// +/// Flat wire-format entry for the applies_to array indexed in Elasticsearch. +/// One entry per (type, sub_type, lifecycle, version) tuple, preserving the exact JSON shape +/// produced by the applicability converter in docs-builder. +/// +public record AppliesToEntry +{ + [JsonPropertyName("type")] + public required string Type { get; init; } + + [JsonPropertyName("sub_type")] + public required string SubType { get; init; } + + [JsonPropertyName("lifecycle")] + public required string Lifecycle { get; init; } + + [JsonPropertyName("version")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public string? Version { get; init; } +} diff --git a/src/Elastic.Documentation/Search/DocumentationDocument.cs b/src/services/search/Elastic.Documentation.Search.Contract/DocumentationDocument.cs similarity index 98% rename from src/Elastic.Documentation/Search/DocumentationDocument.cs rename to src/services/search/Elastic.Documentation.Search.Contract/DocumentationDocument.cs index 77e8f17da6..75244d6856 100644 --- a/src/Elastic.Documentation/Search/DocumentationDocument.cs +++ b/src/services/search/Elastic.Documentation.Search.Contract/DocumentationDocument.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information using System.Text.Json.Serialization; -using Elastic.Documentation.AppliesTo; using Elastic.Mapping; namespace Elastic.Documentation.Search; @@ -134,7 +133,7 @@ public string ContentType [Nested] [JsonPropertyName("applies_to")] - public ApplicableTo? Applies { get; set; } + public IReadOnlyCollection? Applies { get; set; } [JsonPropertyName("body")] public string? Body { get; set; } diff --git a/src/Elastic.Documentation/Search/DocumentationMappingConfig.cs b/src/services/search/Elastic.Documentation.Search.Contract/DocumentationMappingConfig.cs similarity index 100% rename from src/Elastic.Documentation/Search/DocumentationMappingConfig.cs rename to src/services/search/Elastic.Documentation.Search.Contract/DocumentationMappingConfig.cs diff --git a/src/services/search/Elastic.Documentation.Search.Contract/Elastic.Documentation.Search.Contract.csproj b/src/services/search/Elastic.Documentation.Search.Contract/Elastic.Documentation.Search.Contract.csproj new file mode 100644 index 0000000000..03a2f9155d --- /dev/null +++ b/src/services/search/Elastic.Documentation.Search.Contract/Elastic.Documentation.Search.Contract.csproj @@ -0,0 +1,17 @@ + + + + net10.0 + enable + enable + Elastic.Documentation.Search + true + true + $(NoWarn);CS1591;CS1573;CS1572;CS1571;CS1570;CS1574 + + + + + + + diff --git a/src/Elastic.Documentation/Search/IndexedProduct.cs b/src/services/search/Elastic.Documentation.Search.Contract/IndexedProduct.cs similarity index 100% rename from src/Elastic.Documentation/Search/IndexedProduct.cs rename to src/services/search/Elastic.Documentation.Search.Contract/IndexedProduct.cs diff --git a/src/services/Elastic.Documentation.Search/ChangesService.cs b/src/services/search/Elastic.Documentation.Search/ChangesService.cs similarity index 100% rename from src/services/Elastic.Documentation.Search/ChangesService.cs rename to src/services/search/Elastic.Documentation.Search/ChangesService.cs diff --git a/src/services/Elastic.Documentation.Search/Common/ElasticsearchClientAccessor.cs b/src/services/search/Elastic.Documentation.Search/Common/ElasticsearchClientAccessor.cs similarity index 100% rename from src/services/Elastic.Documentation.Search/Common/ElasticsearchClientAccessor.cs rename to src/services/search/Elastic.Documentation.Search/Common/ElasticsearchClientAccessor.cs diff --git a/src/services/Elastic.Documentation.Search/Common/SearchQueryBuilder.cs b/src/services/search/Elastic.Documentation.Search/Common/SearchQueryBuilder.cs similarity index 100% rename from src/services/Elastic.Documentation.Search/Common/SearchQueryBuilder.cs rename to src/services/search/Elastic.Documentation.Search/Common/SearchQueryBuilder.cs diff --git a/src/services/Elastic.Documentation.Search/Common/SearchResultProcessor.cs b/src/services/search/Elastic.Documentation.Search/Common/SearchResultProcessor.cs similarity index 100% rename from src/services/Elastic.Documentation.Search/Common/SearchResultProcessor.cs rename to src/services/search/Elastic.Documentation.Search/Common/SearchResultProcessor.cs diff --git a/src/services/Elastic.Documentation.Search/Elastic.Documentation.Search.csproj b/src/services/search/Elastic.Documentation.Search/Elastic.Documentation.Search.csproj similarity index 74% rename from src/services/Elastic.Documentation.Search/Elastic.Documentation.Search.csproj rename to src/services/search/Elastic.Documentation.Search/Elastic.Documentation.Search.csproj index 5b7ce28433..7287902825 100644 --- a/src/services/Elastic.Documentation.Search/Elastic.Documentation.Search.csproj +++ b/src/services/search/Elastic.Documentation.Search/Elastic.Documentation.Search.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/src/services/Elastic.Documentation.Search/EsJsonContext.cs b/src/services/search/Elastic.Documentation.Search/EsJsonContext.cs similarity index 100% rename from src/services/Elastic.Documentation.Search/EsJsonContext.cs rename to src/services/search/Elastic.Documentation.Search/EsJsonContext.cs diff --git a/src/services/Elastic.Documentation.Search/FullSearchService.cs b/src/services/search/Elastic.Documentation.Search/FullSearchService.cs similarity index 100% rename from src/services/Elastic.Documentation.Search/FullSearchService.cs rename to src/services/search/Elastic.Documentation.Search/FullSearchService.cs diff --git a/src/services/Elastic.Documentation.Search/IChangesService.cs b/src/services/search/Elastic.Documentation.Search/IChangesService.cs similarity index 100% rename from src/services/Elastic.Documentation.Search/IChangesService.cs rename to src/services/search/Elastic.Documentation.Search/IChangesService.cs diff --git a/src/services/Elastic.Documentation.Search/IFullSearchService.cs b/src/services/search/Elastic.Documentation.Search/IFullSearchService.cs similarity index 100% rename from src/services/Elastic.Documentation.Search/IFullSearchService.cs rename to src/services/search/Elastic.Documentation.Search/IFullSearchService.cs diff --git a/src/services/Elastic.Documentation.Search/INavigationSearchService.cs b/src/services/search/Elastic.Documentation.Search/INavigationSearchService.cs similarity index 100% rename from src/services/Elastic.Documentation.Search/INavigationSearchService.cs rename to src/services/search/Elastic.Documentation.Search/INavigationSearchService.cs diff --git a/src/services/Elastic.Documentation.Search/MockSearchService.cs b/src/services/search/Elastic.Documentation.Search/MockSearchService.cs similarity index 100% rename from src/services/Elastic.Documentation.Search/MockSearchService.cs rename to src/services/search/Elastic.Documentation.Search/MockSearchService.cs diff --git a/src/services/Elastic.Documentation.Search/NavigationSearchService.cs b/src/services/search/Elastic.Documentation.Search/NavigationSearchService.cs similarity index 100% rename from src/services/Elastic.Documentation.Search/NavigationSearchService.cs rename to src/services/search/Elastic.Documentation.Search/NavigationSearchService.cs diff --git a/src/services/Elastic.Documentation.Search/ServicesExtension.cs b/src/services/search/Elastic.Documentation.Search/ServicesExtension.cs similarity index 100% rename from src/services/Elastic.Documentation.Search/ServicesExtension.cs rename to src/services/search/Elastic.Documentation.Search/ServicesExtension.cs diff --git a/src/services/Elastic.Documentation.Search/SharedPointInTimeManager.cs b/src/services/search/Elastic.Documentation.Search/SharedPointInTimeManager.cs similarity index 100% rename from src/services/Elastic.Documentation.Search/SharedPointInTimeManager.cs rename to src/services/search/Elastic.Documentation.Search/SharedPointInTimeManager.cs diff --git a/src/services/Elastic.Documentation.Search/StringHighlightExtensions.cs b/src/services/search/Elastic.Documentation.Search/StringHighlightExtensions.cs similarity index 100% rename from src/services/Elastic.Documentation.Search/StringHighlightExtensions.cs rename to src/services/search/Elastic.Documentation.Search/StringHighlightExtensions.cs diff --git a/src/tooling/docs-builder/Commands/ChangelogCommand.cs b/src/tooling/docs-builder/Commands/ChangelogCommand.cs index 909c56823e..3c6a2c5f70 100644 --- a/src/tooling/docs-builder/Commands/ChangelogCommand.cs +++ b/src/tooling/docs-builder/Commands/ChangelogCommand.cs @@ -11,7 +11,6 @@ using Documentation.Builder.Arguments; using Elastic.Changelog; using Elastic.Changelog.Bundling; -using Elastic.Changelog.Configuration; using Elastic.Changelog.Creation; using Elastic.Changelog.Evaluation; using Elastic.Changelog.GitHub; @@ -19,7 +18,9 @@ using Elastic.Changelog.Rendering; using Elastic.Changelog.Uploading; using Elastic.Changelog.Utilities; +using Elastic.Documentation; using Elastic.Documentation.Configuration; +using Elastic.Documentation.Configuration.Changelog; using Elastic.Documentation.Diagnostics; using Elastic.Documentation.ReleaseNotes; using Elastic.Documentation.Services; diff --git a/src/tooling/docs-builder/Middleware/CheckForUpdatesMiddleware.cs b/src/tooling/docs-builder/Middleware/CheckForUpdatesMiddleware.cs index 34f41953ff..35670eadd2 100644 --- a/src/tooling/docs-builder/Middleware/CheckForUpdatesMiddleware.cs +++ b/src/tooling/docs-builder/Middleware/CheckForUpdatesMiddleware.cs @@ -6,6 +6,7 @@ using System.Reflection; using Elastic.Documentation; using Elastic.Documentation.Configuration; +using Elastic.Documentation.Versions; using Microsoft.Extensions.Logging; using Nullean.Argh.Middleware; diff --git a/tests-integration/Elastic.Assembler.IntegrationTests/TestHelpers.cs b/tests-integration/Elastic.Assembler.IntegrationTests/TestHelpers.cs index 95a250c570..01bb997ef0 100644 --- a/tests-integration/Elastic.Assembler.IntegrationTests/TestHelpers.cs +++ b/tests-integration/Elastic.Assembler.IntegrationTests/TestHelpers.cs @@ -10,6 +10,7 @@ using Elastic.Documentation.Configuration.Products; using Elastic.Documentation.Configuration.Search; using Elastic.Documentation.Configuration.Versions; +using Elastic.Documentation.Versions; using Microsoft.Extensions.Logging.Abstractions; namespace Elastic.Assembler.IntegrationTests; diff --git a/tests-integration/Mcp.Remote.IntegrationTests/Mcp.Remote.IntegrationTests.csproj b/tests-integration/Mcp.Remote.IntegrationTests/Mcp.Remote.IntegrationTests.csproj index e18027f7c3..0b21ba1622 100644 --- a/tests-integration/Mcp.Remote.IntegrationTests/Mcp.Remote.IntegrationTests.csproj +++ b/tests-integration/Mcp.Remote.IntegrationTests/Mcp.Remote.IntegrationTests.csproj @@ -8,7 +8,7 @@ - + diff --git a/tests-integration/Search.IntegrationTests/Search.IntegrationTests.csproj b/tests-integration/Search.IntegrationTests/Search.IntegrationTests.csproj index c7dcf104d1..e2367742fd 100644 --- a/tests-integration/Search.IntegrationTests/Search.IntegrationTests.csproj +++ b/tests-integration/Search.IntegrationTests/Search.IntegrationTests.csproj @@ -8,7 +8,7 @@ - + diff --git a/tests/Elastic.ApiExplorer.Tests/OpenApiDocumentExporterTests.cs b/tests/Elastic.ApiExplorer.Tests/OpenApiDocumentExporterTests.cs index a2ed6c78ae..86433fd286 100644 --- a/tests/Elastic.ApiExplorer.Tests/OpenApiDocumentExporterTests.cs +++ b/tests/Elastic.ApiExplorer.Tests/OpenApiDocumentExporterTests.cs @@ -8,6 +8,7 @@ using Elastic.Documentation; using Elastic.Documentation.Configuration.Versions; using Elastic.Documentation.Search; +using Elastic.Documentation.Versions; using static System.StringComparison; namespace Elastic.ApiExplorer.Tests; diff --git a/tests/Elastic.ApiExplorer.Tests/TestHelpers.cs b/tests/Elastic.ApiExplorer.Tests/TestHelpers.cs index eed99c1bcb..26727feb30 100644 --- a/tests/Elastic.ApiExplorer.Tests/TestHelpers.cs +++ b/tests/Elastic.ApiExplorer.Tests/TestHelpers.cs @@ -12,6 +12,7 @@ using Elastic.Documentation.Configuration.Products; using Elastic.Documentation.Configuration.Search; using Elastic.Documentation.Configuration.Versions; +using Elastic.Documentation.Versions; using Microsoft.Extensions.Logging.Abstractions; namespace Elastic.ApiExplorer.Tests; diff --git a/tests/Elastic.Changelog.Tests/Changelogs/ChangelogConfigurationTests.cs b/tests/Elastic.Changelog.Tests/Changelogs/ChangelogConfigurationTests.cs index 712b379e35..3bfe1528c2 100644 --- a/tests/Elastic.Changelog.Tests/Changelogs/ChangelogConfigurationTests.cs +++ b/tests/Elastic.Changelog.Tests/Changelogs/ChangelogConfigurationTests.cs @@ -3,11 +3,11 @@ // See the LICENSE file in the project root for more information using AwesomeAssertions; -using Elastic.Changelog.Configuration; -using Elastic.Changelog.Serialization; using Elastic.Documentation; using Elastic.Documentation.Configuration; using Elastic.Documentation.Configuration.Changelog; +using Elastic.Documentation.Configuration.Changelog; +using Elastic.Documentation.Configuration.Changelog; using Elastic.Documentation.Diagnostics; using Elastic.Documentation.ReleaseNotes; diff --git a/tests/Elastic.Changelog.Tests/Changelogs/ChangelogTestBase.cs b/tests/Elastic.Changelog.Tests/Changelogs/ChangelogTestBase.cs index 5e3b93a57d..832d20ab2c 100644 --- a/tests/Elastic.Changelog.Tests/Changelogs/ChangelogTestBase.cs +++ b/tests/Elastic.Changelog.Tests/Changelogs/ChangelogTestBase.cs @@ -11,6 +11,7 @@ using Elastic.Documentation.Configuration.Products; using Elastic.Documentation.Configuration.Search; using Elastic.Documentation.Configuration.Versions; +using Elastic.Documentation.Versions; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Nullean.ScopedFileSystem; diff --git a/tests/Elastic.Changelog.Tests/Changelogs/Create/CreateChangelogTestBase.cs b/tests/Elastic.Changelog.Tests/Changelogs/Create/CreateChangelogTestBase.cs index e00e7ddb75..1c485eedfb 100644 --- a/tests/Elastic.Changelog.Tests/Changelogs/Create/CreateChangelogTestBase.cs +++ b/tests/Elastic.Changelog.Tests/Changelogs/Create/CreateChangelogTestBase.cs @@ -4,6 +4,7 @@ using Elastic.Changelog.Creation; using Elastic.Changelog.GitHub; +using Elastic.Documentation; using Elastic.Documentation.Configuration; using FakeItEasy; diff --git a/tests/Elastic.Changelog.Tests/Changelogs/Create/ReleaseNoteExtractionTests.cs b/tests/Elastic.Changelog.Tests/Changelogs/Create/ReleaseNoteExtractionTests.cs index 0f031aacb7..900013ac71 100644 --- a/tests/Elastic.Changelog.Tests/Changelogs/Create/ReleaseNoteExtractionTests.cs +++ b/tests/Elastic.Changelog.Tests/Changelogs/Create/ReleaseNoteExtractionTests.cs @@ -5,6 +5,7 @@ using AwesomeAssertions; using Elastic.Changelog.Creation; using Elastic.Changelog.GitHub; +using Elastic.Documentation; using Elastic.Documentation.Configuration; using FakeItEasy; diff --git a/tests/Elastic.Changelog.Tests/Changelogs/Render/ErrorHandlingTests.cs b/tests/Elastic.Changelog.Tests/Changelogs/Render/ErrorHandlingTests.cs index bd72bf9c67..03f0c54020 100644 --- a/tests/Elastic.Changelog.Tests/Changelogs/Render/ErrorHandlingTests.cs +++ b/tests/Elastic.Changelog.Tests/Changelogs/Render/ErrorHandlingTests.cs @@ -4,9 +4,9 @@ using AwesomeAssertions; using Elastic.Changelog.Bundling; -using Elastic.Changelog.Configuration; using Elastic.Changelog.Rendering; using Elastic.Documentation.Configuration; +using Elastic.Documentation.Configuration.Changelog; using Elastic.Documentation.Diagnostics; namespace Elastic.Changelog.Tests.Changelogs.Render; diff --git a/tests/Elastic.Changelog.Tests/Creation/CIEnrichmentTests.cs b/tests/Elastic.Changelog.Tests/Creation/CIEnrichmentTests.cs index bba674d2c4..ab38e30eb0 100644 --- a/tests/Elastic.Changelog.Tests/Creation/CIEnrichmentTests.cs +++ b/tests/Elastic.Changelog.Tests/Creation/CIEnrichmentTests.cs @@ -5,6 +5,7 @@ using AwesomeAssertions; using Elastic.Changelog.Creation; using Elastic.Changelog.Tests.Changelogs; +using Elastic.Documentation; using Elastic.Documentation.Configuration; using FakeItEasy; diff --git a/tests/Elastic.Changelog.Tests/Creation/ChangelogCreationServiceTests.cs b/tests/Elastic.Changelog.Tests/Creation/ChangelogCreationServiceTests.cs index b4f7e4fc30..60480bbc4f 100644 --- a/tests/Elastic.Changelog.Tests/Creation/ChangelogCreationServiceTests.cs +++ b/tests/Elastic.Changelog.Tests/Creation/ChangelogCreationServiceTests.cs @@ -9,6 +9,7 @@ using Elastic.Changelog.GitHub; using Elastic.Changelog.Tests.Changelogs; using Elastic.Changelog.Utilities; +using Elastic.Documentation; using Elastic.Documentation.Configuration; using FakeItEasy; 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 150e8f13af..67afbae2e4 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 @@ -6,7 +6,7 @@ - + diff --git a/tests/Elastic.Documentation.Build.Tests/MockEnvironmentVariables.cs b/tests/Elastic.Documentation.Build.Tests/MockEnvironmentVariables.cs index 45cb7deaee..284b950c4a 100644 --- a/tests/Elastic.Documentation.Build.Tests/MockEnvironmentVariables.cs +++ b/tests/Elastic.Documentation.Build.Tests/MockEnvironmentVariables.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 Elastic.Documentation; using Elastic.Documentation.Configuration; namespace Elastic.Documentation.Build.Tests; diff --git a/tests/Elastic.Documentation.Build.Tests/SymlinkValidationTests.cs b/tests/Elastic.Documentation.Build.Tests/SymlinkValidationTests.cs index e165b09555..87bc8daec9 100644 --- a/tests/Elastic.Documentation.Build.Tests/SymlinkValidationTests.cs +++ b/tests/Elastic.Documentation.Build.Tests/SymlinkValidationTests.cs @@ -5,6 +5,7 @@ using System.IO.Abstractions.TestingHelpers; using System.Security; using AwesomeAssertions; +using Elastic.Documentation; using Elastic.Documentation.Configuration; namespace Elastic.Documentation.Build.Tests; diff --git a/tests/Elastic.Documentation.Build.Tests/TestHelpers.cs b/tests/Elastic.Documentation.Build.Tests/TestHelpers.cs index 51b84cd905..804502ebca 100644 --- a/tests/Elastic.Documentation.Build.Tests/TestHelpers.cs +++ b/tests/Elastic.Documentation.Build.Tests/TestHelpers.cs @@ -15,6 +15,7 @@ using Elastic.Documentation.Configuration.Search; using Elastic.Documentation.Configuration.Versions; using Elastic.Documentation.Diagnostics; +using Elastic.Documentation.Versions; using FakeItEasy; using Microsoft.Extensions.Logging; diff --git a/tests/Elastic.Documentation.Configuration.Tests/AssemblyConfigurationMatchTests.cs b/tests/Elastic.Documentation.Configuration.Tests/AssemblyConfigurationMatchTests.cs index 35a6845c14..fbece05e0c 100644 --- a/tests/Elastic.Documentation.Configuration.Tests/AssemblyConfigurationMatchTests.cs +++ b/tests/Elastic.Documentation.Configuration.Tests/AssemblyConfigurationMatchTests.cs @@ -6,6 +6,7 @@ using Elastic.Documentation.Configuration.Assembler; using Elastic.Documentation.Configuration.Products; using Elastic.Documentation.Configuration.Versions; +using Elastic.Documentation.Versions; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using MatchResult = Elastic.Documentation.Configuration.Assembler.AssemblyConfiguration.ContentSourceMatch; diff --git a/tests/Elastic.Documentation.Configuration.Tests/DocumentInferrerServiceTests.cs b/tests/Elastic.Documentation.Configuration.Tests/DocumentInferrerServiceTests.cs index 00a5796e9b..dd4268bb79 100644 --- a/tests/Elastic.Documentation.Configuration.Tests/DocumentInferrerServiceTests.cs +++ b/tests/Elastic.Documentation.Configuration.Tests/DocumentInferrerServiceTests.cs @@ -9,6 +9,7 @@ using Elastic.Documentation.Configuration.LegacyUrlMappings; using Elastic.Documentation.Configuration.Products; using Elastic.Documentation.Configuration.Versions; +using Elastic.Documentation.Versions; namespace Elastic.Documentation.Configuration.Tests; diff --git a/tests/Elastic.Documentation.Configuration.Tests/ReleaseNotes/VersionOrDateTests.cs b/tests/Elastic.Documentation.Configuration.Tests/ReleaseNotes/VersionOrDateTests.cs index 4d6a17173d..172c628b19 100644 --- a/tests/Elastic.Documentation.Configuration.Tests/ReleaseNotes/VersionOrDateTests.cs +++ b/tests/Elastic.Documentation.Configuration.Tests/ReleaseNotes/VersionOrDateTests.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information using AwesomeAssertions; +using Elastic.Documentation.Versions; namespace Elastic.Documentation.Configuration.Tests.ReleaseNotes; diff --git a/tests/Elastic.Documentation.Configuration.Tests/VersionInferenceTests.cs b/tests/Elastic.Documentation.Configuration.Tests/VersionInferenceTests.cs index 0198135682..4ea6c22fd2 100644 --- a/tests/Elastic.Documentation.Configuration.Tests/VersionInferenceTests.cs +++ b/tests/Elastic.Documentation.Configuration.Tests/VersionInferenceTests.cs @@ -9,6 +9,7 @@ using Elastic.Documentation.Configuration.Inference; using Elastic.Documentation.Configuration.Products; using Elastic.Documentation.Configuration.Versions; +using Elastic.Documentation.Versions; using Microsoft.Extensions.Logging.Abstractions; namespace Elastic.Documentation.Configuration.Tests; diff --git a/tests/Elastic.Markdown.Tests/AppliesTo/ApplicableToJsonConverterRoundTripTests.cs b/tests/Elastic.Markdown.Tests/AppliesTo/ApplicableToJsonConverterRoundTripTests.cs index 66aaf303e6..d71b39d32d 100644 --- a/tests/Elastic.Markdown.Tests/AppliesTo/ApplicableToJsonConverterRoundTripTests.cs +++ b/tests/Elastic.Markdown.Tests/AppliesTo/ApplicableToJsonConverterRoundTripTests.cs @@ -6,6 +6,7 @@ using AwesomeAssertions; using Elastic.Documentation; using Elastic.Documentation.AppliesTo; +using Elastic.Documentation.Versions; namespace Elastic.Markdown.Tests.AppliesTo; diff --git a/tests/Elastic.Markdown.Tests/AppliesTo/ApplicableToJsonConverterSerializationTests.cs b/tests/Elastic.Markdown.Tests/AppliesTo/ApplicableToJsonConverterSerializationTests.cs index fd5ab13d01..376f7748ba 100644 --- a/tests/Elastic.Markdown.Tests/AppliesTo/ApplicableToJsonConverterSerializationTests.cs +++ b/tests/Elastic.Markdown.Tests/AppliesTo/ApplicableToJsonConverterSerializationTests.cs @@ -7,6 +7,7 @@ using AwesomeAssertions; using Elastic.Documentation; using Elastic.Documentation.AppliesTo; +using Elastic.Documentation.Versions; namespace Elastic.Markdown.Tests.AppliesTo; diff --git a/tests/Elastic.Markdown.Tests/AppliesTo/ProductApplicabilityToStringTests.cs b/tests/Elastic.Markdown.Tests/AppliesTo/ProductApplicabilityToStringTests.cs index 351d44f8f7..34dbf86941 100644 --- a/tests/Elastic.Markdown.Tests/AppliesTo/ProductApplicabilityToStringTests.cs +++ b/tests/Elastic.Markdown.Tests/AppliesTo/ProductApplicabilityToStringTests.cs @@ -7,6 +7,7 @@ using AwesomeAssertions; using Elastic.Documentation; using Elastic.Documentation.AppliesTo; +using Elastic.Documentation.Versions; namespace Elastic.Markdown.Tests.AppliesTo; diff --git a/tests/Elastic.Markdown.Tests/CrossLinks/UriEnvironmentResolverTests.cs b/tests/Elastic.Markdown.Tests/CrossLinks/UriEnvironmentResolverTests.cs index 8072ebba37..74185b46ce 100644 --- a/tests/Elastic.Markdown.Tests/CrossLinks/UriEnvironmentResolverTests.cs +++ b/tests/Elastic.Markdown.Tests/CrossLinks/UriEnvironmentResolverTests.cs @@ -6,6 +6,7 @@ using AwesomeAssertions; using Elastic.Documentation; using Elastic.Documentation.Configuration; +using Elastic.Documentation.Configuration.Builder; using Elastic.Documentation.Links; using Elastic.Documentation.Links.CrossLinks; diff --git a/tests/Elastic.Markdown.Tests/Directives/VersionTests.cs b/tests/Elastic.Markdown.Tests/Directives/VersionTests.cs index 88f247d8bd..4b41e3e982 100644 --- a/tests/Elastic.Markdown.Tests/Directives/VersionTests.cs +++ b/tests/Elastic.Markdown.Tests/Directives/VersionTests.cs @@ -4,6 +4,7 @@ using AwesomeAssertions; using Elastic.Documentation; +using Elastic.Documentation.Versions; using Elastic.Markdown.Myst.Directives.Version; namespace Elastic.Markdown.Tests.Directives; diff --git a/tests/Elastic.Markdown.Tests/Search/DocumentationDocumentSerializationTests.cs b/tests/Elastic.Markdown.Tests/Search/DocumentationDocumentSerializationTests.cs index b85bc26db0..8381feb999 100644 --- a/tests/Elastic.Markdown.Tests/Search/DocumentationDocumentSerializationTests.cs +++ b/tests/Elastic.Markdown.Tests/Search/DocumentationDocumentSerializationTests.cs @@ -9,6 +9,7 @@ using Elastic.Documentation.AppliesTo; using Elastic.Documentation.Search; using Elastic.Documentation.Serialization; +using Elastic.Documentation.Versions; namespace Elastic.Markdown.Tests.Search; @@ -28,7 +29,7 @@ public void SerializeDocumentWithStackAppliesToProducesCorrectJson() Applies = new ApplicableTo { Stack = AppliesCollection.GenerallyAvailable - } + }.ToAppliesTo() }; var json = JsonSerializer.Serialize(doc, _options); @@ -66,7 +67,7 @@ public void SerializeDocumentWithDeploymentAppliesToProducesCorrectJson() Ess = AppliesCollection.GenerallyAvailable, Ece = new AppliesCollection([new Applicability { Lifecycle = ProductLifecycle.Beta, Version = (VersionSpec)"3.5.0" }]) } - } + }.ToAppliesTo() }; var json = JsonSerializer.Serialize(doc, _options); @@ -108,7 +109,7 @@ public void SerializeDocumentWithServerlessAppliesToProducesCorrectJson() Elasticsearch = new AppliesCollection([new Applicability { Lifecycle = ProductLifecycle.GenerallyAvailable, Version = (VersionSpec)"8.0.0" }]), Security = new AppliesCollection([new Applicability { Lifecycle = ProductLifecycle.TechnicalPreview, Version = (VersionSpec)"1.0.0" }]) } - } + }.ToAppliesTo() }; var json = JsonSerializer.Serialize(doc, _options); @@ -146,7 +147,7 @@ public void SerializeDocumentWithProductAppliesToProducesCorrectJson() Applies = new ApplicableTo { Product = new AppliesCollection([new Applicability { Lifecycle = ProductLifecycle.Beta, Version = (VersionSpec)"2.0.0" }]) - } + }.ToAppliesTo() }; var json = JsonSerializer.Serialize(doc, _options); @@ -180,7 +181,7 @@ public void SerializeDocumentWithProductApplicabilityProducesCorrectJson() ApmAgentDotnet = new AppliesCollection([new Applicability { Lifecycle = ProductLifecycle.GenerallyAvailable, Version = (VersionSpec)"1.5.0" }]), ApmAgentNode = new AppliesCollection([new Applicability { Lifecycle = ProductLifecycle.Deprecated, Version = (VersionSpec)"2.0.0" }]) } - } + }.ToAppliesTo() }; var json = JsonSerializer.Serialize(doc, _options); @@ -226,7 +227,7 @@ public void SerializeDocumentWithComplexAppliesToProducesCorrectJson() { Elasticsearch = AppliesCollection.GenerallyAvailable } - } + }.ToAppliesTo() }; var json = JsonSerializer.Serialize(doc, _options); @@ -279,7 +280,7 @@ public void SerializeDocumentWithEmptyAppliesToProducesEmptyArray() Url = "/test/empty-applies", Title = "Empty Applies Test", SearchTitle = "Empty Applies Test", - Applies = new ApplicableTo() + Applies = new ApplicableTo().ToAppliesTo() }; var json = JsonSerializer.Serialize(doc, _options); @@ -294,6 +295,15 @@ public void SerializeDocumentWithEmptyAppliesToProducesEmptyArray() [Fact] public void RoundTripDocumentWithAppliesToPreservesData() { + var originalApplies = new ApplicableTo + { + Stack = new AppliesCollection([new Applicability { Lifecycle = ProductLifecycle.GenerallyAvailable, Version = (VersionSpec)"8.5.0" }]), + Deployment = new DeploymentApplicability + { + Ess = new AppliesCollection([new Applicability { Lifecycle = ProductLifecycle.Beta, Version = (VersionSpec)"8.6.0" }]) + } + }.ToAppliesTo(); + var original = new DocumentationDocument { Type = "doc", @@ -305,14 +315,7 @@ public void RoundTripDocumentWithAppliesToPreservesData() LastUpdated = DateTimeOffset.Parse("2024-01-15T09:00:00Z", CultureInfo.InvariantCulture), ContentLastUpdated = DateTimeOffset.Parse("2024-01-14T08:00:00Z", CultureInfo.InvariantCulture), ContentBodyHash = "abc123def456abc1", - Applies = new ApplicableTo - { - Stack = new AppliesCollection([new Applicability { Lifecycle = ProductLifecycle.GenerallyAvailable, Version = (VersionSpec)"8.5.0" }]), - Deployment = new DeploymentApplicability - { - Ess = new AppliesCollection([new Applicability { Lifecycle = ProductLifecycle.Beta, Version = (VersionSpec)"8.6.0" }]) - } - }, + Applies = originalApplies, Headings = ["Introduction", "Getting Started"], Links = ["/link1", "/link2"], Body = "Test body content", @@ -327,9 +330,9 @@ public void RoundTripDocumentWithAppliesToPreservesData() deserialized.Url.Should().Be(original.Url); deserialized.Title.Should().Be(original.Title); deserialized.Applies.Should().NotBeNull(); - deserialized.Applies.Stack.Should().BeEquivalentTo(original.Applies.Stack); - deserialized.Applies.Deployment.Should().NotBeNull(); - deserialized.Applies.Deployment.Ess.Should().BeEquivalentTo(original.Applies.Deployment.Ess); + deserialized.Applies.Should().HaveCount(2); + deserialized.Applies.Should().Contain(e => e.Type == "stack" && e.Lifecycle == "ga" && e.Version == "8.5+"); + deserialized.Applies.Should().Contain(e => e.Type == "deployment" && e.SubType == "ess" && e.Lifecycle == "beta" && e.Version == "8.6+"); deserialized.ContentLastUpdated.Should().Be(original.ContentLastUpdated); deserialized.ContentBodyHash.Should().Be(original.ContentBodyHash); deserialized.ContentType.Should().Be(original.ContentType); @@ -395,7 +398,7 @@ public void SerializeDocumentWithMultipleApplicabilitiesPerTypeProducesMultipleA new Applicability { Lifecycle = ProductLifecycle.Beta, Version = (VersionSpec)"7.17.0" }, new Applicability { Lifecycle = ProductLifecycle.Deprecated, Version = (VersionSpec)"7.0.0" } ]) - } + }.ToAppliesTo() }; var json = JsonSerializer.Serialize(doc, _options); diff --git a/tests/Elastic.Markdown.Tests/TestHelpers.cs b/tests/Elastic.Markdown.Tests/TestHelpers.cs index e8d9aac96a..2aa37abeab 100644 --- a/tests/Elastic.Markdown.Tests/TestHelpers.cs +++ b/tests/Elastic.Markdown.Tests/TestHelpers.cs @@ -10,6 +10,7 @@ using Elastic.Documentation.Configuration.Products; using Elastic.Documentation.Configuration.Search; using Elastic.Documentation.Configuration.Versions; +using Elastic.Documentation.Versions; namespace Elastic.Markdown.Tests; diff --git a/tests/authoring/Framework/Setup.fs b/tests/authoring/Framework/Setup.fs index d89f426d12..9f79710fca 100644 --- a/tests/authoring/Framework/Setup.fs +++ b/tests/authoring/Framework/Setup.fs @@ -13,6 +13,7 @@ open System.IO.Abstractions.TestingHelpers open System.Threading.Tasks open YamlDotNet.RepresentationModel open Elastic.Documentation +open Elastic.Documentation.Versions open Elastic.Documentation.Configuration open Elastic.Documentation.Configuration.LegacyUrlMappings open Elastic.Documentation.Configuration.Versions