Skip to content

Commit 6e60767

Browse files
authored
Merge branch 'main' into dependabot/npm_and_yarn/src/Elastic.Documentation.Site/eui-b444a4c774
2 parents e5a8b13 + 9f4acc1 commit 6e60767

File tree

19 files changed

+333
-215
lines changed

19 files changed

+333
-215
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
* @elastic/docs-engineering
2-
/docs/ @elastic/docs
3-
/config/ @elastic/docs-tech-leads
2+
/docs/ @elastic/docs @elastic/docs-engineering
3+
/config/ @elastic/docs-tech-leads @elastic/docs-engineering

Directory.Packages.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<PackageVersion Include="Markdig" Version="0.41.1" />
4343
<PackageVersion Include="NetEscapades.EnumGenerators" Version="1.0.0-beta12" PrivateAssets="all" ExcludeAssets="runtime" />
4444
<PackageVersion Include="Proc" Version="0.9.1" />
45-
<PackageVersion Include="RazorSlices" Version="0.9.0" />
45+
<PackageVersion Include="RazorSlices" Version="0.9.2" />
4646
<PackageVersion Include="Samboy063.Tomlet" Version="6.0.0" />
4747
<PackageVersion Include="Slugify.Core" Version="4.0.1" />
4848
<PackageVersion Include="SoftCircuits.IniFileParser" Version="2.7.0" />

config/legacy-url-mappings.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ mappings:
1111
en/apm/agent/dotnet/: [ '1.32.0', '1.8' ]
1212
en/apm/agent/go/: [ '2.7.1', '1.x', '0.5' ]
1313
en/apm/agent/java/: ['1.54.0', '0.7', '0.6']
14-
en/apm/agent/nodejs/: [ '3.x', '2.x', '1.x' ]
14+
en/apm/agent/nodejs/: [ '4.0+', '3.x', '2.x', '1.x' ]
1515
en/apm/agent/php/: []
1616
en/apm/agent/python/: [ '6.23.0', '5.x', '4.x', '3.x', '2.x', '1.x' ]
1717
en/apm/agent/ruby/: [ '4.7.3', '3.x', '2.x', '1.x' ]

config/versions.yml

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,94 @@
11
versioning_systems:
2+
# This file contains the version numbers for various Elastic products and tools.
3+
# Updates for Stack versions are manual
24
stack: &stack
35
base: 9.0
46
current: 9.1.0
5-
7+
68
# Using an unlikely high version
79
# So that our logic that would display "planned" doesn't trigger
810
all: &all
911
base: 99999
1012
current: 99999
1113

12-
# deployment types
14+
# Deployment types
15+
# Ece version updates are manual
1316
ece:
1417
base: 4.0
1518
current: 4.1
1619
ech: *all
1720
eck:
1821
base: 3.0
19-
current: 3.0
22+
current: 3.0.0
2023
ess: *all
2124
self: *stack
22-
23-
# things that i don't know about
2425
ecctl:
2526
base: 1.0
26-
current: 1.15
27+
current: 1.15.0
2728
curator:
2829
base: 8.0
29-
current: 8.21
30-
31-
# serverless
30+
current: 8.0.21
31+
32+
# Serverless
3233
serverless: *all
3334
elasticsearch: *all
3435
observability: *all
3536
security: *all
3637

3738
# APM agents
3839
# apm_agent_android:
39-
# base: 1.0
40-
# current: 1.0.0
40+
# base: 1.0
41+
# current: 1.0.0
4142
apm_agent_dotnet:
4243
base: 1.0
43-
current: 1.32.0
44+
current: 1.32.2
4445
apm_agent_go:
4546
base: 2.0
46-
current: 2.71
47+
current: 2.7.1
4748
apm_agent_java:
4849
base: 1.0
49-
current: 1.54.0
50+
current: 1.55.0
5051
apm_agent_node:
5152
base: 4.0
5253
current: 4.13.0
5354
apm_agent_php:
5455
base: 1.0
55-
current: 1.15
56+
current: 1.15.1
5657
apm_agent_python:
5758
base: 6.0
5859
current: 6.23.0
5960
apm_agent_ruby:
6061
base: 4.0
61-
current: 4.7.3
62+
current: 4.8.0
6263
apm_agent_rum:
6364
base: 5.0
6465
current: 5.17.0
6566

