Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add default property into response model #187

Open
wants to merge 1 commit into
base: 1.3
Choose a base branch
from

Conversation

garrettrathbone
Copy link

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.

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
Copy link
Author

This is related to issue #188

Copy link
Member

@GrahamCampbell GrahamCampbell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. I'd consider this with some tests. I think we also need to update the other locations, too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants