@redpanda-data/docs-extensions-and-macros 4.8.0 → 4.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/doc-tools.js +88 -53
- package/package.json +1 -1
- package/tools/property-extractor/Makefile +62 -34
- package/tools/property-extractor/generate-handlebars-docs.js +344 -0
- package/tools/property-extractor/helpers/and.js +10 -0
- package/tools/property-extractor/helpers/eq.js +9 -0
- package/tools/property-extractor/helpers/formatPropertyValue.js +128 -0
- package/tools/property-extractor/helpers/formatUnits.js +26 -0
- package/tools/property-extractor/helpers/index.js +13 -0
- package/tools/property-extractor/helpers/join.js +18 -0
- package/tools/property-extractor/helpers/ne.js +9 -0
- package/tools/property-extractor/helpers/not.js +8 -0
- package/tools/property-extractor/helpers/or.js +10 -0
- package/tools/property-extractor/helpers/renderPropertyExample.js +42 -0
- package/tools/property-extractor/package-lock.json +77 -0
- package/tools/property-extractor/package.json +6 -0
- package/tools/property-extractor/property_extractor.py +1163 -20
- package/tools/property-extractor/requirements.txt +1 -0
- package/tools/property-extractor/templates/deprecated-properties.hbs +25 -0
- package/tools/property-extractor/templates/deprecated-property.hbs +7 -0
- package/tools/property-extractor/templates/property-page.hbs +22 -0
- package/tools/property-extractor/templates/property.hbs +70 -0
- package/tools/property-extractor/templates/topic-property.hbs +59 -0
- package/tools/property-extractor/transformers.py +80 -4
- package/tools/property-extractor/json-to-asciidoc/generate_docs.py +0 -491
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{{#if deprecated}}
|
|
2
|
+
= Deprecated Configuration Properties
|
|
3
|
+
:description: This is an exhaustive list of all the deprecated properties.
|
|
4
|
+
|
|
5
|
+
This is an exhaustive list of all the deprecated properties.
|
|
6
|
+
|
|
7
|
+
{{#if brokerProperties}}
|
|
8
|
+
== Broker properties
|
|
9
|
+
|
|
10
|
+
{{#each brokerProperties}}
|
|
11
|
+
{{> deprecated-property}}
|
|
12
|
+
|
|
13
|
+
{{/each}}
|
|
14
|
+
{{/if}}
|
|
15
|
+
|
|
16
|
+
{{#if clusterProperties}}
|
|
17
|
+
== Cluster properties
|
|
18
|
+
|
|
19
|
+
{{#each clusterProperties}}
|
|
20
|
+
{{> deprecated-property}}
|
|
21
|
+
|
|
22
|
+
{{/each}}
|
|
23
|
+
{{/if}}
|
|
24
|
+
|
|
25
|
+
{{/if}}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
= {{pageTitle}}
|
|
2
|
+
{{#if pageAliases}}
|
|
3
|
+
:page-aliases: {{join pageAliases ", "}}
|
|
4
|
+
{{/if}}
|
|
5
|
+
:description: {{description}}
|
|
6
|
+
|
|
7
|
+
{{{intro}}}
|
|
8
|
+
|
|
9
|
+
{{#if sectionTitle}}
|
|
10
|
+
== {{sectionTitle}}
|
|
11
|
+
{{/if}}
|
|
12
|
+
|
|
13
|
+
{{#if sectionIntro}}
|
|
14
|
+
{{{sectionIntro}}}
|
|
15
|
+
{{/if}}
|
|
16
|
+
|
|
17
|
+
{{#each groups}}
|
|
18
|
+
{{#each this.properties}}
|
|
19
|
+
{{> (lookup ../this "template")}}
|
|
20
|
+
|
|
21
|
+
{{/each}}
|
|
22
|
+
{{/each}}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
=== {{name}}
|
|
2
|
+
|
|
3
|
+
{{#if version}}
|
|
4
|
+
*Introduced in {{version}}*
|
|
5
|
+
|
|
6
|
+
{{/if}}
|
|
7
|
+
{{#if description}}
|
|
8
|
+
{{{description}}}
|
|
9
|
+
{{else}}
|
|
10
|
+
No description available.
|
|
11
|
+
{{/if}}
|
|
12
|
+
|
|
13
|
+
{{#if units}}
|
|
14
|
+
*Unit:* {{units}}
|
|
15
|
+
|
|
16
|
+
{{else}}
|
|
17
|
+
{{#if (formatUnits name)}}
|
|
18
|
+
*Unit:* {{formatUnits name}}
|
|
19
|
+
|
|
20
|
+
{{/if}}
|
|
21
|
+
{{/if}}
|
|
22
|
+
{{#if (ne defined_in "src/v/config/node_config.cc")}}
|
|
23
|
+
{{#if (ne needs_restart undefined)}}
|
|
24
|
+
*Requires restart:* {{#if needs_restart}}Yes{{else}}No{{/if}}
|
|
25
|
+
|
|
26
|
+
{{/if}}
|
|
27
|
+
{{/if}}
|
|
28
|
+
{{#if visibility}}
|
|
29
|
+
*Visibility:* `{{visibility}}`
|
|
30
|
+
|
|
31
|
+
{{/if}}
|
|
32
|
+
{{#if type}}
|
|
33
|
+
*Type:* {{type}}
|
|
34
|
+
|
|
35
|
+
{{/if}}
|
|
36
|
+
{{#if (and minimum maximum)}}
|
|
37
|
+
*Accepted values:* [`{{minimum}}`, `{{maximum}}`]
|
|
38
|
+
|
|
39
|
+
{{else}}
|
|
40
|
+
{{#if minimum}}
|
|
41
|
+
*Minimum value:* `{{minimum}}`
|
|
42
|
+
|
|
43
|
+
{{/if}}
|
|
44
|
+
{{#if maximum}}
|
|
45
|
+
*Maximum value:* `{{maximum}}`
|
|
46
|
+
|
|
47
|
+
{{/if}}
|
|
48
|
+
{{/if}}
|
|
49
|
+
{{#if (ne default undefined)}}
|
|
50
|
+
*Default:* `{{formatPropertyValue default type}}`
|
|
51
|
+
|
|
52
|
+
{{/if}}
|
|
53
|
+
*Nullable:* {{#if nullable}}Yes{{else}}No{{/if}}
|
|
54
|
+
|
|
55
|
+
{{#if example}}
|
|
56
|
+
{{{renderPropertyExample this}}}
|
|
57
|
+
{{/if}}
|
|
58
|
+
|
|
59
|
+
{{#if aliases}}
|
|
60
|
+
*Aliases:* {{join aliases ", "}}
|
|
61
|
+
|
|
62
|
+
{{/if}}
|
|
63
|
+
{{#if is_deprecated}}
|
|
64
|
+
[WARNING]
|
|
65
|
+
====
|
|
66
|
+
This property is deprecated.
|
|
67
|
+
====
|
|
68
|
+
|
|
69
|
+
{{/if}}
|
|
70
|
+
---
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
=== {{name}}
|
|
2
|
+
|
|
3
|
+
{{#if version}}
|
|
4
|
+
*Introduced in {{version}}*
|
|
5
|
+
|
|
6
|
+
{{/if}}
|
|
7
|
+
{{#if description}}
|
|
8
|
+
{{{description}}}
|
|
9
|
+
{{else}}
|
|
10
|
+
No description available.
|
|
11
|
+
{{/if}}
|
|
12
|
+
|
|
13
|
+
{{#if type}}
|
|
14
|
+
*Type:* {{type}}
|
|
15
|
+
|
|
16
|
+
{{/if}}
|
|
17
|
+
{{#if acceptable_values}}
|
|
18
|
+
*Accepted values:* {{{acceptable_values}}}
|
|
19
|
+
|
|
20
|
+
{{/if}}
|
|
21
|
+
{{#if corresponding_cluster_property}}
|
|
22
|
+
*Related cluster property:* xref:reference:cluster-properties.adoc#{{corresponding_cluster_property}}[{{corresponding_cluster_property}}]
|
|
23
|
+
|
|
24
|
+
{{/if}}
|
|
25
|
+
{{#if (and minimum maximum)}}
|
|
26
|
+
*Accepted values:* [`{{minimum}}`, `{{maximum}}`]
|
|
27
|
+
|
|
28
|
+
{{else}}
|
|
29
|
+
{{#if minimum}}
|
|
30
|
+
*Minimum value:* `{{minimum}}`
|
|
31
|
+
|
|
32
|
+
{{/if}}
|
|
33
|
+
{{#if maximum}}
|
|
34
|
+
*Maximum value:* `{{maximum}}`
|
|
35
|
+
|
|
36
|
+
{{/if}}
|
|
37
|
+
{{/if}}
|
|
38
|
+
{{#if (ne default undefined)}}
|
|
39
|
+
*Default:* `{{formatPropertyValue default type}}`
|
|
40
|
+
|
|
41
|
+
{{/if}}
|
|
42
|
+
*Nullable:* {{#if nullable}}Yes{{else}}No{{/if}}
|
|
43
|
+
|
|
44
|
+
{{#if example}}
|
|
45
|
+
{{{renderPropertyExample this}}}
|
|
46
|
+
{{/if}}
|
|
47
|
+
|
|
48
|
+
{{#if aliases}}
|
|
49
|
+
*Aliases:* {{join aliases ", "}}
|
|
50
|
+
|
|
51
|
+
{{/if}}
|
|
52
|
+
{{#if is_deprecated}}
|
|
53
|
+
[WARNING]
|
|
54
|
+
====
|
|
55
|
+
This property is deprecated.
|
|
56
|
+
====
|
|
57
|
+
|
|
58
|
+
{{/if}}
|
|
59
|
+
---
|
|
@@ -36,13 +36,52 @@ class IsNullableTransformer:
|
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
class IsArrayTransformer:
|
|
39
|
+
"""
|
|
40
|
+
Detects properties that should be treated as arrays based on their C++ type declarations.
|
|
41
|
+
|
|
42
|
+
This transformer identifies two types of array properties:
|
|
43
|
+
1. std::vector<T> - Standard C++ vectors
|
|
44
|
+
2. one_or_many_property<T> - Redpanda's custom type that accepts either a single value or an array
|
|
45
|
+
|
|
46
|
+
The one_or_many_property type is used in Redpanda configuration for properties like 'admin'
|
|
47
|
+
and 'admin_api_tls' where users can specify either:
|
|
48
|
+
- A single object: admin: {address: "127.0.0.1", port: 9644}
|
|
49
|
+
- An array of objects: admin: [{address: "127.0.0.1", port: 9644}, {address: "0.0.0.0", port: 9645}]
|
|
50
|
+
|
|
51
|
+
When detected, these properties are marked with:
|
|
52
|
+
- type: "array"
|
|
53
|
+
- items: {type: <inner_type>} where <inner_type> is extracted from T
|
|
54
|
+
"""
|
|
55
|
+
|
|
56
|
+
# Class-level constants for array type patterns
|
|
57
|
+
ARRAY_PATTERN_STD_VECTOR = "std::vector"
|
|
58
|
+
ARRAY_PATTERN_ONE_OR_MANY = "one_or_many_property"
|
|
59
|
+
|
|
39
60
|
def __init__(self, type_transformer):
|
|
40
61
|
self.type_transformer = type_transformer
|
|
41
62
|
|
|
42
63
|
def accepts(self, info, file_pair):
|
|
43
|
-
|
|
64
|
+
"""
|
|
65
|
+
Check if this property declaration represents an array type.
|
|
66
|
+
|
|
67
|
+
Returns True for:
|
|
68
|
+
- std::vector<T> declarations (standard C++ vectors)
|
|
69
|
+
- one_or_many_property<T> declarations (Redpanda's flexible array type)
|
|
70
|
+
"""
|
|
71
|
+
return (self.ARRAY_PATTERN_STD_VECTOR in info["declaration"] or
|
|
72
|
+
self.ARRAY_PATTERN_ONE_OR_MANY in info["declaration"])
|
|
44
73
|
|
|
45
74
|
def parse(self, property, info, file_pair):
|
|
75
|
+
"""
|
|
76
|
+
Transform the property to indicate it's an array type.
|
|
77
|
+
|
|
78
|
+
Sets:
|
|
79
|
+
- property["type"] = "array"
|
|
80
|
+
- property["items"]["type"] = <extracted_inner_type>
|
|
81
|
+
|
|
82
|
+
The inner type is extracted by the type_transformer, which handles
|
|
83
|
+
removing the wrapper (std::vector<> or one_or_many_property<>) to get T.
|
|
84
|
+
"""
|
|
46
85
|
property["type"] = "array"
|
|
47
86
|
property["items"] = PropertyBag()
|
|
48
87
|
property["items"]["type"] = self.type_transformer.get_type_from_declaration(
|
|
@@ -94,10 +133,35 @@ class VisibilityTransformer:
|
|
|
94
133
|
|
|
95
134
|
|
|
96
135
|
class TypeTransformer:
|
|
136
|
+
|
|
137
|
+
# Class-level constants for type pattern matching
|
|
138
|
+
# Shared with IsArrayTransformer for consistency
|
|
139
|
+
ARRAY_PATTERN_STD_VECTOR = "std::vector"
|
|
140
|
+
ARRAY_PATTERN_ONE_OR_MANY = "one_or_many_property"
|
|
141
|
+
OPTIONAL_PATTERN = "std::optional"
|
|
142
|
+
|
|
97
143
|
def accepts(self, info, file_pair):
|
|
98
144
|
return True
|
|
99
145
|
|
|
100
146
|
def get_cpp_type_from_declaration(self, declaration):
|
|
147
|
+
"""
|
|
148
|
+
Extract the inner type from C++ property declarations.
|
|
149
|
+
|
|
150
|
+
This method handles various C++ template types and extracts the core type T from:
|
|
151
|
+
- property<T> -> T
|
|
152
|
+
- std::optional<T> -> T
|
|
153
|
+
- std::vector<T> -> T
|
|
154
|
+
- one_or_many_property<T> -> T (Redpanda's flexible array type)
|
|
155
|
+
|
|
156
|
+
For one_or_many_property, this is crucial because it allows the same property
|
|
157
|
+
to accept either a single value or an array of values in the configuration.
|
|
158
|
+
Examples:
|
|
159
|
+
- one_or_many_property<model::broker_endpoint> -> model::broker_endpoint
|
|
160
|
+
- one_or_many_property<endpoint_tls_config> -> endpoint_tls_config
|
|
161
|
+
|
|
162
|
+
The extracted type is then used to determine the JSON schema type and
|
|
163
|
+
for resolving default values from the definitions.
|
|
164
|
+
"""
|
|
101
165
|
one_line_declaration = declaration.replace("\n", "").strip()
|
|
102
166
|
raw_type = (
|
|
103
167
|
re.sub(r"^.*property<(.+)>.*", "\\1", one_line_declaration)
|
|
@@ -105,11 +169,19 @@ class TypeTransformer:
|
|
|
105
169
|
.replace(",", "")
|
|
106
170
|
)
|
|
107
171
|
|
|
108
|
-
if
|
|
172
|
+
if self.OPTIONAL_PATTERN in raw_type:
|
|
109
173
|
raw_type = re.sub(".*std::optional<(.+)>.*", "\\1", raw_type)
|
|
110
174
|
|
|
111
|
-
if
|
|
175
|
+
if self.ARRAY_PATTERN_STD_VECTOR in raw_type:
|
|
112
176
|
raw_type = re.sub(".*std::vector<(.+)>.*", "\\1", raw_type)
|
|
177
|
+
|
|
178
|
+
# Handle one_or_many_property<T> - extract the inner type T
|
|
179
|
+
# This is essential for Redpanda's flexible configuration properties
|
|
180
|
+
# that can accept either single values or arrays
|
|
181
|
+
# Check and extract from raw_type for consistency with other type extractors
|
|
182
|
+
if self.ARRAY_PATTERN_ONE_OR_MANY in raw_type:
|
|
183
|
+
raw_type = re.sub(".*one_or_many_property<(.+)>.*", "\\1", raw_type)
|
|
184
|
+
raw_type = raw_type.split()[0].replace(",", "")
|
|
113
185
|
|
|
114
186
|
return raw_type
|
|
115
187
|
|
|
@@ -282,6 +354,10 @@ class FriendlyDefaultTransformer:
|
|
|
282
354
|
- std::chrono::milliseconds(10)
|
|
283
355
|
- std::nullopt
|
|
284
356
|
"""
|
|
357
|
+
|
|
358
|
+
# Class-level constants for pattern matching in default values
|
|
359
|
+
ARRAY_PATTERN_STD_VECTOR = "std::vector"
|
|
360
|
+
|
|
285
361
|
def accepts(self, info, file_pair):
|
|
286
362
|
return info.get("params") and len(info["params"]) > 3
|
|
287
363
|
|
|
@@ -308,7 +384,7 @@ class FriendlyDefaultTransformer:
|
|
|
308
384
|
return property
|
|
309
385
|
|
|
310
386
|
# Transform std::vector defaults.
|
|
311
|
-
if
|
|
387
|
+
if self.ARRAY_PATTERN_STD_VECTOR in default:
|
|
312
388
|
m = re.search(r'\{([^}]+)\}', default)
|
|
313
389
|
if m:
|
|
314
390
|
contents = m.group(1).strip()
|