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

**URL:** <https://community.forestadmin.com/t/migration-to-forestadmin-agent-sequelize-model-validations-are-not-enforced-any-more/7414>\
**Category:** Help me!\
**Tags:** validation, sequelize, migration-to-agentv2\
**Created:** [August 22, 2024, 1:27pm UTC](https://community.forestadmin.com/t/migration-to-forestadmin-agent-sequelize-model-validations-are-not-enforced-any-more/7414 "2024-08-22T13:27:08Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matteo](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/matteo/32/75_2.png) [@Matteo](https://community.forestadmin.com/u/Matteo)\
**Post date:** [August 22, 2024, 1:27pm UTC](https://community.forestadmin.com/t/migration-to-forestadmin-agent-sequelize-model-validations-are-not-enforced-any-more/7414/1 "2024-08-22T13:27:08Z")

</div>

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](https://docs.forestadmin.com/developer-guide-agents-nodejs/agent-customization/fields/validation), 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)](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/e/e8ff438341aea600473cc1f81bd9ec285651d63e.png)

But right now this very same validation (from the very same model) is ignored:  
 ![image (46)](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/1/176efb4413147f081e3702b4a052be558f2fbd9a.png)

This is the model definition:  
 ![image (47)](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/0/0b2013e1a0b49935464e3591d75f60fa1fbad607.png)

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:

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

```

and from `package.json`:

```javascript
"sequelize": "^6.28.0"

```

cc @julien.jolles

---

<div class="post-metadata">

**Author:** ![anon62739609](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@anon62739609](https://community.forestadmin.com/u/anon62739609)\
**Post date:** [August 26, 2024, 1:24pm UTC](https://community.forestadmin.com/t/migration-to-forestadmin-agent-sequelize-model-validations-are-not-enforced-any-more/7414/2 "2024-08-26T13:24:46Z")

</div>

Hi @Matteo,

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

---

<div class="post-metadata">

**Author:** ![anon62739609](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@anon62739609](https://community.forestadmin.com/u/anon62739609)\
**Post date:** [August 28, 2024, 12:07pm UTC](https://community.forestadmin.com/t/migration-to-forestadmin-agent-sequelize-model-validations-are-not-enforced-any-more/7414/3 "2024-08-28T12:07:47Z")

</div>

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 😉

---

<div class="post-metadata">

**Author:** ![morganperre](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/morganperre/32/1296_2.png) [@morganperre](https://community.forestadmin.com/u/morganperre)\
**Post date:** [August 29, 2024, 2:32pm UTC](https://community.forestadmin.com/t/migration-to-forestadmin-agent-sequelize-model-validations-are-not-enforced-any-more/7414/4 "2024-08-29T14:32:09Z")

</div>

Hello @Matteo,

We release a version of [@forestadmin/datasource-sequelize (v1.9.0)](https://www.npmjs.com/package/@forestadmin/datasource-sequelize/v/1.9.0) implementing the validation for a few sequelize validators (the same as v1).

Let us know if it fit your need. 🙏

Kind regards,  
Morgan

---

<div class="post-metadata">

**Author:** ![Matteo](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/matteo/32/75_2.png) [@Matteo](https://community.forestadmin.com/u/Matteo)\
**Post date:** [August 30, 2024, 1:14pm UTC](https://community.forestadmin.com/t/migration-to-forestadmin-agent-sequelize-model-validations-are-not-enforced-any-more/7414/5 "2024-08-30T13:14:33Z")

</div>

@morganperre this is a perfect fit!  
Thank you  
Matteo

---

<div class="post-metadata">

**Author:** ![morganperre](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/morganperre/32/1296_2.png) [@morganperre](https://community.forestadmin.com/u/morganperre)\
**Post date:** [September 2, 2024, 1:40pm UTC](https://community.forestadmin.com/t/migration-to-forestadmin-agent-sequelize-model-validations-are-not-enforced-any-more/7414/6 "2024-09-02T13:40:37Z")

</div>

Awesome 💪 You’re welcome.

Morgan
