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

Relationship required-but-non-localized field validation error when updating global through API #2766

Closed
qbeauperin opened this issue Jun 2, 2023 · 5 comments · Fixed by #2776
Assignees
Labels
status: needs-triage Possible bug which hasn't been reproduced yet

Comments

@qbeauperin
Copy link
Contributor

qbeauperin commented Jun 2, 2023

Link to reproduction

https://github.com/qbeauperin/payload/blob/bug/global-localization-required-field/test/localization/config.ts

To Reproduce

  • run payload with this config ^
  • go to the "Required Relationship Global" global, and add content in English
  • run the following code to try and update Spanish through the API:
const response = fetch("http://localhost:3000/api/globals/required-relationship-global?locale=es", { method: 'POST', headers: { 'Content-Type': 'application/json', }, cache: 'no-cache', body: JSON.stringify({text: "some different Spanish text"}) });
  • notice how it returns a validation error: The following field is invalid: nonLocalizedRequiredRelationship

Describe the Bug

On the other hand, the exact same config has been duplicated in a collection and work as expected:

  • create a new item in the "Required Relationship Collection" collection and add content in English
  • run the following code to try and update Spanish through the API:
const response = fetch("http://localhost:3000/api/required-relationship-collection/[yourdocidgoeshere]?locale=es", { method: 'PATCH', headers: { 'Content-Type': 'application/json', }, cache: 'no-cache', body: JSON.stringify({text: "some different Spanish text"}) });
  • notice how the update went through properly

Payload Version

1.8.5

@qbeauperin qbeauperin added the status: needs-triage Possible bug which hasn't been reproduced yet label Jun 2, 2023
@JarrodMFlesch
Copy link
Contributor

Hey @qbeauperin! This has been reported (just linking for clarity, not like you would have known) here. You can install 1.8.4-canary.2 to get the fix, or wait until 1.8.4 is released 👍

@JarrodMFlesch
Copy link
Contributor

Wow. Long day, closed the wrong issue. 😵‍💫

@JarrodMFlesch JarrodMFlesch reopened this Jun 2, 2023
@qbeauperin
Copy link
Contributor Author

Oh sweet, I'll pull 1.8.4 right now and test it out. Thanks Jarrod! 😄

@qbeauperin
Copy link
Contributor Author

qbeauperin commented Jun 3, 2023

Issue still occurs in 1.8.4 unfortunately, same repro steps. 😢

Edit: not sure if 1.8.5 was aimed at this, but still occurs unfortunately.

@jacobsfletch
Copy link
Member

@qbeauperin wow good catch here. THANK YOU for your detailed report, too. I was able to clone down your repository and easily recreate the bug. I've got the fix in PR #2776 which will go out in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs-triage Possible bug which hasn't been reproduced yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants