yii2-openapi icon indicating copy to clipboard operation
yii2-openapi copied to clipboard

Bug gii/api generated rules: enum with trim

Open siggi-k opened this issue 1 year ago • 0 comments

initial

  • MariaDB
  • "schema.yaml" with attribute, which has type "enum" schema yaml
  • this new attribute can be NULL !

reproduction steps

  • execute ./yii gii/api to generate code and update model

bug

  • attribute is treated as a type string by applying trim in the function rules in abstract class from model. rules

  • this means that if the attribute was not passed and is therefore NULL, it becomes an empty string due to the validation. This in turn means that it cannot be saved as it is an enum.

siggi-k avatar Jan 09 '24 11:01 siggi-k