Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/.github.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<IsPackable>False</IsPackable>
</PropertyGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<MinVerDefaultPreReleaseIdentifiers>canary.0</MinVerDefaultPreReleaseIdentifiers>
<MinVerMinimumMajorMinor>0.1</MinVerMinimumMajorMinor>
<LangVersion>latest</LangVersion>
<LangVersion>preview</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<UseArtifactsOutput>true</UseArtifactsOutput>
<SolutionRoot>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), build.sh))</SolutionRoot>
Expand Down
29 changes: 14 additions & 15 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,23 @@
<PackageVersion Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.4.4" />
<PackageVersion Include="Amazon.Lambda.SQSEvents" Version="2.2.0" />
<PackageVersion Include="AngleSharp" Version="1.1.2" />
<PackageVersion Include="Aspire.Hosting" Version="9.5.2" />
<PackageVersion Include="Aspire.Hosting.Testing" Version="9.4.2" />
<PackageVersion Include="Aspire.Hosting" Version="13.0.0" />
<PackageVersion Include="Aspire.Hosting.Testing" Version="13.0.0" />
<PackageVersion Include="AWSSDK.Core" Version="4.0.3" />
<PackageVersion Include="AWSSDK.SQS" Version="4.0.2.2" />
<PackageVersion Include="AWSSDK.S3" Version="4.0.7.14" />
<PackageVersion Include="Elastic.OpenTelemetry" Version="1.1.0" />
<PackageVersion Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.13.0" />
<PackageVersion Include="Generator.Equals" Version="3.2.1" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
<PackageVersion Include="KubernetesClient" Version="17.0.14" />
<PackageVersion Include="KubernetesClient" Version="18.0.5" />
<PackageVersion Include="Elastic.Aspire.Hosting.Elasticsearch" Version="9.3.0" />
<PackageVersion Include="Elastic.Clients.Elasticsearch" Version="9.1.4" />
<PackageVersion Include="FakeItEasy" Version="8.3.0" />
<PackageVersion Include="Elastic.Ingest.Elasticsearch" Version="0.16.3" />
<PackageVersion Include="InMemoryLogger" Version="1.0.66" />
<PackageVersion Include="MartinCostello.Logging.XUnit.v3" Version="0.6.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.7" />
<PackageVersion Include="Microsoft.OpenApi" Version="2.0.0-preview9" />
<PackageVersion Include="System.Text.Json" Version="9.0.5" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.0" />
<PackageVersion Include="Microsoft.OpenApi" Version="3.0.0" />
<PackageVersion Include="TUnit" Version="0.25.21" />
<PackageVersion Include="xunit.v3.extensibility.core" Version="2.0.2" />
</ItemGroup>
Expand All @@ -48,17 +47,17 @@
<PackageVersion Include="Proc.Fs" Version="0.9.1" />
<PackageVersion Include="Fake.Tools.Git" Version="6.1.3" />
<PackageVersion Include="Fake.IO.Zip" Version="6.1.3" />
<PackageVersion Include="FSharp.Core" Version="9.0.202" />
<PackageVersion Include="FSharp.Core" Version="10.0.100" />
</ItemGroup>
<ItemGroup>
<PackageVersion Include="ConsoleAppFramework" Version="5.7.2" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
<PackageVersion Include="ConsoleAppFramework" Version="5.7.3" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
<PackageVersion Include="ConsoleAppFramework.Abstractions" Version="5.7.2" />
<PackageVersion Include="Crayon" Version="2.0.69" />
<PackageVersion Include="DotNet.Glob" Version="3.1.3" />
<PackageVersion Include="Errata" Version="0.14.0" />
<PackageVersion Include="Github.Actions.Core" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="9.0.7" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="9.0.7" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="10.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="10.0.0" />
<PackageVersion Include="Markdig" Version="0.41.1" />
<PackageVersion Include="NetEscapades.EnumGenerators" Version="1.0.0-beta12" PrivateAssets="all" ExcludeAssets="runtime" />
<PackageVersion Include="Proc" Version="0.9.1" />
Expand All @@ -68,31 +67,31 @@
<PackageVersion Include="Slugify.Core" Version="4.0.1" />
<PackageVersion Include="SoftCircuits.IniFileParser" Version="2.7.0" />
<PackageVersion Include="System.IO.Abstractions" Version="22.0.16" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.7" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="10.0.0" />
<PackageVersion Include="Utf8StreamReader" Version="1.3.2" />
<PackageVersion Include="Vecc.YamlDotNet.Analyzers.StaticGenerator" Version="16.1.3" PrivateAssets="All" />
<PackageVersion Include="Westwind.AspNetCore.LiveReload" Version="0.5.2" />
<PackageVersion Include="YamlDotNet" Version="16.3.0" />
</ItemGroup>
<!-- Test packages -->
<ItemGroup>
<PackageVersion Include="Microsoft.Extensions.Http.Resilience" Version="9.7.0" />
<PackageVersion Include="Microsoft.Extensions.ServiceDiscovery" Version="9.4.0" />
<PackageVersion Include="Microsoft.Extensions.Http.Resilience" Version="10.0.0" />
<PackageVersion Include="Microsoft.Extensions.ServiceDiscovery" Version="10.0.0" />
<PackageVersion Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.13.1" />
<PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="1.13.1" />
<PackageVersion Include="OpenTelemetry.Instrumentation.Http" Version="1.13.0" />
<PackageVersion Include="OpenTelemetry.Instrumentation.Runtime" Version="1.13.0" />
</ItemGroup>
<!-- Test packages -->
<ItemGroup>
<PackageVersion Include="Aspire.Hosting.AppHost" Version="9.4.2" />
<PackageVersion Include="Aspire.Hosting.AppHost" Version="13.0.0" />
<PackageVersion Include="AngleSharp.Diffing" Version="1.1.0" />
<PackageVersion Include="DiffPlex" Version="1.7.2" />
<PackageVersion Include="FluentAssertions" Version="7.2.0" />
<PackageVersion Include="FsUnit.xUnit" Version="7.0.1" />
<PackageVersion Include="GitHubActionsTestLogger" Version="2.4.1" />
<PackageVersion Include="JetBrains.Annotations" Version="2024.3.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageVersion Include="System.IO.Abstractions.TestingHelpers" Version="22.0.16" />
<PackageVersion Include="Unquote" Version="7.0.1" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.0">
Expand Down
2 changes: 1 addition & 1 deletion aspire/aspire.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<UserSecretsId>72f50f33-6fb9-4d08-bff3-39568fe370b3</UserSecretsId>
Expand Down
2 changes: 1 addition & 1 deletion build/build.fsproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<OutputType>Exe</OutputType>
<NoWarn>$(NoWarn);NU1701</NoWarn>
<IsPackable>false</IsPackable>
Expand Down
2 changes: 1 addition & 1 deletion docs/docs.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<IsPackable>False</IsPackable>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "9.0.100",
"version": "10.0.100",
"rollForward": "latestFeature",
"allowPrerelease": false
}
Expand Down
2 changes: 1 addition & 1 deletion src/Elastic.ApiExplorer/ApiRenderContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
3 changes: 1 addition & 2 deletions src/Elastic.ApiExplorer/Elastic.ApiExplorer.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<InvariantGlobalization>true</InvariantGlobalization>
Expand All @@ -15,7 +15,6 @@
<ItemGroup>
<PackageReference Include="Microsoft.OpenApi"/>
<PackageReference Include="RazorSlices"/>
<PackageReference Include="System.Text.Json"/>
<PackageReference Include="Utf8StreamReader"/>
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/Elastic.ApiExplorer/Endpoints/ApiEndpoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Elastic.ApiExplorer/Landing/LandingViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
11 changes: 5 additions & 6 deletions src/Elastic.ApiExplorer/OpenApiGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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<string>()
: 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<string>()
: 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<string>()
: openApiDocument.Info.Title == "Elasticsearch Request & Response Specification"
? ClassifyElasticsearchTag(tag ?? "unknown")
Expand Down
2 changes: 1 addition & 1 deletion src/Elastic.ApiExplorer/OpenApiReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
{
Expand Down
9 changes: 4 additions & 5 deletions src/Elastic.ApiExplorer/Operations/OperationView.cshtml
Original file line number Diff line number Diff line change
@@ -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<Elastic.ApiExplorer.Operations.OperationViewModel>
@implements IUsesLayout<Elastic.ApiExplorer._Layout, GlobalLayoutViewModel>
@functions {
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -121,13 +120,13 @@
@if (operation.RequestBody is not null)
{
<h3>Request Body</h3>
var content = operation.RequestBody.Content.FirstOrDefault().Value;
var content = operation.RequestBody.Content?.FirstOrDefault().Value;
if (!string.IsNullOrEmpty(operation.RequestBody.Description))
{
<p>@operation.RequestBody.Description</p>
}

if (content.Schema is not null)
if (content?.Schema?.Properties is not null)
{
<dl>
@foreach (var property in content.Schema.Properties)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
6 changes: 2 additions & 4 deletions src/Elastic.Documentation.Configuration/BuildContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -36,8 +37,9 @@ public record ConfigurationFile
public IReadOnlyDictionary<string, string> Substitutions => _substitutions;

private readonly Dictionary<string, bool> _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; }

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<OutputType>Library</OutputType>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Loading
Loading