6667
# EDOTs
6768
edot_collector:
6869
base: 9.0
69-
current: 9.0.3
70+
current: 9.0.4
7071
edot_ios:
7172
base: 1.0
7273
current: 1.2.1
7374
edot_android:
7475
base: 1.0
75-
current: 1.1.0
76+
current: 1.2.0
7677
edot_dotnet:
7778
base: 1.0
78-
current: 1.0.2
79+
current: 1.1.0
7980
edot_java:
8081
base: 1.0
81-
current: 1.4.1
82+
current: 1.5.0
8283
edot_node:
8384
base: 1.0
8485
current: 1.1.1
8586
edot_php:
8687
base: 1.0
87-
current: 1.0.0
88+
current: 1.1.1
8889
edot_python:
8990
base: 1.0
90-
current: 1.3.0
91+
current: 1.5.0
9192
edot_cf_aws:
9293
base: 0.1
9394
current: 0.1.6

docs/_docset.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ subs:
2020
features:
2121
primary-nav: false
2222

23-
#api: kibana-openapi.json
24-
api: elasticsearch-openapi.json
23+
api:
24+
elasticsearch: elasticsearch-openapi.json
25+
kibana: kibana-openapi.json
2526

2627
toc:
2728
- file: index.md

src/Elastic.ApiExplorer/OpenApiGenerator.cs

