It is pretty trivial to have a catch all function for things you don’t recognise and return a HTTP 400 error, that is left as an excercise for the reader, I just outlined a general approach. There was no mention of full santisation checking of JSON payloads. If that is needed then a JSON schema validator can be used.
I STRONGLY disagree that function matching in this instance is an anti pattern. It is not complex, and is matching the expectations provided in the original question.
Again I must say there were long threads about code smells being interpreted as holy scripture and lorded by dogmatic types, I hope the community doesn’t go down this path as I support guidance but not dogma.
PATTERN MATCHING ON EXPECTATIONS IS GOOD






















