es-mapping-to-schema
Advanced tools
Comparing version 3.3.1 to 3.3.2
@@ -83,3 +83,3 @@ const _ = require('lodash'); | ||
if (schema.type === 'string' && options[schemaType].all.maxLength) { | ||
if (options[schemaType].all.maxLength && mapping.type === 'string') { | ||
schema.maxLength = options[schemaType].all.maxLength; | ||
@@ -86,0 +86,0 @@ } |
{ | ||
"name": "es-mapping-to-schema", | ||
"version": "3.3.1", | ||
"version": "3.3.2", | ||
"description": "Convert Elasticsearch mappings to Schema Inspector schemas", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
32
test.js
@@ -1262,2 +1262,34 @@ const chai = require('chai'); | ||
it('should apply maxLength sanitization to all strings', () => { | ||
const mapping = { | ||
properties: { | ||
someString: { | ||
type: 'string' | ||
}, | ||
someInt: { | ||
type: 'integer' | ||
} | ||
} | ||
}; | ||
const expectedSchema = { | ||
properties: { | ||
someString: { | ||
maxLength: 20 | ||
}, | ||
someInt: {} | ||
} | ||
}; | ||
const schemas = MappingToSchema(mapping, { | ||
sanitization: { | ||
all: { | ||
maxLength: 20 | ||
} | ||
} | ||
}); | ||
expect(schemas.sanitization).to.eql(expectedSchema); | ||
}); | ||
it('should apply rules to all string mappings', () => { | ||
@@ -1264,0 +1296,0 @@ const mapping = { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48757
1636