2 ms·
No. Field optionality and the content of values are server-side concerns that can be tested by making plain-old-Java method calls to the endpoint. The shape of
by stickfigure 3y ago
No. Field optionality and the content of values are server-side concerns that can be tested by making plain-old-Java method calls to the endpoint.
The shape of serialized JSON doesn't need more than simple verification. And if you just live with default serialization (ie java format is the same as json format), it probably doesn't need to be tested at all.
- javcasas 3y agoImagine an authentication endpoint that accepts either a username/password or a SSH key. If you go the optional fields route, your parser will accept invalid combinations, for example password+ssh key. If you go the proper alternatives way, then you need a parser with two branches that parses user/password in one way, or ssh key the other way. You tell me simple verification is enough, hence you either have a parser that accepts bad data, or deal only with simplistic data so that the parser can't have branches.