Partial serialization
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 38/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- java
- Domain
- backend-api-design
Research direction
Start by tracing ObjectMapper creation and custom serializer registration in AbstractBomGenerator, its implementations, and the Parser implementations. Review how serialization and deserialization are currently configured per Version, then define the public accessor and caching behavior. Done means partial BOM objects can use the same configured mapper and repeated document loops do not create redundant ObjectMapper instances.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- Java
- Stars
- 124
- Forks
- 97
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 11
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from CycloneDX/cyclonedx-core-java
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
CycloneDX/cyclonedx-core-java#1002 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
CycloneDX/cyclonedx-core-java#1001 ·
Maintainers usually reply within 2 days
-
`license-mapping.json` maps classpath-exception license names to the deprecated SPDX id `GPL-2.0-with-classpath-exception`Possibly taken @afalhambra-hivemq claimed this 5 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 35/100
CycloneDX/cyclonedx-core-java#998 ·
Maintainers usually reply within 2 days
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
CycloneDX/cyclonedx-core-java#902 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 58/100
CycloneDX/cyclonedx-core-java#848 ·
Maintainers usually reply within 2 days
All issues in CycloneDX/cyclonedx-core-java
Similar issues
-
crash
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Modern `HttpServletMcpTransport` does not check `Mcp-Name` when `params.name` or `params.uri` is not a JSON stringPossibly taken @starryeye claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
modelcontextprotocol/java-sdk#1352 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
account bug course exam iris lecture
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day