Skip to content

[Feat]: Clarify nullability and optionality of the spec API #506

@jmesnil

Description

@jmesnil

Is your feature request related to a problem? Please describe.

The spec API is not consistent with this expectation for the nullability and optionality of objects.

For example, the Task class
will always instantiate its history and artifact with (potentially empty) collections while its metatada can be null.
The API should be consistent unless there is a good reason not to.
In that case, the metadata should also be an empty Map if the parameter is null.

For case where we want to record that a field can have a value or be null, we could also leverage Optional.
For example, in TaskStatus, the message is optional. We could make its type Optional<String> to constrain its contract.

Describe the solution you'd like

Update the spec API to:

  • be consistent with the nullabitity of fields (especially collections)
  • use the Optional type for optional fields
  • update the javadoc when there is exception to this general rule

Describe alternatives you've considered

No response

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions