Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Partial serialization

オープン
#838 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
38/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か
技術スタック
java

調査の方向性

まず、AbstractBomGenerator、その実装、および Parser の実装における ObjectMapper の作成とカスタムシリアライザーの登録を追跡します。現在、各 Version でシリアライズとデシリアライズがどのように設定されているかを確認し、続いて public accessor とキャッシュの動作を定義します。部分的な BOM オブジェクトが同じ設定済み mapper を使用でき、ドキュメントのループを繰り返しても冗長な ObjectMapper インスタンスが作成されなければ完了です。

索引モデルが issue の本文から書いたものです。

説明

Currently the AbstractBomGenerator and it's implementations use several custom serializers, which are registered in an always new ObjectMapper.

Handling partial serialization of a BOM is not cleanly possible (e.g. serializing a single vulnerability or a list of components), since the ObjectMapper is not exposed and the AbstractBomGenerator signatures do not match. The only way of achieving this, while serializing exactly as this reference implementation is either using reflection hacks or by full on copy pasting the code.

Additionally, the Jackson ObjectMapper isn't a lightweight object. For a simple parse-modify-writeback loop of a cyclonedx document two separate ObjectMappers are created on every such loop, which is fully unnecessary.

Feature request / proposal:

  • Decouple ObjectMapper creation and configuration from AbstractBomGenerator and Parser implementations
  • Expose the ObjectMapper in a public accessor
  • While at it, memorize/cache the ObjectMapper instance per Version, so that a single instance of an ObjectMapper is used for serialization and deserialization

Benefits of the change:

  • enables partial serialization of BOMs and cleanly working directly with document parts.
  • reduces / stabilizes memory footprint when (de-)serializing multiple documents
  • improves performance when (de-)serializing from the second document onward (when the ObjectMapper has been created)

Context of this request:
I'm currently working on a private project (private for now, currently too raw / alpha) which stores and queries CycloneDX. I'm heavily using Postgres JSONB support, and being able to properly work with partial objects is a requirement for me.

Is there interest in a feature like that? I'll build that for myself anyway, but having it integrated in the core lib would be cleaner for me, and might benefit a few other people, so I gladly can make a PR.
Just wanted to ask before dropping a rather big change out of the blue.

主要言語
Java
スター
122
フォーク
93
平均マージ
1日 11時間
マージ済み PR(30日)
36

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

CycloneDX/cyclonedx-core-java のほかの issue

CycloneDX/cyclonedx-core-java の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。