As you know we’ve migrated from forest-express-sequelize to @forestadmin/agent.
I think we spot some additional bug on your side let me explain the thing.
We have a sequelize model called Coupon with a number of fields. And we also have one (or more) sequelize virtual fields in this model.
In forest this model is a collection.
And this collection has the built in “create” new record feature.
This correctly used to work with the old forest-express-sequelize agent.
With the new agent @forestadmin/agent this throws an error:
The above comes from the .forestadmin-schema.json, which does not contain the isValid sequelize virtual field.
Therefore, an error is raised, up to the forest interface. Because you are doing an Object.fromEntries upon the sequelize fields (including virtual fields). But in the forest collection fields you don’t have the virtual fields, so this throws an error with the virtual fields, that you should skip.
It seems we might not be supporting virtual fields from Sequelize, which could explain why the field isn’t included in the Forest Admin schema. When you start the server, do you see a warning log like this: “Skipping column 'coupon.isValid …”?
That said, it’s a bit odd because the isValid field appears to be present when a create action is triggered. Are you perhaps using an older layout built with a different agent?
If you want to integrate your isValid field, you can probably duplicate or re-use your “get” definition to our addField method to create a forest virtual field.
I can send you the screenshots privately if you need. I’m undisclosing the field names here
Are you perhaps using an older layout built with a different agent?
Yes, of course! We’ve recently migrated from forest-express-sequelize to @forestadmin/agent thus all the layouts have been created in the past, with the old agent.
If you want to integrate your isValid field, you can probably duplicate or re-use your “get” definition to our addField method to create a forest virtual field.
No I don’t want to integrate this field. It’s not exported to Forest and we’re ok with this.
We just need to be able to create a new Coupon…
My question is: why you find this field when you iterate though the record fields with Object.entries in @forestadmin/datasource-customizer in BinaryCollectionDecorator.convertRecord method?
why you find this field when you iterate though the record fields with Object.entries in @forestadmin/datasource-customizer in BinaryCollectionDecorator.convertRecord method?
Before to try to reproduce the bug on my end, can you inspect the http request sent when you try to create the Coupon from your forestadmin and check if there is the isValid field please because I suspect an issue from the front ?
Hi @Alban_Bertolini
I apologise for my late answer. We had an internal event and was fully absorbed by it
Before to try to reproduce the bug on my end, can you inspect the http request sent when you try to create the Coupon from your forestadmin and check if there is the isValid field please because I suspect an issue from the front ?
By inspecting the payload of the request sent from the browser I don’t see the isValid field.
I can only see the fields I filled in (I only filled in the mandatory fields).