NASA-AMMOS / aerie

A software framework for modeling spacecraft.
https://nasa-ammos.github.io/aerie-docs/
MIT License
68 stars 19 forks source link

Native Support for Optional Type Value Schema #1308

Open Alexander-Da-Great opened 8 months ago

Alexander-Da-Great commented 8 months ago

Checked for duplicates

Yes - I've already checked

Alternatives considered

Yes - and alternatives don't suffice

Related problems

In the clipper-merlin adaptation of aerie we define custom value mappers for Optional Types. The value schema for this value mapper is a struct containing two elements: "present" and "value". "Present" has a ValueSchema of a boolean and "value" whatever is returned from a getValueSchema() call on a valueMapper we ingest in the constructor for OptionalValueMapper. Our issue is we want to support any valueSchema for "value" when "present" is true, however, if it is false we would like to override whatever the valueSchema might return for "value" and instead enforce the entry as being null. This functionality will allow UI entry of optional type parameters to better reflect the underlying information stored in the java Optional object.

Related to this issue.

Describe the feature request

The feature request to solve the issue mentioned above would be the creation of a new OptionalValueSchema for aerie. This value schema would still provide some kind of Boolean element to select whether the parameter is "present" or not, however, in the event that this present flag is false we would like the "value" to always be null.

parkerabercrombie commented 8 months ago

To re-state the problem: we would like support optional activity parameters. Clipper wrote a custom value mapper for the java.util.Optional type, but we'e run into a number of problems trying to use that in schedule eDSL. It would be useful to have native support for optional parameters.