A datamodel registry loader that scans data_models/**/*.yaml, parses entities, and computes entity keys from location paths.
Firestore env layer works with project config and firebase-admin.
data_models/**/*.yamlentityKey, collectionPathTemplate, pathParams, docIdParamName{$id} and {code} placeholder styleslocations fieldentityKey::collectionPathTemplateloadEntityRegistry(repoRoot) returns deterministic resultssrc/datamodels/types.ts with DatamodelYaml, DatamodelFieldSpec, EntityDefinitionsrc/datamodels/location.ts with placeholder regexisPlaceholderSegment(segment) and placeholderName(segment)extractCollectionPathTemplate(location) returning template, params, docIdParamNamederiveEntityKeyFromCollectionSegments(segments)buildCollectionPath(template, params) for param substitutionsrc/datamodels/registry.ts with loadEntityRegistry(repoRoot)repoRoot/data_models recursively for .yaml fileslocationsEntityDefinition for each location${entityKey}::${collectionPathTemplate}entityKeysrc/datamodels/index.ts with exportsbuildCollectionPathstring|number|boolean|timestamp|map|array|unknownusers/{$id} → entityKey: users, pathParams: [], docIdParamName: idcleaningSchedules/{$scheduleId}/cleaningTimeSlots/{$id} → entityKey: cleaningSchedules_cleaningTimeSlots, pathParams: [scheduleId], docIdParamName: id
Reacties