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 extra constraints for field values #112

Open
Jotschi opened this issue Oct 30, 2017 · 0 comments
Open

Add extra constraints for field values #112

Jotschi opened this issue Oct 30, 2017 · 0 comments

Comments

@Jotschi
Copy link
Contributor

Jotschi commented Oct 30, 2017

It should be possible to add custom constraints for field values.

Add a constraints property to field schemas which contains the constraint parameters.

Types

  • min, max (for numbers and strings)
  • regex (for strings)
  • regexAlias (for strings, allows to use regex definitions shipped with mesh: e.g.: email)
  • match (constraint to match only a set of defined values)

Number field constraint

{
  "name" : "size",
  "label" : "Size",
  "constraints": {
     "min": 10,
     "max": 100,
     "match": [ 20, 30, 40 ]
  },
  "type" : "number"
}

String field constraint

{
  "name" : "title",
  "label" : "Title",
  "constraints": {
     "min": 10,
     "max": 255,
     "match": [ "Title A", "Title B", "Title C" ],
  },
  "type" : "number"
}

TODOs

  • Add validations in order to detect invalid constraints (e.g.: min,max + match makes no sense)

Questions

  • How to handle i18n values for match constraints?
@Jotschi Jotschi transferred this issue from gentics/mesh May 15, 2019
@Jotschi Jotschi added this to Backlog in Release 2.0 Planning Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

1 participant