Skip to content

Commit

Permalink
fix(#2553): remove config with no properties + support metadata check…
Browse files Browse the repository at this point in the history
… for config without properties
  • Loading branch information
matthieu-crouzet committed Dec 20, 2024
1 parent c8834dc commit e34b9dc
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,9 @@ export class ComponentExtractor {
} else {
this.logger.warn(message);
}
if (propertiesWithDefaultValue.length === 0) {
return acc;

Check warning on line 280 in packages/@o3r/components/builders/component-extractor/helpers/component/component.extractor.ts

View check run for this annotation

Codecov / codecov/patch

packages/@o3r/components/builders/component-extractor/helpers/component/component.extractor.ts#L280

Added line #L280 was not covered by tests
}
const configWithoutIncompatibleProperties = {
...config,
properties: propertiesWithDefaultValue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}` : '');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@
}
}
]
}
},
"minItems": 1
}
}
}
Expand Down

0 comments on commit e34b9dc

Please sign in to comment.