Skip to content

[Feature]: Write attachments (external objects) into a .reqifz and keep the original entry names  #84

Open

Description

@samatstariongroup

What type of issue is this?

  • Bug report
  • Feature request

Prerequisites

  • I have written a descriptive issue title
  • I have verified that I am running the latest version of the reqifsharp
  • I have searched open and closed issues to ensure it has not already been reported

Description

ReqIFSerializer writes only the .reqif documents into a .reqifz archive. Attachments that the documents refer to through <xhtml:object data="..."> (images, OLE objects and other files) are not written, and each document is renamed to {index}_{header identifier}.reqif.

As a result, reading a .reqifz, changing it and writing it again produces an archive in which every embedded picture is missing, and the entry names no longer match the original. This blocks the planned editing and export feature of the ReqIF Viewer.

Reading attachments was added in #18 (ExternalObject.QueryLocalData); this issue is about writing them.

Proposal

  • An overload of Serialize/SerializeAsync for .reqifz that takes the attachments to include, for example the source archive (copy every entry that is not a .reqif file) or a list of entries (path and stream).
  • Keep the original .reqif entry names when they are known (from deserialization), and use the current naming only for new documents.
  • Keep the sync and async variants in step.

Acceptance criteria

  • Reading requirements-and-objects.reqifz (test data, 419 attachments), writing it with the new API and reading it again gives the same documents and all 419 attachments, which resolve through ExternalObject.QueryLocalData.
  • Entry names of the original documents are preserved.

Steps to Reproduce

var reqifs = new ReqIFDeserializer().Deserialize("requirements-and-objects.reqifz").ToList();
new ReqIFSerializer().Serialize(reqifs, "copy.reqifz");
// copy.reqifz contains only "0_rmf-d59519b5-....reqif"; the 419 media/*.png entries are gone

System Configuration

  • reqifsharp version: ReqIFSharp 10.1.2, ReqIFSharp.Extensions 5.2.2
  • Environment (Operating system, version and so on): Windows 11
  • .NET Framework version: .NET 10
  • Additional information: Found while planning editing and export in the ReqIF Viewer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions