Discussion: How to handle extensions
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 71
- Forks
- 44
- Avg merge
- 12h 54m
- Merged PRs (30d)
- 7
Description
This is a spin-off issue from #302 which discusses 2 issues focused on how to support Extension subclasses.
According to the SPDX AIPackage specification an optional property field is extension. This field is of type Extension.
Extension is an abstract class so it can't be instantiated.
Referencing an Extension in the JSON-LD without parameters passes the Java coded validation but fails the JSON schema validation (see related https://github.com/spdx/spdx-3-model/issues/1017):
"extension" : [
{
"type" : "extension_Extension"
}
]
Adding a parameter:
"extension" : [
{
"type" : "extension_Extension",
"randomProperty" : "test"
}
]
causes the Java parser to fail with Analysis exception processing SPDX file: No property descriptor for field randomProperty.
Adding any additional type will also cause the Java code to fail.
Is there an approach where we can allow Extensions in the Java library?
Contributor 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.
Research direction
Start with the SPDX AIPackage specification and the JSON-LD examples in this issue, then trace the Java parser and JSON schema validation paths that process the extension field. Compare how an abstract Extension is represented and identify the project constraints that must be resolved. Done means an agreed approach for allowing Extensions without the current validation or property-descriptor failures.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100