Add support for validating None declared fields.
The services shouldn't allow more fields than expected when calling execute
class MyService(Service):
field_a = forms.CharField(...)
Call
MyService.execute({ 'field_y': 1, 'field_a'; 2 })
Expectations: Raises an exception
'Invalid field provided "field_y": Please provide one of the following fields: ({...})'
The base Service object inherits from django.forms.BaseForm. Django Forms allow you pass anything to the data attribute of __init__ . Making this change likely breaks backwards compatibility as the Service object no longer behaves as expected.
@jackton1 What's the use case for things being more restrict? Base an additional attribute of Service called strict_inputs that defaults to False for backwards compatibility would be an acceptable PR?
A common issue here has been running into a bug where the field key provided when invoking the service didn’t match the defined field name and there wasn’t any errors reported since the field wasn’t required.
@jackton1 makes sense - I think we'd have to add a new switch to indicate you wanted that behavior of strict inputs. Personally I know it would break some of the apps without it. How about a PR?