trompamusic/ce-api

Use PropertyValueSpecification.defaultValue in RequestControlAction

Closed this issue · 3 comments

if there is a PropertyValueSpecification that has a defaultValue set, and this Property is not specified in the propertyValueObject section of the RequestControlAction mutation, then a PropertyValue should still be created with the default value.

Additional question - if a PropertyValueSpecification is required, but has a defautlValue, should it be required to set a value in RequestControlAction?

Our proposed behaviour is:

  • valueRequired: false, defaultValue: ‘low priority’, inputValue: missing = use default value
  • valueRequired: false, defaultValue: ‘low priority’, inputValue: provided but undefined = set to undefined
  • valueRequired: false, defaultValue: ‘low priority’, inputValue: ‘high priority’ = use input value
  • valueRequired: false, defaultValue: undefined, inputValue: missing = don't create node
  • valueRequired: false, defaultValue: undefined, inputValue: ‘high priority’ = use input value
  • valueRequired: true, defaultValue: ‘low priority’, inputValue: missing = use default value
  • valueRequired: true, defaultValue: ‘low priority’, inputValue: provided but undefined = error?
  • valueRequired: true, defaultValue: ‘low priority’, inputValue: ‘high priority’ = use input value
  • valueRequired: true, defaultValue: undefined, inputValue: missing = error!
  • valueRequired: true, defaultValue: undefined, inputValue: provided but undefined = error!
  • valueRequired: true, defaultValue: undefined, inputValue: ‘low priority’ = use input value

I would decouple this from the target values range, and define this for any x,y. I.e.

valueRequired: false, defaultValue: x, inputValue: missing = return x
valueRequired: false, defaultValue: x, inputValue: y = return y
valueRequired: false, defaultValue: undefined, inputValue: undefined =don't create node
valueRequired: false, defaultValue: undefined, inputValue: y = return y
valueRequired: true, defaultValue: x, inputValue: missing = return x
valueRequired: true, defaultValue: x, inputValue: y = return y
valueRequired: true, defaultValue: undefined, inputValue: missing = error
valueRequired: true, defaultValue: undefined, inputValue: y = return y / or error (TBD)

Regarding the last two cases, I'd prefer

valueRequired: true, defaultValue: undefined , inputValue: any --> error, during the node creation, i.e. require a default value if valueRequired=true