yii2-openapi
yii2-openapi copied to clipboard
Bug gii/api generated rules: enum with trim
initial
- MariaDB
- "schema.yaml" with attribute, which has type "enum"
- this new attribute can be NULL !
reproduction steps
- execute
./yii gii/apito 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.
-
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.