Lines changed: 52 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ public class OpenApiGenerator(ILoggerFactory logFactory, BuildContext context, I
4444
private readonly IFileSystem _writeFileSystem = context.WriteFileSystem;
4545
private readonly StaticFileContentHashProvider _contentHashProvider = new(new EmbeddedOrPhysicalFileProvider(context));
4646

47-
public LandingNavigationItem CreateNavigation(OpenApiDocument openApiDocument)
47+
public LandingNavigationItem CreateNavigation(string apiUrlSuffix, OpenApiDocument openApiDocument)
4848
{
49-
var url = $"{context.UrlPathPrefix}/api";
49+
var url = $"{context.UrlPathPrefix}/api/" + apiUrlSuffix;
5050
var rootNavigation = new LandingNavigationItem(url);
5151

5252
var ops = openApiDocument.Paths
@@ -62,15 +62,17 @@ public LandingNavigationItem CreateNavigation(OpenApiDocument openApiDocument)
6262
? anyApi.Node.GetValue<string>()
6363
: null;
6464
var tag = op.Value.Tags?.FirstOrDefault()?.Reference.Id;
65-
var classification = openApiDocument.Info.Title == "Elasticsearch Request & Response Specification"
66-
? ClassifyElasticsearchTag(tag ?? "unknown")
67-
: "unknown";
65+
var tagClassification = (extensions?.TryGetValue("x-tag-group", out var g) ?? false) && g is OpenApiAny anyTagGroup
66+
? anyTagGroup.Node.GetValue<string>()
67+
: openApiDocument.Info.Title == "Elasticsearch Request & Response Specification"
68+
? ClassifyElasticsearchTag(tag ?? "unknown")
69+
: "unknown";
6870

6971
var apiString = ns is null
7072
? api ?? op.Value.Summary ?? Guid.NewGuid().ToString("N") : $"{ns}.{api}";
7173
return new
7274
{
73-
Classification = classification,
75+
Classification = tagClassification,
7476
Api = apiString,
7577
Tag = tag,
7678
pair.Path,
@@ -158,25 +160,26 @@ group tagGroup by classificationGroup.Key
158160
var hasClassifications = classifications.Count > 1;
159161
foreach (var classification in classifications)
160162
{
161-
if (hasClassifications)
163+
if (hasClassifications && classification.Name != "common")
162164
{
163165
var classificationNavigationItem = new ClassificationNavigationItem(classification, rootNavigation, rootNavigation);
164166
var tagNavigationItems = new List<IApiGroupingNavigationItem<IApiGroupingModel, INavigationItem>>();
165167

166-
CreateTagNavigationItems(classification, classificationNavigationItem, classificationNavigationItem, tagNavigationItems);
168+
CreateTagNavigationItems(apiUrlSuffix, classification, classificationNavigationItem, classificationNavigationItem, tagNavigationItems);
167169
topLevelNavigationItems.Add(classificationNavigationItem);
168170
// if there is only a single tag item will be added directly to the classificationNavigationItem, otherwise they will be added to the tagNavigationItems
169171
if (classificationNavigationItem.NavigationItems.Count == 0)
170172
classificationNavigationItem.NavigationItems = tagNavigationItems;
171173
}
172174
else
173-
CreateTagNavigationItems(classification, rootNavigation, rootNavigation, topLevelNavigationItems);
175+
CreateTagNavigationItems(apiUrlSuffix, classification, rootNavigation, rootNavigation, topLevelNavigationItems);
174176
}
175177
rootNavigation.NavigationItems = topLevelNavigationItems;
176178
return rootNavigation;
177179
}
178180

179181
private void CreateTagNavigationItems(
182+
string apiUrlSuffix,
180183
ApiClassification classification,
181184
IRootNavigationItem<IApiGroupingModel, INavigationItem> rootNavigation,
182185
IApiGroupingNavigationItem<IApiGroupingModel, INavigationItem> parent,
@@ -190,13 +193,13 @@ List<IApiGroupingNavigationItem<IApiGroupingModel, INavigationItem>> parentNavig
190193
if (hasTags)
191194
{
192195
var tagNavigationItem = new TagNavigationItem(tag, rootNavigation, parent);
193-
CreateEndpointNavigationItems(rootNavigation, tag, tagNavigationItem, endpointNavigationItems);
196+
CreateEndpointNavigationItems(apiUrlSuffix, rootNavigation, tag, tagNavigationItem, endpointNavigationItems);
194197
parentNavigationItems.Add(tagNavigationItem);
195198
tagNavigationItem.NavigationItems = endpointNavigationItems;
196199
}
197200
else
198201
{
199-
CreateEndpointNavigationItems(rootNavigation, tag, parent, endpointNavigationItems);
202+
CreateEndpointNavigationItems(apiUrlSuffix, rootNavigation, tag, parent, endpointNavigationItems);
200203
if (parent is ClassificationNavigationItem classificationNavigationItem)
201204
classificationNavigationItem.NavigationItems = endpointNavigationItems;
202205
else if (parent is LandingNavigationItem landingNavigationItem)
@@ -206,6 +209,7 @@ List<IApiGroupingNavigationItem<IApiGroupingModel, INavigationItem>> parentNavig
206209
}
207210

208211
private void CreateEndpointNavigationItems(
212+
string apiUrlSuffix,
209213
IRootNavigationItem<IApiGroupingModel, INavigationItem> rootNavigation,
210214
ApiTag tag,
211215
IApiGroupingNavigationItem<IApiGroupingModel, INavigationItem> parentNavigationItem,
@@ -220,7 +224,7 @@ List<IEndpointOrOperationNavigationItem> endpointNavigationItems
220224
var operationNavigationItems = new List<OperationNavigationItem>();
221225
foreach (var operation in endpoint.Operations)
222226
{
223-
var operationNavigationItem = new OperationNavigationItem(context.UrlPathPrefix, operation, rootNavigation, endpointNavigationItem)
227+
var operationNavigationItem = new OperationNavigationItem(context.UrlPathPrefix, apiUrlSuffix, operation, rootNavigation, endpointNavigationItem)
224228
{
225229
Hidden = true
226230
};
@@ -232,7 +236,7 @@ List<IEndpointOrOperationNavigationItem> endpointNavigationItems
232236
else
233237
{
234238
var operation = endpoint.Operations.First();
235-
var operationNavigationItem = new OperationNavigationItem(context.UrlPathPrefix, operation, rootNavigation, parentNavigationItem);
239+
var operationNavigationItem = new OperationNavigationItem(context.UrlPathPrefix, apiUrlSuffix, operation, rootNavigation, parentNavigationItem);
236240
endpointNavigationItems.Add(operationNavigationItem);
237241

238242
}
@@ -241,47 +245,53 @@ List<IEndpointOrOperationNavigationItem> endpointNavigationItems
241245

242246
public async Task Generate(Cancel ctx = default)
243247
{
244-
if (context.Configuration.OpenApiSpecification is null)
248+
if (context.Configuration.OpenApiSpecifications is null)
245249
return;
246250

247-
var openApiDocument = await OpenApiReader.Create(context.Configuration.OpenApiSpecification);
248-
if (openApiDocument is null)
249-
return;
251+
foreach (var (prefix, path) in context.Configuration.OpenApiSpecifications)
252+
{
253+
var openApiDocument = await OpenApiReader.Create(path);
254+
if (openApiDocument is null)
255+
return;
250256

251-
var navigation = CreateNavigation(openApiDocument);
252-
_logger.LogInformation("Generating OpenApiDocument {Title}", openApiDocument.Info.Title);
257+
var navigation = CreateNavigation(prefix, openApiDocument);
258+
_logger.LogInformation("Generating OpenApiDocument {Title}", openApiDocument.Info.Title);
253259

254-
var navigationRenderer = new IsolatedBuildNavigationHtmlWriter(context, navigation);
260+
var navigationRenderer = new IsolatedBuildNavigationHtmlWriter(context, navigation);
255261

262+
var renderContext = new ApiRenderContext(context, openApiDocument, _contentHashProvider)
263+
{
264+
NavigationHtml = string.Empty,
265+
CurrentNavigation = navigation,
266+
MarkdownRenderer = markdownStringRenderer
267+
};
268+
_ = await Render(prefix, navigation, navigation.Index, renderContext, navigationRenderer, ctx);
269+
await RenderNavigationItems(prefix, renderContext, navigationRenderer, navigation, ctx);
256270

257-
var renderContext = new ApiRenderContext(context, openApiDocument, _contentHashProvider)
258-
{
259-
NavigationHtml = string.Empty,
260-
CurrentNavigation = navigation,
261-
MarkdownRenderer = markdownStringRenderer
262-
};
263-
_ = await Render(navigation, navigation.Index, renderContext, navigationRenderer, ctx);
264-
await RenderNavigationItems(navigation);
271+
}
272+
}
265273

266-
async Task RenderNavigationItems(INavigationItem currentNavigation)
274+
private async Task RenderNavigationItems(string prefix, ApiRenderContext renderContext, IsolatedBuildNavigationHtmlWriter navigationRenderer, INavigationItem currentNavigation, Cancel ctx)
275+
{
276+
if (currentNavigation is INodeNavigationItem<IApiModel, INavigationItem> node)
267277
{
268-
if (currentNavigation is INodeNavigationItem<IApiModel, INavigationItem> node)
269-
{
270-
_ = await Render(node, node.Index, renderContext, navigationRenderer, ctx);
271-
foreach (var child in node.NavigationItems)
272-
await RenderNavigationItems(child);
273-
}
278+
_ = await Render(prefix, node, node.Index, renderContext, navigationRenderer, ctx);
279+
foreach (var child in node.NavigationItems)
280+
await RenderNavigationItems(prefix, renderContext, navigationRenderer, child, ctx);
281+
}
274282

275-
#pragma warning disable IDE0045
276-
else if (currentNavigation is ILeafNavigationItem<IApiModel> leaf)
277-
#pragma warning restore IDE0045
278-
_ = await Render(leaf, leaf.Model, renderContext, navigationRenderer, ctx);
279-
else
280-
throw new Exception($"Unknown navigation item type {currentNavigation.GetType()}");
283+
else
284+
{
285+
_ = currentNavigation is ILeafNavigationItem<IApiModel> leaf
286+
? await Render(prefix, leaf, leaf.Model, renderContext, navigationRenderer, ctx)
287+
: throw new Exception($"Unknown navigation item type {currentNavigation.GetType()}");
281288
}
282289
}
283290

284-
private async Task<IFileInfo> Render<T>(INavigationItem current, T page, ApiRenderContext renderContext, IsolatedBuildNavigationHtmlWriter navigationRenderer, Cancel ctx)
291+
#pragma warning disable IDE0060
292+
private async Task<IFileInfo> Render<T>(string prefix, INavigationItem current, T page, ApiRenderContext renderContext,
293+
#pragma warning restore IDE0060
294+
IsolatedBuildNavigationHtmlWriter navigationRenderer, Cancel ctx)
285295
where T : INavigationModel, IPageRenderer<ApiRenderContext>
286296
{
287297
var outputFile = OutputFile(current);

src/Elastic.ApiExplorer/Operations/OperationNavigationItem.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,19 @@
1212

1313
namespace Elastic.ApiExplorer.Operations;
1414

15+
public interface IApiProperty
16+
{
17+
18+
}
19+
20+
public record ApiObject
21+
{
22+
public required string Name { get; init; }
23+
public IReadOnlyCollection<IApiProperty> Properties { get; init; } = [];
24+
}
25+
26+
27+
1528
public record ApiOperation(OperationType OperationType, OpenApiOperation Operation, string Route, IOpenApiPathItem Path, string ApiName) : IApiModel
1629
{
1730
public async Task RenderAsync(FileSystemStream stream, ApiRenderContext context, Cancel ctx = default)
@@ -29,6 +42,7 @@ public class OperationNavigationItem : ILeafNavigationItem<ApiOperation>, IEndpo
2942
{
3043
public OperationNavigationItem(
3144
string? urlPathPrefix,
45+
string apiUrlSuffix,
3246
ApiOperation apiOperation,
3347
IRootNavigationItem<IApiGroupingModel, INavigationItem> root,
3448
IApiGroupingNavigationItem<IApiGroupingModel, INavigationItem> parent
@@ -39,7 +53,7 @@ IApiGroupingNavigationItem<IApiGroupingModel, INavigationItem> parent
3953
NavigationTitle = apiOperation.ApiName;
4054
Parent = parent;
4155
var moniker = apiOperation.Operation.OperationId ?? apiOperation.Route.Replace("}", "").Replace("{", "").Replace('/', '-');
42-
Url = $"{urlPathPrefix}/api/endpoints/{moniker}";
56+
Url = $"{urlPathPrefix?.TrimEnd('/')}/api/{apiUrlSuffix}/{moniker}";
4357
Id = ShortId.Create(Url);
4458
}
4559

0 commit comments

Comments
 (0)