Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: some missing parts of the ECS schema version update #164

Merged
merged 1 commit into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/ecs-morgan-format/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"node": ">=10"
},
"dependencies": {
"@elastic/ecs-helpers": "^2.0.0",
"@elastic/ecs-helpers": "^2.1.0",
"safe-stable-stringify": "^2.4.3"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/ecs-winston-format/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"node": ">=10"
},
"dependencies": {
"@elastic/ecs-helpers": "^2.0.0",
"@elastic/ecs-helpers": "^2.1.0",
"safe-stable-stringify": "^2.4.3",
"triple-beam": ">=1.1.0"
},
Expand Down
10 changes: 9 additions & 1 deletion utils/create-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,11 @@ if (!ecsRepo) {
const ecsSchemasDir = path.join(ecsRepo, 'schemas')

// Build the JSON schema properties from the ECS schema YAML files.
const properties = getAllFiles(ecsSchemasDir)
var properties = getAllFiles(ecsSchemasDir)
.filter(file => !file.includes('README.md'))
.map(file => fs.readFileSync(file, 'utf8'))
.map(yaml.safeLoad)
.filter(entry => Array.isArray(entry)) // filter out weird `{name: 'main', ...}` entry
.reduce((acc, [val]) => {
let properties = {}
for (const prop of val.fields) {
Expand Down Expand Up @@ -121,6 +122,7 @@ function set (object, objPath, value, customizer) {
function jsonSchemaTypeFromEcsType (type) {
switch (type) {
case 'keyword':
case 'constant_keyword':
return { type: 'string' }
case 'boolean':
return { type: 'boolean' }
Expand All @@ -134,11 +136,14 @@ function jsonSchemaTypeFromEcsType (type) {
]
}
case 'text':
case 'match_only_text':
case 'wildcard':
return { type: 'string' }
case 'integer':
return { type: 'integer' }
case 'long':
case 'float':
case 'scaled_float':
return { type: 'number' }
case 'geo_point':
return {
Expand All @@ -149,6 +154,9 @@ function jsonSchemaTypeFromEcsType (type) {
}
}
case 'object':
case 'flattened':
case 'nested':
case 'source':
return {
type: 'object',
additionalProperties: true
Expand Down
Loading
Loading