Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Partial serialization

未关闭
#838 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
38/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
冷清
技术栈
java

调研方向

首先追踪 AbstractBomGenerator、其实现以及 Parser 实现中的 ObjectMapper 创建和自定义 serializer 注册。检查当前每个 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
派生
92
平均合并
1 天 11 小时
30 天内合并 PR
36

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

CycloneDX/cyclonedx-core-java 的其他 Issue

查看 CycloneDX/cyclonedx-core-java 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。