web / lib/services/schema-detection/detectors/default-detector
lib/services/schema-detection/detectors/default-detector
Default Schema Detector.
The default detector handles all schema detection by combining language detection with language-aware field mapping and structural pattern detection.
This detector always returns results and serves as the fallback when custom detectors cannot handle the input.
Variables
defaultDetector
constdefaultDetector:SchemaDetector
Default schema detector that handles all input types.
Uses:
- franc library for language detection (7 languages)
- Language-aware patterns for field mapping
- Structural analysis for ID and enum detection
Example
import { schemaDetectionPlugin, defaultDetector } from '@timetiles/payload-schema-detection';
export default buildConfig({
plugins: [
schemaDetectionPlugin({
detectors: [defaultDetector],
}),
],
});Functions
createDefaultDetector()
createDefaultDetector(
options?):SchemaDetector
Creates a default schema detector with optional detection overrides.
When called without options, produces the same behavior as the original
defaultDetector constant. Options allow customizing language detection,
field patterns, scoring weights, validators, coordinate detection, and
pipeline stages.
Parameters
options?
Optional detection options for customizing behavior
Returns
A SchemaDetector instance
Example
// No options — identical to the original defaultDetector
const detector = createDefaultDetector();
// Force German language, skip enum detection
const customDetector = createDefaultDetector({
language: "deu",
skip: { enums: true },
});