Closed zvictor closed 5 months ago
Will have a look into it, but from first guess
There are ;
between type definition and value, which might not create the schema you like to get.
Should be this:
-- Define the schema for the Price object
DEFINE FIELD price.amount ON TABLE product TYPE number
VALUE <future> {
LET $lowest_vendor = (SELECT vendors[WHERE price.amount = math::min(vendors.*.price.amount)][0] FROM this);
$lowest_vendor.price.amount;
};
DEFINE FIELD price.currency ON TABLE product TYPE string
VALUE <future> {
LET $lowest_vendor = (SELECT vendors[WHERE price.amount = math::min(vendors.*.price.amount)][0] FROM this);
$lowest_vendor.price.currency;
};
But I think there is a issue - at least some error handling is missing
Thanks for the quick reply! I have tried the schema with the changes you wrote, but the output was the same.
Nonetheless, I can confirm that the fields in Surreal have been defined properly:
I'm working on the fix - hope to get it done today/tomorrow.
There is an issue during field type extraction, which is the root cause for the any()
I'm currently re-writing this functionality which should also bring some improvements
Version 2.1.0 is available.
Release-Notes:
https://github.com/sebastianwessel/surrealdb-client-generator/releases/tag/2.1.0
Several issues are fixed, and the generation should work in general.
If you like @zvictor , you can try it out. I did some small tests with your schema and it at least generated schemas, which are not only z.any()
. Also, the generation of the client should now be fixed.
Sorry, for the bugs, but it is sometimes really hard to keep up to date and everything working
Your commitment is impressive! I didn't expect my issue report to lead to such a considerable refactoring and in such a short time.
I'm super grateful for the attention you have put into it, but I wish you didn't apologize for the bug. Working with Open source can be very hard and ungrateful most of the time, so please don't let it consume the best of you ❤️
Nonetheless, thank you again for the work done. I'll test the release first thing tomorrow (It's 3am for me right now)
It works very well! Thank you so much!
I will later create another issue with a minor improvement suggestion, but in the meantime I will keep trying further, looking for more points to share with you.
I'm happy to get some feedback!
Thanks for creating this lib!
I have just given it a try and I am not sure I am getting the results I was supposed to.
This is the command I am running:
product.surql:
To my surprise:
z.any
.