Skip to content

Set to private property FieldValidationResult.key #41

@nasdan

Description

@nasdan

Right now, we have:

export class FieldValidationResult {
  key: string;
  type: string;
  succeeded: boolean;
  errorMessage: string;

  constructor() {
    this.key = '';
    this.type = '';
    this.succeeded = false;
    this.errorMessage = '';
  }
}

When a user has to create validation function that resolve a FieldValidationResult, he has to provide an empty key property:

e.g:

./requiredValidation.ts

export const required => (vm, value) : FieldValidationResult => {
  return {
    key: '',
    type : 'REQUIRED',
    succeeded : (value && value.length > 0),
    errorMessage : 'Mandatory field',
  }
}

I think key property should be a private property because it's only used internally

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions