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

Consider adding default values to attributes #180

Open
nandi95 opened this issue Jan 26, 2022 · 0 comments
Open

Consider adding default values to attributes #180

nandi95 opened this issue Jan 26, 2022 · 0 comments
Labels
enhancement New feature or request has workaround There is a way to achieve the aim

Comments

@nandi95
Copy link
Collaborator

nandi95 commented Jan 26, 2022

Search terms
attributes
default value

Is your feature request related to a problem? Please describe.
It isn't

Describe the solution you'd like
When defining a new model, the developer should have the option to define default values on the model. These defaults are sent to the server when saving the model so they should not be included in the original object when checking for changes

Describe how this would benefit the project/others
It would save the developer from having to pass in default values on constructing

Describe alternatives you've considered
none

Is there a currently a way to achieve this?

  • factories
  • custom user built method
  • an accessor
  • a custom caster

Additional context
Perhaps setting the attributes on the class definitely like public myAttribute = 1 would be the most intuitive given the current typing uses these attributes when set. This might be achieved by getting all the custom properties on the model which doesn't have getter and setter defined but a value.

Questions

  • Should these default values be passed to the accessors and should they be cast?
  • How should these default values be defined?
@nandi95 nandi95 added the enhancement New feature or request label Jan 26, 2022
@nandi95 nandi95 added the has workaround There is a way to achieve the aim label Jan 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request has workaround There is a way to achieve the aim
Projects
None yet
Development

No branches or pull requests

1 participant