diff --git a/schemas/index.ts b/schemas/index.ts index 37ab4f72..350e28f1 100644 --- a/schemas/index.ts +++ b/schemas/index.ts @@ -12,9 +12,12 @@ const NAME_FIELD = { readOnly: true, }; -export function getSchemas(countryCode = '-'): Readonly { +export function getSchemas( + countryCode = '-', + pluginSchemaList: SchemaStub[] = [] +): Readonly { const builtCoreSchemas = getCoreSchemas(); - const builtAppSchemas = getAppSchemas(countryCode); + const builtAppSchemas = getAppSchemas(countryCode, pluginSchemaList); let schemaMap = Object.assign({}, builtAppSchemas, builtCoreSchemas); schemaMap = addMetaFields(schemaMap); @@ -137,8 +140,12 @@ function getCoreSchemas(): SchemaMap { return cleanSchemas(coreSchemaMap); } -function getAppSchemas(countryCode: string): SchemaMap { - const appSchemaMap = getMapFromList(cloneDeep(appSchemas), 'name'); +function getAppSchemas( + countryCode: string, + pluginSchemaList: SchemaStub[] +): SchemaMap { + const schemaList = cloneDeep([appSchemas, pluginSchemaList].flat()); + const appSchemaMap = getMapFromList(schemaList, 'name'); const regionalSchemaMap = getRegionalSchemaMap(countryCode); const combinedSchemas = getRegionalCombinedSchemas( appSchemaMap,