Skip to content

Commit 6139ea7

Browse files
authored
chore: some missing parts of the ECS schema version update (#164)
- update the ecs-helpers deps for morgan and winston - update the ECS JSON schema (and the generation script) from ecs.git v8.10.0 tag Refs: #163
1 parent 7c82a8d commit 6139ea7

File tree

4 files changed

+1444
-208
lines changed

4 files changed

+1444
-208
lines changed

packages/ecs-morgan-format/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"node": ">=10"
3838
},
3939
"dependencies": {
40-
"@elastic/ecs-helpers": "^2.0.0",
40+
"@elastic/ecs-helpers": "^2.1.0",
4141
"safe-stable-stringify": "^2.4.3"
4242
},
4343
"devDependencies": {

packages/ecs-winston-format/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"node": ">=10"
4141
},
4242
"dependencies": {
43-
"@elastic/ecs-helpers": "^2.0.0",
43+
"@elastic/ecs-helpers": "^2.1.0",
4444
"safe-stable-stringify": "^2.4.3",
4545
"triple-beam": ">=1.1.0"
4646
},

utils/create-schema.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,11 @@ if (!ecsRepo) {
4747
const ecsSchemasDir = path.join(ecsRepo, 'schemas')
4848

4949
// Build the JSON schema properties from the ECS schema YAML files.
50-
const properties = getAllFiles(ecsSchemasDir)
50+
var properties = getAllFiles(ecsSchemasDir)
5151
.filter(file => !file.includes('README.md'))
5252
.map(file => fs.readFileSync(file, 'utf8'))
5353
.map(yaml.safeLoad)
54+
.filter(entry => Array.isArray(entry)) // filter out weird `{name: 'main', ...}` entry
5455
.reduce((acc, [val]) => {
5556
let properties = {}
5657
for (const prop of val.fields) {
@@ -121,6 +122,7 @@ function set (object, objPath, value, customizer) {
121122
function jsonSchemaTypeFromEcsType (type) {
122123
switch (type) {
123124
case 'keyword':
125+
case 'constant_keyword':
124126
return { type: 'string' }
125127
case 'boolean':
126128
return { type: 'boolean' }
@@ -134,11 +136,14 @@ function jsonSchemaTypeFromEcsType (type) {
134136
]
135137
}
136138
case 'text':
139+
case 'match_only_text':
140+
case 'wildcard':
137141
return { type: 'string' }
138142
case 'integer':
139143
return { type: 'integer' }
140144
case 'long':
141145
case 'float':
146+
case 'scaled_float':
142147
return { type: 'number' }
143148
case 'geo_point':
144149
return {
@@ -149,6 +154,9 @@ function jsonSchemaTypeFromEcsType (type) {
149154
}
150155
}
151156
case 'object':
157+
case 'flattened':
158+
case 'nested':
159+
case 'source':
152160
return {
153161
type: 'object',
154162
additionalProperties: true

0 commit comments

Comments
 (0)