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: attributeValue validator should ignore empty string #15262

Merged
merged 1 commit into from
Oct 3, 2023

Conversation

vietnguyen
Copy link
Contributor

@vietnguyen vietnguyen commented Sep 29, 2023

https://dhis2.atlassian.net/browse/DHIS2-15860

Summary

  • Currently metadata attribute values are validated by MandatoryAttributesCheck even when they are an empty string.
  • AttributeValidator should ignore empty string. We already have MandatoryAttributesCheck to validate mandatory attributes.
  • If user post an empty string for an attribute value which is not mandatory then the existing value will be deleted.

Test

  • Add a new Attribute type Email, assign it to User.
  • Create or update a User, leave the email attribute blank.
  • Expected: create or update User successfully. If updating then existing attribute value is deleted.

@vietnguyen vietnguyen changed the title fix: attributeValue validator should ingore empty string fix: attributeValue validator should ignore empty string Sep 29, 2023
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@codecov
Copy link

codecov bot commented Sep 29, 2023

Codecov Report

Merging #15262 (26206be) into master (74e4429) will increase coverage by 5.84%.
Report is 3 commits behind head on master.
The diff coverage is 100.00%.

@@             Coverage Diff              @@
##             master   #15262      +/-   ##
============================================
+ Coverage     59.98%   65.83%   +5.84%     
- Complexity    28205    30926    +2721     
============================================
  Files          3483     3483              
  Lines        129117   129141      +24     
  Branches      15044    15046       +2     
============================================
+ Hits          77457    85016    +7559     
+ Misses        45108    37076    -8032     
- Partials       6552     7049     +497     
Flag Coverage Δ
integration 49.72% <0.00%> (+<0.01%) ⬆️
integration-h2 32.06% <0.00%> (?)
unit 30.15% <100.00%> (+<0.01%) ⬆️

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

Files Coverage Δ
...alidation/attribute/DefaultAttributeValidator.java 100.00% <100.00%> (ø)

... and 513 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants