guzzle / guzzle-services

Provides an implementation of the Guzzle Command library that uses Guzzle service descriptions to describe web services, serialize requests, and parse responses into easy to use model structures.
MIT License
253 stars 78 forks source link

Add default property into response model #187

Open garrettrathbone opened 1 year ago

garrettrathbone commented 1 year ago

Currently, if a property that is in the model doesn't exist in the returned results set, it returns nothing, regardless of if a default is provided or not. It seems rational to not return a value in the model that doesn't exist, which allows someone to understand what is coming from the API or not. But I think there are benefits to allowing someone to set default on a property and allow the model to return that in the situation that the value wasn't set in the original response. By checking whether a default is set in general, regardless of if it is truthy, falsey, or whatever else, this supports backwards compatibility with the option to 'opt in' to setting a default for a property.

garrettrathbone commented 1 year ago

This is related to issue https://github.com/guzzle/guzzle-services/issues/188