Skip to content

Predicate object cannot be optional? #374

@mihaimaruseac

Description

@mihaimaruseac

Hello,

I think I may be holding this wrong. In https://github.com/in-toto/attestation/blob/main/spec/v1/predicate.md it is said that the predicate itself can be missing:

plus an optional predicate JSON object containing additional, type-dependent parameters.

However, the Python constructor requires the predicate to be set:

def __init__(self, subjects: list, predicate_type: str, predicate: dict) -> None:

For my (very test-y, WIP-y) use case I don't currently have anything to put in the predicate, so I pass {}.

However, when I then do statement.validate(), it fails to validate due to

if len(self.pb.predicate) == 0:
raise ValueError("Predicate object required")

Should we always have something for the predicate? I was thinking that if I am able to record the subjects and don't have any additional metadata for my custom predicate I should be able to skip having to pass in a predicate object.

Happy to update documentation or code, depending on what is the desired path forward.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions