DEV Community


Discussion on: Consuming APIs in Angular – The Model-Adapter Pattern

florimondmanca profile image
Florimond Manca Author

Yep, this pattern won’t validate the JSON data you receive. In fact, unless you implement error handling it will probably result in errors if the data doesn’t fit the adapter (eg providing a value that cannot be converted to a Date).
It’s simply that this pattern is only applicable if you know exactly the schema of the data you’re going to receive (that is, you built the API or have thorough documentation about its data format).
So good point for mentioning this limitation and providing resources to implement actual validation. :)

Forem Open with the Forem app