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.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add default property into response model

garrettrathbone opened this issue · comments

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.

Pull Request made here. #187