-
Notifications
You must be signed in to change notification settings - Fork 8
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
Array of Enums produce incomplete/empty code #108
Comments
Thanks for opening an issue!, I see, this might be a missing feature, i did not see. will work and update on it. btw, in case you missed i replied to the last i ssue you made #107 thanks again |
Thank you! |
@pepie thanks for replying
we are limited by what the swagger api can offer, the reason for this is that if you have created an enum, "properties": {
"id": {
"default": "gen_random_uuid()",
"description": "Note:\nThis is a Primary Key.\u003Cpk/\u003E",
"format": "uuid",
"type": "string"
},
"col_mood": {
"enum": [
"happy",
"sad",
"neutral",
"excited",
"angry"
],
"format": "public.mood",
"type": "string"
},
"col_mood_array": {
"format": "public.mood[]",
"items": {
"type": "string"
},
// NO ENUM PROPERTY HERE
"type": "array"
}
},
"type": "object"
} Notice that we don't get the enum property here, so if we don't specify it we can't access it. this actually the reason on why it did nothing on your end. It's fine if the user doesn't use the enum type as an
Supadart HeaderAbout the Please try upgrading the cli and generating again. |
No worries. I'm sure you have a million more urgent things to get to. I appreciate your effort. The limitations you described make sense. |
v 1.6.7 looks good @mmvergara I can confirm the enum values are generated properly in both separated and single file mode (separated:false). I plan to implement the insert functions tonight and will likely create a few views. Thank you, again, for your work. |
Hello,
Thank you for this package, it is very helpful.
Supadart will produce invalid/incomplete code statements for tables with array of Enums. It seems to be unable to map the collection of enum values.
The code works as expected with an array of Strings (varchar) but fails for Enums. I suspect it might work fine for other primitive types, but I did not check.
Example:
Suppose we have an Enum for user groups defined as
we define a Profile table with a column that holds a list of group names:
This will generate a class for Profile with the following code snippet
notice the empty space between the semicolon and the comma - a missing expression for the column values. This code is incomplete and will break the app.
The code work as expected when user_groups is array of varchar:
will produce (as expected):
I've attached two screenshots for more context.
The text was updated successfully, but these errors were encountered: