Skip to content

Allow hashtable document definitions #85

Open
@OldSneerJaw

Description

@OldSneerJaw

Currently every document type is presumed to use the object validation type, where each property's name and type is known beforehand. However, there may be cases where it is useful to use hashtable validation for a particular document type so that the property/key names don't need to be known beforehand while still providing the flexibility to perform validation on the property values.

For example (not to be considered final):

myDocType: {
  typeFilter: ...
  channels: ...
  type: 'hashtable',
  hashtableKeysValidator: {
    regexPattern: /^\w+$/
  },
  hashtableElementsValidator: {
    type: 'integer',
    required: true,
    minimumValue: 0
  }
}

For the sake of backward compatibility, the default validation type for documents should continue to be object.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions