Skip to content

Model enum validation rules work properly

Sam Sehnert requested to merge features/model_enum_validation into master

What I did

  • Tweaked generated validation rules to correctly parse enum fields

Implications

Validation on ENUM fields will work properly using model API's.

Setup

None

Testing

  • Use a v2 model with an API (e.g., contact_model and /api/v1/contact/messages)
  • Add an ENUM field to the model (E.g., 'test' => 'enum("one","two") NOT NULL DEFAULT "one"')
  • Try POSTing a record to the API.
  • When the test field is set to something other than one of the enum options, you should get a validation error.
  • When the test field is set to one of the enum options, the save should succeed (all else being valid).

Task

https://app.gotasman.com/task/detail/42894

Merge request reports