Skip to content

Add ech alias for ess and add hint to prefer ech #1488

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@
VersioningSystemId.Ess,
appliesTo.Deployment.Ess
)
}
else if (appliesTo.Deployment.Ech is not null)
{
@RenderProduct(
"ECH",
"Elastic Cloud Hosted",
VersioningSystemId.Ech,
appliesTo.Deployment.Ech
)
}
if (appliesTo.Deployment.Self is not null)
{
Expand Down
19 changes: 18 additions & 1 deletion src/Elastic.Markdown/Myst/FrontMatter/ApplicableTo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,15 @@ public record DeploymentApplicability
[YamlMember(Alias = "ess")]
public AppliesCollection? Ess { get; set; }

[YamlMember(Alias = "ech")]
public AppliesCollection? Ech { get; set; } // ess alias, preferred

public static DeploymentApplicability All { get; } = new()
{
Ece = AppliesCollection.GenerallyAvailable,
Eck = AppliesCollection.GenerallyAvailable,
Ess = AppliesCollection.GenerallyAvailable,
Ech = AppliesCollection.GenerallyAvailable,
Self = AppliesCollection.GenerallyAvailable
};
}
Expand Down Expand Up @@ -181,7 +185,7 @@ public class ApplicableToConverter : IYamlTypeConverter
private static readonly string[] KnownKeys =
[
"stack", "deployment", "serverless", "product",
"ece", "eck", "ess", "self",
"ece", "eck", "ess", "ech", "self",
"elasticsearch", "observability", "security",
"ecctl", "curator",
"apm_agent_android","apm_agent_dotnet", "apm_agent_go", "apm_agent_ios", "apm_agent_java", "apm_agent_node", "apm_agent_php", "apm_agent_python", "apm_agent_ruby", "apm_agent_rum",
Expand Down Expand Up @@ -235,6 +239,17 @@ public class ApplicableToConverter : IYamlTypeConverter
if (TryGetProductApplicability(dictionary, diagnostics, out var product))
applicableTo.ProductApplicability = product;

switch (applicableTo.Deployment)
{
case { Ech: null, Ess: not null }:
diagnostics.Add((Severity.Hint, "Please prefer \"ech\" over \"ess\". The key \"ess\" is deprecated."));
break;
case { Ech: not null, Ess: not null }:
diagnostics.Add((Severity.Hint, "Please use \"ech\" instead of \"ess\". The key \"ess\" is deprecated and you cannot use both at the same time."));
break;
}


if (diagnostics.Count > 0)
applicableTo.Diagnostics = new YamlDiagnosticsCollection(diagnostics);
return applicableTo;
Expand All @@ -255,6 +270,7 @@ private static void AssignDeploymentType(Dictionary<object, object?> dictionary,
Ece = av,
Eck = av,
Ess = av,
Ech = av,
Self = av
};
}
Expand Down Expand Up @@ -318,6 +334,7 @@ private static bool TryGetDeployment(Dictionary<object, object?> dictionary, Lis
{
{ "ece", a => d.Ece = a },
{ "eck", a => d.Eck = a },
{ "ech", a => d.Ech = a },
{ "ess", a => d.Ess = a },
{ "self", a => d.Self = a }
};
Expand Down
Loading