You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
generateSchemaHelpHtml: '<p>Scan the current grid and build an enum-only schema from visible values.</p>',
31
33
},
32
34
callbacks: {
33
35
onGenerate: ()=>{
@@ -38,6 +40,10 @@ function renderPopulationActionsStory(args) {
38
40
args.onGeneratePairwise?.();
39
41
result.textContent='action:generate-secondary';
40
42
},
43
+
onGenerateSchemaFromGrid: ()=>{
44
+
args.onGenerateSchemaFromGrid?.();
45
+
result.textContent='action:generate-schema';
46
+
},
41
47
},
42
48
});
43
49
@@ -79,6 +85,7 @@ const meta = {
79
85
'<p>Generate n-wise combinations from enum columns in the current schema directly into the grid.</p><p><a class="helplink" href="/docs/test-data/n-wise-testing" target="_blank" rel="noopener noreferrer">N-wise generation docs</a></p>',
80
86
onGenerate: fn(),
81
87
onGeneratePairwise: fn(),
88
+
onGenerateSchemaFromGrid: fn(),
82
89
},
83
90
argTypes: {
84
91
pairwiseVisible: {
@@ -117,6 +124,10 @@ const meta = {
117
124
description: 'Storybook action fired when the secondary action button is clicked.',
118
125
table: {category: 'Events'},
119
126
},
127
+
onGenerateSchemaFromGrid: {
128
+
description: 'Storybook action fired when the Grid to Enum Schema button is clicked.',
Copy file name to clipboardExpand all lines: docs-src/docs/040-test-data/015-data-grid-editable.md
+34-3Lines changed: 34 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,6 +32,40 @@ The definition grid acts as a schema/template:
32
32
33
33
Generated rows are inserted into the main editable data grid.
34
34
35
+
## Grid to Enum Schema
36
+
37
+
The `Grid to Enum Schema` action scans the current main data grid and builds a schema definition from the values already in the table.
38
+
39
+
Use this when you already have example rows in the editable grid and want to quickly turn those values into `Enum` generation rules.
40
+
41
+
The generated schema uses:
42
+
43
+
- one schema row per grid column
44
+
- the current column header as the schema row name
45
+
-`Enum` as the source type for every generated row
46
+
- unique values collected in first-seen row order
47
+
48
+
### How it works
49
+
50
+
1. Open the `Test Data` section in `app.html`.
51
+
2. Press `Grid to Enum Schema`.
52
+
3. Enter a maximum number of enum values to keep for each column.
53
+
4. Confirm truncation if any column has more unique values than the chosen limit.
54
+
5. Review the generated schema and press `Generate` or `Generate Pairwise` as needed.
55
+
56
+
The limit prompt shows the largest unique-value count found in the scanned grid and uses a numeric input field to reduce entry mistakes.
57
+
58
+
The default value is:
59
+
60
+
- the largest column unique-value count when it is `256` or less
61
+
-`256` when the largest column has more than `256` unique values
62
+
63
+
If the chosen limit is lower than the number of unique values in one or more columns, then AnyWayData will ask for confirmation before truncating the schema. Truncation keeps the first values seen in current grid row order.
64
+
65
+
When accepted, the generated enum schema replaces the existing schema definition in the Test Data editor. The schema grid, schema text area, validation state, and pairwise button visibility are all refreshed automatically.
66
+
67
+
If the grid is empty, or no usable values can be extracted, then the existing schema is left unchanged.
68
+
35
69
## Generate Modes in the Grid
36
70
37
71
When generating in `app.html`, you can choose whether generation replaces data or amends existing rows:
@@ -103,6 +137,3 @@ The schema in the Column Definition Data Grid will be used to generate the data.
103
137
104
138
All data generation happens in the browser so the amount of data you can generate is limited only by the performance and memory of your computer.
0 commit comments