diff --git a/packages/@o3r/components/builders/component-extractor/helpers/component/component.extractor.ts b/packages/@o3r/components/builders/component-extractor/helpers/component/component.extractor.ts index 9b5b1209a6..6605498fdd 100644 --- a/packages/@o3r/components/builders/component-extractor/helpers/component/component.extractor.ts +++ b/packages/@o3r/components/builders/component-extractor/helpers/component/component.extractor.ts @@ -276,6 +276,9 @@ export class ComponentExtractor { } else { this.logger.warn(message); } + if (propertiesWithDefaultValue.length === 0) { + return acc; + } const configWithoutIncompatibleProperties = { ...config, properties: propertiesWithDefaultValue diff --git a/packages/@o3r/components/builders/metadata-check/helpers/config-metadata-comparison.helper.ts b/packages/@o3r/components/builders/metadata-check/helpers/config-metadata-comparison.helper.ts index d7f251f1e5..44e795a501 100644 --- a/packages/@o3r/components/builders/metadata-check/helpers/config-metadata-comparison.helper.ts +++ b/packages/@o3r/components/builders/metadata-check/helpers/config-metadata-comparison.helper.ts @@ -35,9 +35,7 @@ export interface MigrationConfigData { * ``` */ const getConfigurationArray = (content: ComponentConfigOutput[]): ComponentConfigOutput[] => content.flatMap((config) => - config.properties.length > 1 - ? config.properties.map((prop) => ({ ...config, properties: [prop] })) - : [config] + config.properties.map((prop) => ({ ...config, properties: [prop] })) ); const getConfigurationPropertyName = (config: ComponentConfigOutput) => `${config.library}#${config.name}` + (config.properties.length > 0 ? ` ${config.properties[0].name}` : ''); diff --git a/packages/@o3r/components/builders/metadata-check/index.it.spec.ts b/packages/@o3r/components/builders/metadata-check/index.it.spec.ts index e70fc30941..5559eb8591 100644 --- a/packages/@o3r/components/builders/metadata-check/index.it.spec.ts +++ b/packages/@o3r/components/builders/metadata-check/index.it.spec.ts @@ -185,7 +185,10 @@ const previousConfigurationMetadata: ComponentConfigOutput[] = [ createConfig('@o3r/lib6', 'MyConfig6', ['prop6']), createConfig('@o3r/lib7', 'MyConfig7', ['prop7']), createConfig('@o3r/lib8', 'MyConfig8', ['prop8']), - createConfig('@o3r/lib9', 'MyConfig9', ['prop9']) + createConfig('@o3r/lib9', 'MyConfig9', ['prop9']), + // This case should not happen anymore as we filter config without properties + // Adding this case to ensure the support of older metadata + createConfig('@o3r/lib10', 'MyConfig10', []) ]; const newConfigurationMetadata: ComponentConfigOutput[] = [ diff --git a/packages/@o3r/configuration/schemas/configuration.metadata.schema.json b/packages/@o3r/configuration/schemas/configuration.metadata.schema.json index 021a7c8b94..3ab096fcd5 100644 --- a/packages/@o3r/configuration/schemas/configuration.metadata.schema.json +++ b/packages/@o3r/configuration/schemas/configuration.metadata.schema.json @@ -216,7 +216,8 @@ } } ] - } + }, + "minItems": 1 } } }