Skip to content
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

Data validation fail on reference data model has no feedback on main view #9176

Closed
3 tasks done
jianliao opened this issue Oct 26, 2021 · 6 comments · Fixed by #12001
Closed
3 tasks done

Data validation fail on reference data model has no feedback on main view #9176

jianliao opened this issue Oct 26, 2021 · 6 comments · Fixed by #12001

Comments

@jianliao
Copy link
Contributor

jianliao commented Oct 26, 2021

Preflight Checklist

Describe the Bug

  1. Main data model is referenced to another data model through M2A.
  2. On referenced data model, it has two fields are required
  3. When user create a invalid referenced data model instance through drawer, save operation on main data model would not show the data validation fail alert, but observed 400 bad request in browser console.

To Reproduce

Oct-26-2021.13-09-09.mp4

Errors Shown

Extracted below error json response from Chrome debug console.

{
   "errors":[
      {
         "message":"\"text\" is required",
         "extensions":{
            "code":"FAILED_VALIDATION",
            "field":"text",
            "type":"required"
         }
      },
      {
         "message":"\"link\" is required",
         "extensions":{
            "code":"FAILED_VALIDATION",
            "field":"link",
            "type":"required"
         }
      }
   ]
}

What version of Directus are you using?

9.0.0-rc.99

What version of Node.js are you using?

16.10.0

What database are you using?

Postgres 10

What browser are you using?

Chrome

What operating system are you using?

Chrome

How are you deploying Directus?

Docker

@ulvidamirli
Copy link

ulvidamirli commented Oct 26, 2021

I have the same issue but my error is :

extensions: {code: "RECORD_NOT_UNIQUE", collection: "item_credits", field: "id", invalid: "6"}
message: "Field \"id\" has to be unique."

What it tries to POST is data without ID field:
{"type":"A1","amount":44}

After unhiding the ID column, I saw the Auto-increment feature doesn't work (it leaves it blank). And it turns red by showing error under.

I'm using the latest version. I upload data with an automated python script directly to DB with raw SQL. But as I said, trying it manually through Directus doesn't work.

Didn't find any solution yet :/

@rijkvanzanten
Copy link
Member

@ulvidamirli I think your particular issue is caused by the fact that you didn't reset the auto-increment sequence when you imported existing values straight to the database 🙂

@ulvidamirli
Copy link

reset the auto-increment

Thank you for pointing out the cause of the issue. It helped me out.

I used this SQL query to make it work again (in case somebody else gets into this issue):
SELECT SETVAL(pg_get_serial_sequence('table_name', 'column_name'), (SELECT MAX(column_name) FROM table_name));

@martijn-dev
Copy link

Could this issue be related (or being a duplicate) of this issue?
#9006

@u12206050
Copy link
Contributor

I have the same issue, whereby I have a uniqueness on two columns that I implemented in mysql using
ALTER TABLE scansADD UNIQUEticket (activity, person);
However in Directus when I try saving I do not get any feed back in the UI, have to open up console and look at network response to see this:

Screenshot 2021-11-10 at 10 26 29

@jianliao
Copy link
Contributor Author

jianliao commented Mar 3, 2022

Hi,
Is there any update on this issue? I am still able to reproduce this issue on the latest v9.5.2.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants