Skip to content

Commit

Permalink
Refactor extract_mappings_definition
Browse files Browse the repository at this point in the history
  • Loading branch information
sebelga committed Jan 29, 2020
1 parent 38b1030 commit 4af8138
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,10 @@
import { isPlainObject } from 'lodash';

import { GenericObject } from '../types';
import {
validateMappingsConfiguration,
mappingsConfigurationSchemaKeys,
} from './mappings_validator';

const ALLOWED_PARAMETERS = [...mappingsConfigurationSchemaKeys, 'dynamic_templates', 'properties'];
import { validateMappingsConfiguration, VALID_MAPPINGS_PARAMETERS } from './mappings_validator';

const isMappingDefinition = (obj: GenericObject): boolean => {
const areAllKeysValid = Object.keys(obj).every(key => ALLOWED_PARAMETERS.includes(key));
const areAllKeysValid = Object.keys(obj).every(key => VALID_MAPPINGS_PARAMETERS.includes(key));

if (!areAllKeysValid) {
return false;
Expand Down

0 comments on commit 4af8138

Please sign in to comment.