Migration to `@forestadmin/agent` - sequelize model validations are not enforced any more

We’re migrating from forest-express-sequelize to @forestadmin/agent.

With the previous agent, we used to rely on Sequelize field validations to get an instant feedback in the forest UI for the fields whose values were not correct.

But now, in the new agent, validations from the sequelize model are not reflected in the forestadmin-schema as they were before.

As per this doc, the only validations that are brought are not-null and length.

Previously, a bigger set of validations was reported correctly. Eg: min and max:

image (45)

But right now this very same validation (from the very same model) is ignored:
image (46)

This is the model definition:
image (47)

It looks like in your new implementation we’re supposed to manually implement the validation with the tools exposed by the new agent.
But you can easily understand that we’re not this happy about duplicating the validations in different parts of the code base.

Why aren’t you supporting these validations any more?
May you please tell which is the correct way to have these UI validations in place, without duplicating code (in the model and with the forest agent)?

Thank you in advance,
Matteo

Here is the “meta” section of the forest admin schema file:

  {
    "liana": "forest-nodejs-agent",
    "liana_version": "1.41.7",
    "liana_features": null,
    "stack": {"engine": "nodejs", "engine_version": "20.11.1"}
  }

and from package.json:

"sequelize": "^6.28.0"

cc @julien.jolles

Hi @Matteo,

I’m asking my teammates on the matter :slight_smile:
I’ll let you know once I have more information

1 Like

Hey @Matteo,

I just want to let you know that we’ve opened a bug on our side. We will let you know once a fix has been released :wink:

1 Like

Hello @Matteo,

We release a version of @forestadmin/datasource-sequelize (v1.9.0) implementing the validation for a few sequelize validators (the same as v1).

Let us know if it fit your need. :pray:

Kind regards,
Morgan

4 Likes

@morganperre this is a perfect fit!
Thank you
Matteo

4 Likes

Awesome :muscle: You’re welcome.

Morgan