liveBook · Manning

Untyped data model

As explained in Microservices Patterns, Second Edition

An untyped data model represents message payloads with dynamically structured maps or dictionaries rather than statically modeled classes.

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.
defining api client dtos

Compare untyped payload structures with handwritten and generated classes as API-client data models. section 8.1.7

How Microservices Patterns, Second Edition covers it

How deep it goes
Defines the map-or-dictionary approach and lists DTO selection factors without detailing its implementation.
Examples
Uses maps and dictionaries as examples of untyped message structures.
What you can do after
Evaluate DTO strategies against development effort, schema correctness, type safety, and design-time coupling.
How it connects
Connects API clients with DTOs, message serialization, deserialization, and API schemas.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Microservices Patterns, Second Edition. The section links point to the parts of the book it draws on.