@redpanda-data/docs-extensions-and-macros 4.11.0 → 4.12.0
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 +4 -2
- package/extensions/convert-to-markdown.js +17 -1
- package/package.json +3 -1
- package/tools/property-extractor/COMPUTED_CONSTANTS.md +173 -0
- package/tools/property-extractor/Makefile +12 -1
- package/tools/property-extractor/README.adoc +828 -97
- package/tools/property-extractor/compare-properties.js +38 -13
- package/tools/property-extractor/constant_resolver.py +610 -0
- package/tools/property-extractor/file_pair.py +42 -0
- package/tools/property-extractor/generate-handlebars-docs.js +41 -8
- package/tools/property-extractor/helpers/gt.js +9 -0
- package/tools/property-extractor/helpers/includes.js +17 -0
- package/tools/property-extractor/helpers/index.js +3 -0
- package/tools/property-extractor/helpers/isEnterpriseEnum.js +24 -0
- package/tools/property-extractor/helpers/renderPropertyExample.js +6 -5
- package/tools/property-extractor/overrides.json +248 -0
- package/tools/property-extractor/parser.py +254 -32
- package/tools/property-extractor/property_bag.py +40 -0
- package/tools/property-extractor/property_extractor.py +1417 -430
- package/tools/property-extractor/requirements.txt +1 -0
- package/tools/property-extractor/templates/property-backup.hbs +161 -0
- package/tools/property-extractor/templates/property.hbs +104 -49
- package/tools/property-extractor/templates/topic-property-backup.hbs +148 -0
- package/tools/property-extractor/templates/topic-property.hbs +72 -34
- package/tools/property-extractor/tests/test_known_values.py +617 -0
- package/tools/property-extractor/tests/transformers_test.py +81 -6
- package/tools/property-extractor/topic_property_extractor.py +23 -10
- package/tools/property-extractor/transformers.py +2191 -369
- package/tools/property-extractor/type_definition_extractor.py +669 -0
- package/tools/property-extractor/definitions.json +0 -245
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Property Comparison Tool
|
|
5
|
-
*
|
|
5
|
+
*
|
|
6
6
|
* Compares two property JSON files and generates a detailed report of:
|
|
7
7
|
* - New properties added
|
|
8
8
|
* - Properties with changed defaults
|
|
9
9
|
* - Properties with changed descriptions
|
|
10
10
|
* - Properties with changed types
|
|
11
11
|
* - Deprecated properties
|
|
12
|
+
* - Removed properties
|
|
13
|
+
* - Properties with empty descriptions (excluding deprecated)
|
|
12
14
|
*/
|
|
13
15
|
|
|
14
16
|
const fs = require('fs');
|
|
@@ -57,7 +59,7 @@ function deepEqual(a, b) {
|
|
|
57
59
|
* - single item → `[<formatted item>]` (recursively formatted)
|
|
58
60
|
* - multiple items → `'[<n> items]'`
|
|
59
61
|
* - Object → JSON string via `JSON.stringify`
|
|
60
|
-
* - String → quoted
|
|
62
|
+
* - String → quoted
|
|
61
63
|
* - Other primitives → `String(value)`
|
|
62
64
|
*
|
|
63
65
|
* @param {*} value - The value to format for display.
|
|
@@ -76,7 +78,7 @@ function formatValue(value) {
|
|
|
76
78
|
return JSON.stringify(value);
|
|
77
79
|
}
|
|
78
80
|
if (typeof value === 'string') {
|
|
79
|
-
return
|
|
81
|
+
return `"${value}"`;
|
|
80
82
|
}
|
|
81
83
|
return String(value);
|
|
82
84
|
}
|
|
@@ -117,28 +119,29 @@ function extractProperties(data) {
|
|
|
117
119
|
*
|
|
118
120
|
* Compares properties extracted from oldData and newData and classifies differences
|
|
119
121
|
* into newProperties, changedDefaults, changedDescriptions, changedTypes,
|
|
120
|
-
* deprecatedProperties (newly deprecated in newData), and
|
|
121
|
-
*
|
|
122
|
-
* is determined by a deep structural comparison.
|
|
122
|
+
* deprecatedProperties (newly deprecated in newData), removedProperties, and
|
|
123
|
+
* emptyDescriptions (non-deprecated properties missing descriptions in newData).
|
|
124
|
+
* Default equality is determined by a deep structural comparison.
|
|
123
125
|
*
|
|
124
126
|
* @param {Object} oldData - Parsed JSON of the older property file.
|
|
125
127
|
* @param {Object} newData - Parsed JSON of the newer property file.
|
|
126
128
|
* @param {string} oldVersion - Version string corresponding to oldData.
|
|
127
129
|
* @param {string} newVersion - Version string corresponding to newData.
|
|
128
130
|
* @return {Object} Report object with arrays: newProperties, changedDefaults,
|
|
129
|
-
* changedDescriptions, changedTypes, deprecatedProperties, removedProperties.
|
|
131
|
+
* changedDescriptions, changedTypes, deprecatedProperties, removedProperties, emptyDescriptions.
|
|
130
132
|
*/
|
|
131
133
|
function compareProperties(oldData, newData, oldVersion, newVersion) {
|
|
132
134
|
const oldProps = extractProperties(oldData);
|
|
133
135
|
const newProps = extractProperties(newData);
|
|
134
|
-
|
|
136
|
+
|
|
135
137
|
const report = {
|
|
136
138
|
newProperties: [],
|
|
137
139
|
changedDefaults: [],
|
|
138
140
|
changedDescriptions: [],
|
|
139
141
|
changedTypes: [],
|
|
140
142
|
deprecatedProperties: [],
|
|
141
|
-
removedProperties: []
|
|
143
|
+
removedProperties: [],
|
|
144
|
+
emptyDescriptions: []
|
|
142
145
|
};
|
|
143
146
|
|
|
144
147
|
// Find new properties
|
|
@@ -207,7 +210,21 @@ function compareProperties(oldData, newData, oldVersion, newVersion) {
|
|
|
207
210
|
});
|
|
208
211
|
}
|
|
209
212
|
}
|
|
210
|
-
|
|
213
|
+
|
|
214
|
+
// Find properties with empty descriptions in the new version (excluding deprecated)
|
|
215
|
+
for (const [name, prop] of Object.entries(newProps)) {
|
|
216
|
+
const hasEmptyDescription = !prop.description ||
|
|
217
|
+
(typeof prop.description === 'string' && prop.description.trim().length === 0) ||
|
|
218
|
+
prop.description === 'No description';
|
|
219
|
+
|
|
220
|
+
if (hasEmptyDescription && !prop.is_deprecated) {
|
|
221
|
+
report.emptyDescriptions.push({
|
|
222
|
+
name,
|
|
223
|
+
type: prop.type
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
211
228
|
return report;
|
|
212
229
|
}
|
|
213
230
|
|
|
@@ -273,7 +290,14 @@ function generateConsoleReport(report, oldVersion, newVersion) {
|
|
|
273
290
|
console.log(` • ${prop.name} (${prop.type})`);
|
|
274
291
|
});
|
|
275
292
|
}
|
|
276
|
-
|
|
293
|
+
|
|
294
|
+
if (report.emptyDescriptions.length > 0) {
|
|
295
|
+
console.log(`\n⚠️ Properties with empty descriptions (${report.emptyDescriptions.length}):`);
|
|
296
|
+
report.emptyDescriptions.forEach(prop => {
|
|
297
|
+
console.log(` • ${prop.name} (${prop.type})`);
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
|
|
277
301
|
console.log('\n' + '='.repeat(60));
|
|
278
302
|
}
|
|
279
303
|
|
|
@@ -283,7 +307,7 @@ function generateConsoleReport(report, oldVersion, newVersion) {
|
|
|
283
307
|
* Produces a JSON file containing a comparison header (old/new versions and timestamp),
|
|
284
308
|
* a summary with counts for each change category, and the full details object passed as `report`.
|
|
285
309
|
*
|
|
286
|
-
* @param {Object} report - Comparison details object produced by compareProperties; expected to contain arrays: `newProperties`, `changedDefaults`, `changedDescriptions`, `changedTypes`, `deprecatedProperties`, and `
|
|
310
|
+
* @param {Object} report - Comparison details object produced by compareProperties; expected to contain arrays: `newProperties`, `changedDefaults`, `changedDescriptions`, `changedTypes`, `deprecatedProperties`, `removedProperties`, and `emptyDescriptions`.
|
|
287
311
|
* @param {string} oldVersion - The previous version identifier included in the comparison header.
|
|
288
312
|
* @param {string} newVersion - The new version identifier included in the comparison header.
|
|
289
313
|
* @param {string} outputPath - Filesystem path where the JSON report will be written.
|
|
@@ -301,7 +325,8 @@ function generateJsonReport(report, oldVersion, newVersion, outputPath) {
|
|
|
301
325
|
changedDescriptions: report.changedDescriptions.length,
|
|
302
326
|
changedTypes: report.changedTypes.length,
|
|
303
327
|
deprecatedProperties: report.deprecatedProperties.length,
|
|
304
|
-
removedProperties: report.removedProperties.length
|
|
328
|
+
removedProperties: report.removedProperties.length,
|
|
329
|
+
emptyDescriptions: report.emptyDescriptions.length
|
|
305
330
|
},
|
|
306
331
|
details: report
|
|
307
332
|
};
|