src/platform/packages/shared/kbn-data-view-validation/README.md
Validation utilities for data views, including index pattern validation.
import { validateDataView, ILLEGAL_CHARACTERS_VISIBLE } from '@kbn/data-view-validation';
// Validate an index pattern
const errors = validateDataView('my-index-pattern');
if (errors.ILLEGAL_CHARACTERS) {
console.log('Contains illegal characters:', errors.ILLEGAL_CHARACTERS);
}
if (errors.CONTAINS_SPACES) {
console.log('Contains spaces');
}
// Check illegal characters list
console.log('Illegal characters:', ILLEGAL_CHARACTERS_VISIBLE);
validateDataView(indexPattern: string)Returns an object with validation errors:
ILLEGAL_CHARACTERS: Array of illegal characters foundCONTAINS_SPACES: Boolean indicating if the pattern contains spacesILLEGAL_CHARACTERS_VISIBLE: Array of visible illegal charactersILLEGAL_CHARACTERS: Array of all illegal characters (including space)ILLEGAL_CHARACTERS_KEY: Error key for illegal charactersCONTAINS_SPACES_KEY: Error key for spaces