Skip to content

Separate MetadataExtractionService into two services

What does this MR do and why?

The Packages::Nuget::MetadataExtractionService has two main responsibilities, which are:

  1. Pulling the package_file from the object store and extracting the metadata .nuspec file from it.
  2. Extracting the metadata from that extracted .nuspec file.

However, this has some drawbacks:

  1. It doesn't adhere to the single responsibility principle, as the service was responsible for both file extraction and metadata extraction.
  2. In an ongoing implementation related to the issue #293748 (closed), we are extracting the .nuspec file using a different method. Following that, we would like to pass the extracted file to a standalone service responsible for metadata extraction.

To address these concerns, this MR introduces a separation of responsibilities. The Packages::Nuget::MetadataExtractionService now acts as a wrapper class that delegates the two tasks to two new services:

  1. Packages::Nuget::ExtractMetadataFileService: This service focuses on pulling the package_file from the object store and extracting the .nuspec file.
  2. Packages::Nuget::ExtractMetadataContentService: This service takes the extracted .nuspec file and handles the extraction of metadata from it.

By introducing these dedicated services, we adhere to the single responsibility principle and provide reusable separated services.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #293748 (closed)

Edited by Moaz Khalifa

Merge request reports