Skip to content

Feature request : default values and required for object fields #3587

@AmbroiseCollon

Description

@AmbroiseCollon

Inspired from meteor.js technology, it could be a really valuable addition to add two properties to object fields :

  • Required boolean : if a required field is left empty, save operation crashes
  • Default values : if a field is not set, a default values can be selected

A field with a default value should be required. It would save a lot of dumb code in before and after save method.

Process could be like :

  1. Object is created
  2. Save method is called on object
  3. All fields are checked. For each field :
    a. if the object has already a value for the field => OK
    b. if the object has no value for the field :
    i. if field is not required => OK
    ii. if field is required :
    - if field has a default value => fill field with default value
    - if field has no default value => Error : field cannot be undefined

Maybe the easiest way to do this is to create meta collection aside from actual collection that owns all this required / default value data. But this is where my understanding of Parse Server behind the scenes stops.

What do you think ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions