diff --git a/packages/@o3r/components/builders/metadata-check/schema.json b/packages/@o3r/components/builders/metadata-check/schema.json index 4a55765ac9..40842dc3b4 100644 --- a/packages/@o3r/components/builders/metadata-check/schema.json +++ b/packages/@o3r/components/builders/metadata-check/schema.json @@ -34,6 +34,11 @@ "type": "string", "description": "Path of the config metadata file.", "default": "./component.config.metadata.json" + }, + "checkAfterItems": { + "type": "boolean", + "description": "Whether after items should be checked.", + "default": true } }, "additionalProperties": false, diff --git a/packages/@o3r/extractors/src/core/comparator/metadata-comparator.interface.ts b/packages/@o3r/extractors/src/core/comparator/metadata-comparator.interface.ts index 0ed1bfc4af..46cd77c361 100644 --- a/packages/@o3r/extractors/src/core/comparator/metadata-comparator.interface.ts +++ b/packages/@o3r/extractors/src/core/comparator/metadata-comparator.interface.ts @@ -85,4 +85,7 @@ export interface MigrationMetadataCheckBuilderOptions extends JsonObject { /** Entry to check for previous metadata in the `package.json` file under `cmsMetadata`. */ packageJsonEntry: keyof Omit; + + /** Whether to check the items set in "after" property in the migration file. */ + checkAfterItems: boolean; } diff --git a/packages/@o3r/extractors/src/core/comparator/metadata-comparison.helper.ts b/packages/@o3r/extractors/src/core/comparator/metadata-comparison.helper.ts index 6da496725d..787b88b038 100644 --- a/packages/@o3r/extractors/src/core/comparator/metadata-comparison.helper.ts +++ b/packages/@o3r/extractors/src/core/comparator/metadata-comparison.helper.ts @@ -16,6 +16,7 @@ function checkMetadataFile( newMetadataFile: MetadataFile, migrationData: MigrationData[], isBreakingChangeAllowed: boolean, + checkAfterItems: boolean, comparator: MetadataComparator ): Error[] { const errors: Error[] = []; @@ -40,7 +41,7 @@ function checkMetadataFile( continue; } - if (migrationMetadataValue.after) { + if (checkAfterItems && migrationMetadataValue.after) { const isNewValueInNewMetadata = newMetadataArray.some((newValue) => comparator.isMigrationDataMatch(newValue, migrationMetadataValue.after!, migrationMetadataValue.contentType)); if (!isNewValueInNewMetadata) { errors.push(new Error(`Property ${comparator.getIdentifier(lastValue)} has been modified but the new property is not present in the new metadata`)); @@ -161,7 +162,7 @@ Detection of package manager runner will fallback on the one used to execute the const newFile = getLocalMetadataFile(metadataPathInWorkspace); - const errors = checkMetadataFile(metadata, newFile, migrationData.changes, options.allowBreakingChanges, comparator); + const errors = checkMetadataFile(metadata, newFile, migrationData.changes, options.allowBreakingChanges, options.checkAfterItems, comparator); if (errors.length) { return { diff --git a/packages/@o3r/localization/builders/metadata-check/schema.json b/packages/@o3r/localization/builders/metadata-check/schema.json index 9b3e20b2ec..eaf7569299 100644 --- a/packages/@o3r/localization/builders/metadata-check/schema.json +++ b/packages/@o3r/localization/builders/metadata-check/schema.json @@ -34,6 +34,11 @@ "type": "string", "description": "Path of the localization metadata file.", "default": "./localisation.metadata.json" + }, + "checkAfterItems": { + "type": "boolean", + "description": "Whether after items should be checked.", + "default": true } }, "additionalProperties": false, diff --git a/packages/@o3r/styling/builders/metadata-check/schema.json b/packages/@o3r/styling/builders/metadata-check/schema.json index 1b8879d60d..9be0142fb7 100644 --- a/packages/@o3r/styling/builders/metadata-check/schema.json +++ b/packages/@o3r/styling/builders/metadata-check/schema.json @@ -34,6 +34,11 @@ "type": "string", "description": "Path of the styling metadata file.", "default": "./style.metadata.json" + }, + "checkAfterItems": { + "type": "boolean", + "description": "Whether after items should be checked.", + "default": true } }, "additionalProperties": false,