Openbravo Issue Tracking System - Modules
View Issue Details
0057918ModulesOpenbravo Business APIpublic2025-02-10 09:352025-02-10 16:25
alostale 
Triage Platform Conn 
normalmajorhave not tried
closedfixed 
5
 
 
0057918: bakport 24Q4 - values not validated on API import
When importing objects through API, values are not validated with their Application Dictionary definition. For example, values stored in a list reference property are not checked they are part of the available set of values for that reference.
Using Postman examples collection [1]:
1. Look for Masterdata > Import Business Partner request
2. Change the value of the invoiceTerms property to something invalid (ie. XXX)
3. Execute the request
   ERROR: Check the Business Partner is successfully imported with an invalid invoice term value. It should have failed with an error message saying XXX is not a valid value for invoiceTerms.

---
[1] https://gitlab.com/orisha-group/bu-commerce/openbravo/product/pmods/org.openbravo.api/-/blob/master/examples/Openbravo%20API.postman_collection.json?ref_type=heads [^]
The problem is caused by how values are set in BaseOBObjects (ie. in DirectPropertyMapping [1], but also applicable to other mappings) using the setValue method instead of the set one.

According to the documentation [2] setValue skips validations:

   * Sets a value in the object without any security or validation checking. Should be used with
   * care. Is used by the subclasses and system classes.


[1] https://gitlab.com/orisha-group/bu-commerce/openbravo/product/pmods/org.openbravo.service.external.integration/-/blob/7f20dbeb867531f404546aae5a8f4e70a719389f/src/org/openbravo/service/external/integration/mapping/DirectPropertyMapping.java#L150 [^]
[2] https://gitlab.com/orisha-group/bu-commerce/openbravo/product/openbravo/-/blob/8fbb1539927d54510869b0740b8168f69ce69424/src/org/openbravo/base/structure/BaseOBObject.java#L299 [^]
No tags attached.
blocks defect 0057879 closed Triage Platform Conn values not validated on API import 
Issue History
2025-02-10 09:35alostaleNew Issue
2025-02-10 09:35alostaleAssigned To => Triage Platform Conn
2025-02-10 09:35alostaleIssue generated from0057879
2025-02-10 09:35alostaleRelationship addedblocks 0057879
2025-02-10 12:59hgbotNote Added: 0175394
2025-02-10 16:25hgbotResolutionopen => fixed
2025-02-10 16:25hgbotStatusnew => closed
2025-02-10 16:25hgbotNote Added: 0175429
2025-02-10 16:25hgbotNote Added: 0175430

Notes
(0175394)
hgbot   
2025-02-10 12:59   
Merge Request created: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/pmods/org.openbravo.service.external.integration/-/merge_requests/59 [^]
(0175429)
hgbot   
2025-02-10 16:25   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/pmods/org.openbravo.service.external.integration [^]
Changeset: 3646dda43c988e62ccfc04be8f182dd1ffe4ade4
Author: Asier Lostalé <a.lostale@orisha.com>
Date: 10-02-2025 15:25:14
URL: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/pmods/org.openbravo.service.external.integration/-/commit/3646dda43c988e62ccfc04be8f182dd1ffe4ade4 [^]

fixes BUG-57918: values not validated on API import

---
M src/org/openbravo/service/external/integration/mapping/BigDecimalDirectPropertyMapping.java
M src/org/openbravo/service/external/integration/mapping/BooleanDirectPropertyMapping.java
M src/org/openbravo/service/external/integration/mapping/DateDirectPropertyMapping.java
M src/org/openbravo/service/external/integration/mapping/DirectPropertyMapping.java
M src/org/openbravo/service/external/integration/mapping/LongDirectPropertyMapping.java
---
(0175430)
hgbot   
2025-02-10 16:25   
Merge request merged: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/pmods/org.openbravo.service.external.integration/-/merge_requests/59 [^]