vocabularyNarrowing function

UiVocabularySchema vocabularyNarrowing(
  1. String? missionType,
  2. UiVocabularySchema baseSchema, {
  3. VocabularyNarrowingConfig config = VocabularyNarrowingConfig.empty,
})

Resolve the active schema for a mission type (FR-005). Returns the narrowed schema if one is declared, otherwise returns the base schema.

The returned schema carries the missionType tag so the mission trace can record which vocabulary a given render was validated against.

Implementation

UiVocabularySchema vocabularyNarrowing(
  String? missionType,
  UiVocabularySchema baseSchema, {
  VocabularyNarrowingConfig config = VocabularyNarrowingConfig.empty,
}) {
  if (missionType == null) return baseSchema;
  final narrowed = config.byMissionType[missionType];
  if (narrowed == null) return baseSchema;
  return narrowed;
}