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
add media attribute validator #14670
Conversation
Codecov ReportBase: 58.41% // Head: 58.42% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #14670 +/- ##
==========================================
+ Coverage 58.41% 58.42% +0.01%
==========================================
Files 1545 1546 +1
Lines 38203 38229 +26
Branches 7514 7517 +3
==========================================
+ Hits 22315 22337 +22
- Misses 13595 13599 +4
Partials 2293 2293
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 🙂
Interesting, I need to take the time to look at it as media are relations and we don't enforce "required" on relations. So I wonder what is currently done with media and what needs to be done. |
That is a good point, and I think this is more of a product decision that was taken when we let users select media as required. |
After further discussions, we have agreed to push this forward in order to be consistent with how the CM works. |
I think we should rename the test file now to a |
@jhoward1994 good catch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍🏻
👋🏻 What does it do?
You could create an entity via the REST API with an empty media attribute that was required.
Now it will be required and you will receive a 400 Validation error.
🧪 How to test it?
Very well explained in #14648.
Example Content Type Schema
Example Request
POST http://localhost:1337/api/tests🔍 Expected behavior
Scenario 1: Single media attribute
And I create it without the media attribute
Scenario 2: Multiple media attribute
And I create it without the multiple media attribute
🔗Related issue(s)/PR(s)
#14648