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

Fix validations for custom field types #8297

Merged

Conversation

sam899
Copy link
Contributor

@sam899 sam899 commented Oct 12, 2020

Fixes #8294

With the new draft/publish system, models with custom field types could no longer be saved.
(Custom field types described here)

When trying to create or update a model with an un-handled attribute type, the API would give a 500 internal server error, as no validator exists for this attribute type.

This PR handles the case where a custom validator is not available for a specific attribute type, and instead of throwing an error, falls back to using a mixed type validator.

@sam899 sam899 requested a review from a team as a code owner October 12, 2020 14:57
Signed-off-by: Sam Williams <spwilliams91@icloud.com>
@codecov
Copy link

codecov bot commented Oct 12, 2020

Codecov Report

Merging #8297 into master will increase coverage by 0.00%.
The diff coverage is 75.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #8297   +/-   ##
=======================================
  Coverage   33.04%   33.05%           
=======================================
  Files        1219     1219           
  Lines       13573    13576    +3     
  Branches     1348     1350    +2     
=======================================
+ Hits         4485     4487    +2     
  Misses       8206     8206           
- Partials      882      883    +1     
Flag Coverage Δ
#front 24.70% <0.00%> (-0.01%) ⬇️
#unit 54.15% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...-manager/admin/src/components/InputUID/InputUID.js 0.00% <0.00%> (ø)
...ent-manager/admin/src/components/InputUID/index.js 0.00% <ø> (ø)
...ages/strapi/lib/services/entity-validator/index.js 55.17% <100.00%> (+1.05%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ba9711d...92b71d1. Read the comment docs.

Copy link
Contributor

@petersg83 petersg83 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks ! :)

@petersg83 petersg83 added source: core:strapi Source is core/strapi package issue: bug Issue reporting a bug labels Oct 12, 2020
@petersg83 petersg83 added this to the 3.2.4 milestone Oct 12, 2020
@alexandrebodin alexandrebodin merged commit 96a33ed into strapi:master Oct 12, 2020

const input = { uuid: '2479d6d7-2497-478d-8a34-a9e8ce45f8a7' };

expect.hasAssertions();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: bug Issue reporting a bug source: core:strapi Source is core/strapi package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UUID attribute type failing validation check on Create and Update.
3 participants