yii2-openapi
yii2-openapi copied to clipboard
For ENUM colums, existing column gets an update which removes the "string type"
https://github.com/cebe/yii2-openapi/issues/100#issuecomment-1135982903
this should already be fixed by #103
Enum behaviour will likely to be changed:
Currently we provide x-db-type for enum fields/columns.
Enum is not a real data type in Pgsql
Ideally we provide x-db-type when we have more than one way to store same data. E.g. time: we can store it as timestamp or datetime string.
For enum no matter what database we use, we store it as corresponding enum way. There is no more than one way to store enum values in DB.
Changes I will implement for enum if there is a enum field in yml:
- if we provide
x-db-typean error will be thrown that settingx-db-typehas no effect and should be avoided. For enum fields yii2-openapi lib will automatically create enum column/type depending on the DB type
Incorrect:
lang:
type: string
x-db-type: enum
enum:
- ru
- eng
Correct:
lang:
type: string
enum:
- ru
- eng
@cebe please comment if there is anything wrong with above approach.
@SOHELAHMED7 I'm gernerally fine with that solution.
This issue can be closed.