Skip to content

Implement SpdxObject Protocol type#50

Closed
bact wants to merge 5 commits into
spdx:mainfrom
bact:protocol
Closed

Implement SpdxObject Protocol type#50
bact wants to merge 5 commits into
spdx:mainfrom
bact:protocol

Conversation

@bact

@bact bact commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Implement SpdxObject as a Protocol structural type that will allow creation of SPDX version-agnostic signature of functions.

Per-version generated bindings mean v3_0_1.SHACLObject and v3_1.SHACLObject are distinct nominal types.

To resolve #45

(Note: the generated Go binding from shacl2code use structural type natively (using interface), so it doesn't have this cross-version typing issue. Python Protocol is similar to Go interface; alternatively, we can propose shacl2code to adopt Go pattern for Python, let Python binding use Protocol directly)

Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
@bact bact added the enhancement New feature or request label Jun 26, 2026
@bact bact marked this pull request as draft June 26, 2026 17:01
bact added 3 commits June 26, 2026 19:06
Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
@bact

bact commented Jun 27, 2026

Copy link
Copy Markdown
Collaborator Author

Looks like it is probably make more sense to implement this upstream in shacl2code. The issue is not SPDX-specific. We can learn from at Go binding generation template.

Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
@bact

bact commented Jun 28, 2026

Copy link
Copy Markdown
Collaborator Author

Close this PR.

Revising the implementation into two parts:

  1. per-version protocol generations, one protocol per class - it is easier to do this in shacl2code as we can access model information directly from there (will proposed in shacl2code)
  2. version-agnostic protocol that merge all versions together - makes more sense to do it here (spdx-python-model) as, at the generation time, shacl2code has no idea about other versions

@bact bact closed this Jun 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider implement Protocol type for v3_x.SHACLObjectSet

1 participant