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
@@ -183,26 +176,23 @@ An example event for ` + "`example`" + ` looks as following:
183
176
}
184
177
}
185
178
186
-
funcTesRenderReadmeWithFields(t*testing.T) {
187
-
cases:= []struct {
188
-
titlestring
189
-
packageRootstring
190
-
templatePathstring
191
-
dataStreamNamestring
192
-
readmeTemplateContentsstring
193
-
fieldsContentsstring
194
-
expectedstring
195
-
}{
196
-
{
197
-
title: "README fields from package",
198
-
packageRoot: t.TempDir(),
199
-
templatePath: "_dev/build/docs/README.md",
200
-
readmeTemplateContents: `
179
+
varrenderCases= []struct {
180
+
titlestring
181
+
templatePathstring
182
+
dataStreamNamestring
183
+
readmeTemplateContentsstring
184
+
fieldsContentsstring
185
+
expectedstring
186
+
}{
187
+
{
188
+
title: "README fields from package",
189
+
templatePath: "_dev/build/docs/README.md",
190
+
readmeTemplateContents: `
201
191
{{- generatedHeader }}
202
192
# README
203
193
Introduction to the package
204
194
{{ fields }}`,
205
-
expected: `<!-- NOTICE: Do not edit this file manually.-->
195
+
expected: `<!-- NOTICE: Do not edit this file manually.-->
206
196
<!-- This file is automatically generated by Elastic Package -->
207
197
# README
208
198
Introduction to the package
@@ -212,71 +202,95 @@ Introduction to the package
212
202
|---|---|---|
213
203
| data_stream.type | Data stream type package. | constant_keyword |
214
204
`,
215
-
dataStreamName: "",
216
-
fieldsContents: `
205
+
dataStreamName: "",
206
+
fieldsContents: `
217
207
- name: data_stream.type
218
208
type: constant_keyword
219
209
description: Data stream type package.`,
220
-
},
221
-
{
222
-
title: "README with one field",
223
-
packageRoot: t.TempDir(),
224
-
templatePath: "_dev/build/docs/README.md",
225
-
readmeTemplateContents: `
226
-
# README
210
+
},
211
+
{
212
+
title: "README with one field",
213
+
templatePath: "_dev/build/docs/README.md",
214
+
readmeTemplateContents: `# README
227
215
Introduction to the package
228
216
{{ fields "example" }}`,
229
-
expected: `<!-- NOTICE: Do not edit this file manually.-->
230
-
<!-- This file is automatically generated by Elastic Package -->
231
-
# README
217
+
expected: `# README
232
218
Introduction to the package
233
219
**Exported fields**
234
220
235
221
| Field | Description | Type |
236
222
|---|---|---|
237
223
| data_stream.type | Data stream type. | constant_keyword |
238
224
`,
239
-
dataStreamName: "example",
240
-
fieldsContents: `
225
+
dataStreamName: "example",
226
+
fieldsContents: `
241
227
- name: data_stream.type
242
228
type: constant_keyword
243
229
description: Data stream type.`,
244
-
},
245
-
{
246
-
title: "README no fields",
247
-
packageRoot: t.TempDir(),
248
-
templatePath: "_dev/build/docs/README.md",
249
-
readmeTemplateContents: `
230
+
},
231
+
{
232
+
title: "README with group fields",
233
+
templatePath: "_dev/build/docs/README.md",
234
+
readmeTemplateContents: `
235
+
# README
236
+
Introduction to the package
237
+
{{ fields "example" }}`,
238
+
expected: `
239
+
# README
240
+
Introduction to the package
241
+
**Exported fields**
242
+
243
+
| Field | Description | Type |
244
+
|---|---|---|
245
+
| dns.answers | An array containing an object for each answer section returned by the server. The main keys that should be present in these objects are defined by ECS. Records that have more information may contain more keys than what ECS defines. Not all DNS data sources give all details about DNS answers. At minimum, answer objects must contain the `+"`data`"+` key. If more information is available, map as much of it to ECS as possible, and add any additional fields to the answer objects as custom fields. | group |
246
+
| dns.answers.name | The domain name to which this resource record pertains. If a chain of CNAME is being resolved, each answer's `+"`name`"+` should be the one that corresponds with the answer's `+"`data`"+`. It should not simply be the original `+"`question.name`"+` repeated. | keyword |
247
+
`,
248
+
dataStreamName: "example",
249
+
fieldsContents: `
250
+
- name: emptygroup
251
+
type: group
252
+
- external: ecs
253
+
name: dns.answers
254
+
type: group
255
+
- external: ecs
256
+
name: dns.answers.name
257
+
`,
258
+
},
259
+
{
260
+
title: "README no fields",
261
+
templatePath: "_dev/build/docs/README.md",
262
+
readmeTemplateContents: `
250
263
{{- generatedHeader }}
251
264
# README
252
265
Introduction to the package
253
266
{{ fields "notexist" }}`,
254
-
expected: `<!-- NOTICE: Do not edit this file manually.-->
267
+
expected: `<!-- NOTICE: Do not edit this file manually.-->
255
268
<!-- This file is automatically generated by Elastic Package -->
0 commit comments