An API client can represent message payloads as maps or dictionaries rather than typed classes. It serializes outgoing messages and deserializes incoming ones according to the service schema. For text-based payloads, this is one option alongside handwritten or generated classes and service-provided libraries. section 8.1.7
When choosing a DTO strategy, consider:
- Development and maintenance effort as the API evolves. section 8.1.7
- Conformance to the API schema and compile-time type checks. section 8.1.7
- Whether the client models only relevant API fields and ignores the rest. section 8.1.7
Figure 8.3 An API client must have a data model of the messages that it exchanges with the service. The data model must serialize and deserialize correctly as defined by the schema. It can either be untyped (e.g. hash maps) or consist of handwritten or code-generated classes.
Compare untyped payload structures with handwritten and generated classes as API-client data models. section 8.1.7
