Skip to content

[OSDEV-2331] Added support for the nested objects, integer type, date, and date-time format display in partner fields (Amfori, Worldly and Ulula integrations)#874

Merged
vlad-shapik merged 13 commits intomainfrom
OSDEV-2331-add-support-for-the-date-format-display-in-partner-fields-amfori-integration
Feb 11, 2026
Merged

[OSDEV-2331] Added support for the nested objects, integer type, date, and date-time format display in partner fields (Amfori, Worldly and Ulula integrations)#874
vlad-shapik merged 13 commits intomainfrom
OSDEV-2331-add-support-for-the-date-format-display-in-partner-fields-amfori-integration

Conversation

@vlad-shapik
Copy link
Contributor

@vlad-shapik vlad-shapik commented Feb 4, 2026

OSDEV-2331

  • Added support for displaying nested objects, integer, date, and date-time properties in partner fields with JSON schema. Updated system partner field constraints to allow modifications to inactive partner fields through the Django admin panel, enabling safe updates while maintaining data integrity for active fields.
  • Improved CKEditor integration by automatically cleaning empty placeholder content (<p>&nbsp;</p>) from rich text fields on save, preventing meaningless HTML from being stored in the database.
  • Fixed styling for nested HTML elements in partner field source descriptions to ensure consistent margins and padding across all nested tags.

@vlad-shapik vlad-shapik self-assigned this Feb 4, 2026
@vlad-shapik vlad-shapik marked this pull request as draft February 4, 2026 14:47
@vlad-shapik vlad-shapik temporarily deployed to Quality Environment February 4, 2026 14:47 — with GitHub Actions Inactive
@vlad-shapik vlad-shapik temporarily deployed to Quality Environment February 4, 2026 14:47 — with GitHub Actions Inactive
@vlad-shapik vlad-shapik temporarily deployed to Quality Environment February 4, 2026 14:47 — with GitHub Actions Inactive
@vlad-shapik vlad-shapik temporarily deployed to Quality Environment February 4, 2026 14:47 — with GitHub Actions Inactive
@vlad-shapik vlad-shapik temporarily deployed to Quality Environment February 4, 2026 14:47 — with GitHub Actions Inactive
@vlad-shapik vlad-shapik temporarily deployed to Quality Environment February 4, 2026 14:47 — with GitHub Actions Inactive
@vlad-shapik vlad-shapik temporarily deployed to Quality Environment February 4, 2026 14:47 — with GitHub Actions Inactive
@vlad-shapik vlad-shapik temporarily deployed to Quality Environment February 4, 2026 14:47 — with GitHub Actions Inactive
@vlad-shapik vlad-shapik temporarily deployed to Quality Environment February 4, 2026 14:47 — with GitHub Actions Inactive
@vlad-shapik vlad-shapik temporarily deployed to Quality Environment February 4, 2026 14:47 — with GitHub Actions Inactive
@vlad-shapik vlad-shapik temporarily deployed to Quality Environment February 4, 2026 14:47 — with GitHub Actions Inactive
@vlad-shapik vlad-shapik temporarily deployed to Quality Environment February 4, 2026 14:47 — with GitHub Actions Inactive
@vlad-shapik vlad-shapik temporarily deployed to Quality Environment February 4, 2026 14:47 — with GitHub Actions Inactive
@vlad-shapik vlad-shapik temporarily deployed to Quality Environment February 4, 2026 14:53 — with GitHub Actions Inactive
@barecheck
Copy link

barecheck bot commented Feb 4, 2026

Dedupe Hub App | Unittest test suite - Code coverage report

Total: 55.73%

Your code coverage diff: 0.00% ▴

✅ All code changes are covered

@vlad-shapik vlad-shapik temporarily deployed to Quality Environment February 4, 2026 14:54 — with GitHub Actions Inactive
@vlad-shapik vlad-shapik temporarily deployed to Quality Environment February 4, 2026 14:54 — with GitHub Actions Inactive
@barecheck
Copy link

barecheck bot commented Feb 4, 2026

Contricleaner App | Unittest test suite - Code coverage report

Total: 98.75%

Your code coverage diff: 0.00% ▴

✅ All code changes are covered

@barecheck
Copy link

barecheck bot commented Feb 4, 2026

Countries App | Unittest test suite - Code coverage report

Total: 100%

Your code coverage diff: 0.00% ▴

✅ All code changes are covered

@vlad-shapik vlad-shapik temporarily deployed to Quality Environment February 4, 2026 15:08 — with GitHub Actions Inactive
@barecheck
Copy link

barecheck bot commented Feb 4, 2026

Django App | Unittest test suite - Code coverage report

Total: 81.9%

Your code coverage diff: 0.01% ▴

✅ All code changes are covered

@vlad-shapik vlad-shapik temporarily deployed to Quality Environment February 4, 2026 17:50 — with GitHub Actions Inactive
@vlad-shapik vlad-shapik temporarily deployed to Quality Environment February 4, 2026 17:50 — with GitHub Actions Inactive
@vlad-shapik vlad-shapik temporarily deployed to Quality Environment February 4, 2026 17:50 — with GitHub Actions Inactive
@vlad-shapik vlad-shapik temporarily deployed to Quality Environment February 4, 2026 17:50 — with GitHub Actions Inactive
@vlad-shapik vlad-shapik temporarily deployed to Quality Environment February 4, 2026 17:50 — with GitHub Actions Inactive
@vlad-shapik vlad-shapik temporarily deployed to Quality Environment February 4, 2026 17:50 — with GitHub Actions Inactive
@vlad-shapik vlad-shapik temporarily deployed to Quality Environment February 6, 2026 11:51 — with GitHub Actions Inactive
@vlad-shapik vlad-shapik temporarily deployed to Quality Environment February 6, 2026 11:51 — with GitHub Actions Inactive
@vlad-shapik vlad-shapik temporarily deployed to Quality Environment February 6, 2026 11:51 — with GitHub Actions Inactive
@vlad-shapik vlad-shapik temporarily deployed to Quality Environment February 6, 2026 11:51 — with GitHub Actions Inactive
@barecheck
Copy link

barecheck bot commented Feb 6, 2026

React App | Jest test suite - Code coverage report

Total: 40.52%

Your code coverage diff: 0.20% ▴

✅ All code changes are covered

@coderabbitai
Copy link

coderabbitai bot commented Feb 6, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR restructures React components for rendering partner field schema values, moving components into modular FormatComponents and TypeComponents folders while adding support for nested objects, integers, dates, and date-time properties. Django admin changes restrict PartnerField modification lookups to active records only. Test imports are updated to reflect the new folder structure.

Changes

Cohort / File(s) Summary
Django Admin Partner Field Lookup
src/django/api/admin.py
Narrowed PartnerField lookup in PartnerFieldAdminForm.clean to active records only (removed get_all_including_inactive() call).
Release Notes
doc/release/RELEASE-NOTES.md
Added release note entry for OSDEV-2331 documenting nested object, integer, date, and date-time property support in partner fields with JSON schema, and partner field constraints allowing inactive field modifications.
PartnerFieldSchemaValue Core Component
src/react/src/components/PartnerFields/PartnerFieldSchemaValue/PartnerFieldSchemaValue.jsx, PartnerFieldSchemaValue/constants.js, PartnerFieldSchemaValue/utils.jsx
Created new modular structure with main component validating values against jsonSchema, extracting schema properties, and delegating rendering to format/type-specific components via constants mapping and utilities.
Format-Specific Components
src/react/src/components/PartnerFields/FormatComponents/UriProperty.jsx, FormatComponents/UriReferenceProperty/UriReferenceProperty.jsx, FormatComponents/UriReferenceProperty/utils.js, FormatComponents/DateProperty.jsx, FormatComponents/DateTimeProperty.jsx
Added new format-specific renderers for URI, URI references, dates, and date-times with schema-driven display text and styling.
Type-Specific Components
src/react/src/components/PartnerFields/TypeComponents/IntegerProperty.jsx, TypeComponents/NestedObjectProperty/NestedObjectProperty.jsx, TypeComponents/NestedObjectProperty/utils.js, TypeComponents/NestedObjectProperty/styles.js, TypeComponents/DefaultProperty/DefaultProperty.jsx, TypeComponents/DefaultProperty/utils.js
Added new type-specific renderers for integers, nested objects, and fallback default properties with schema-driven titles and recursive schema composition for nested fields.
Utilities & Styling
src/react/src/components/PartnerFields/utils.js, PartnerFields/styles.js
Simplified utils.js to export title-based schema accessors and date formatting; added commonPropertyStyles export for consistent component styling.
Deleted Legacy Components
src/react/src/components/PartnerFields/PartnerFieldSchemaValue.jsx, PartnerFields/UriProperty.jsx, PartnerFields/UriReferenceProperty.jsx, PartnerFields/DefaultProperty.jsx
Removed legacy component implementations moved to new modular folder structure.
Test Updates
src/react/src/__tests__/components/PartnerFieldSchemaValue.test.js, __tests__/components/UriReferenceProperty.test.js, src/react/src/components/FacilityDetailsDetail.jsx
Updated import paths to reflect new nested folder structure; adjusted test expectations for empty container rendering when data is missing.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • PR #823: Modifies PartnerFieldSchemaValue rendering path and related PartnerFields components/utilities with overlapping schema-driven formatting logic
  • PR #819: Adds URI-reference support and base_url/display_text partner field handling affecting the same PartnerFieldSchemaValue and UriReferenceProperty components
  • PR #816: Adds JSON Schema support for PartnerField including admin form json_schema handling and object-type validation/rendering

Suggested reviewers

  • protsack-stephan
  • roman-stolar
  • VadimKovalenkoSNF
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main changes: adding support for nested objects, integer type, date, and date-time format display in partner fields, which aligns with the core modifications across React components and Django admin.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description check ✅ Passed The pull request description accurately relates to the changeset, describing support for nested objects, integer, date, and date-time properties in partner fields with JSON schema, and Django admin updates for inactive partner fields.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch OSDEV-2331-add-support-for-the-date-format-display-in-partner-fields-amfori-integration

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🤖 Fix all issues with AI agents
In
`@src/react/src/components/PartnerFields/FormatComponents/DateProperty/utils.js`:
- Around line 4-13: The current try/catch around new Date(dateString) is
ineffective because new Date(...) doesn't throw for invalid input; instead check
the constructed Date for validity (e.g., const date = new Date(dateString); if
(isNaN(date.getTime())) return dateString;) before calling
date.toLocaleDateString(...). Update the function using the dateString variable
and the new Date / toLocaleDateString calls so invalid dates return the original
dateString rather than "Invalid Date", and remove or simplify the useless catch
block.

In
`@src/react/src/components/PartnerFields/FormatComponents/DateTimeProperty/utils.js`:
- Around line 4-15: The current DateTime formatting block uses new
Date(dateTimeString) inside a try/catch but new Date() doesn't throw on invalid
input; update the logic in the DateTime formatter (the block using
dateTimeString and new Date(...)) to validate the parsed date by checking
isNaN(date.getTime()) before calling date.toLocaleDateString; if the parsed date
is invalid return the original dateTimeString, otherwise proceed to format with
the existing toLocaleDateString options (year, month, day, hour, minute).

In
`@src/react/src/components/PartnerFields/FormatComponents/UriReferenceProperty/UriReferenceProperty.jsx`:
- Around line 49-56: The anchor currently uses absoluteUri returned by
getAbsoluteUri and can be undefined when partnerConfigFields.baseUrl is falsy;
update UriReferenceProperty (where absoluteUri is computed) to guard before
rendering: if absoluteUri is truthy render the <a> with href={absoluteUri},
otherwise either render a non-interactive <span> showing displayLinkText or fall
back to using propertyValue as the href (e.g., href={propertyValue}) so the
rendered element is not a misleading link; ensure you reference absoluteUri,
propertyValue, displayLinkText and propertyKey when making the change.

In
`@src/react/src/components/PartnerFields/FormatComponents/UriReferenceProperty/utils.js`:
- Around line 3-6: constructUrlFromPartnerField can throw when value is null or
non-string because value.trim() assumes a string; update the function (and the
similar logic used by getAbsoluteUri) to coerce or guard the input before
trimming, e.g., derive a safeValue via value == null ? '' : String(value) and
then use safeValue.trim() in place of value.trim(), preserving the existing
slash handling and return behavior; ensure both constructUrlFromPartnerField and
the getAbsoluteUri call sites use this safe coercion to avoid TypeError for null
or numeric inputs.

In `@src/react/src/components/PartnerFields/PartnerFieldSchemaValue/utils.jsx`:
- Around line 38-54: getComponentForProperty currently lets a schema with type
'object' fall through to TYPE_COMPONENTS['object'] (which maps to
NestedObjectProperty) even when isNestedObject returned false; update the
type-level lookup in getComponentForProperty so it only uses
TYPE_COMPONENTS[type] when type exists and type !== 'object' (i.e., add an
explicit guard against type === 'object'), leaving nested-object handling to
isNestedObject and otherwise falling back to DEFAULT_COMPONENT; reference
getComponentForProperty, isNestedObject, TYPE_COMPONENTS, FORMAT_COMPONENTS, and
DEFAULT_COMPONENT when making the change.
🧹 Nitpick comments (11)
src/django/api/admin.py (1)

295-324: Avoid misleading warnings when editing inactive system fields.
With the active-only manager, inactive system fields will raise DoesNotExist and log a warning even though the record exists. Consider suppressing the warning when the record exists but is inactive to avoid log noise.

🛠️ Optional guard to skip false warnings
-            except PartnerField.DoesNotExist:
-                logger.warning(
-                    f'Partner field `{self.instance.pk}` not found. '
-                    'System field must exist in database.'
-                )
+            except PartnerField.DoesNotExist:
+                if PartnerField.objects.get_all_including_inactive().filter(
+                    pk=self.instance.pk
+                ).exists():
+                    return cleaned_data
+                logger.warning(
+                    f'Partner field `{self.instance.pk}` not found. '
+                    'System field must exist in database.'
+                )
src/react/src/components/PartnerFields/FormatComponents/DateProperty/utils.js (1)

16-19: No defensive check when value is nullish.

If value is null or undefined, value[propertyKey] will throw a TypeError. Other similar components in this PR (e.g., UriProperty, IntegerProperty) access value[propertyKey] the same way, but the caller (renderProperty) should guarantee a valid object. Still worth noting that formatDate handles undefined gracefully via the falsy check, so the only risk is an explicit null/undefined value argument.

src/react/src/components/PartnerFields/FormatComponents/DateTimeProperty/utils.js (1)

6-6: Nit: toLocaleString is more semantically appropriate when including time components.

toLocaleDateString with time options works in practice, but toLocaleString is the conventional method when formatting both date and time. Consider using date.toLocaleString('en-US', { ... }) instead.

src/react/src/components/PartnerFields/PartnerFieldSchemaValue/PartnerFieldSchemaValue.jsx (1)

29-38: value propType accepts types that will always render as null.

isValidValue rejects non-object values, so string, number, and bool in the oneOfType will always result in a null return. This is presumably intentional (the parent can pass raw values that get silently ignored), but a brief inline comment would clarify this contract for future maintainers.

src/react/src/components/PartnerFields/FormatComponents/DateTimeProperty/DateTimeProperty.jsx (1)

8-23: Consider guarding against missing or null date-time values.

Unlike UriProperty which returns null when propertyValue is falsy, DateTimeProperty always renders. If value[propertyKey] is undefined or null, this will render an empty or broken output (e.g., "Title: " with nothing after it, or whatever formatDateTime(undefined) returns).

Suggested guard
 const DateTimeProperty = ({
     propertyKey,
     value,
     schemaProperties,
     classes,
 }) => {
     const title = getTitleFromSchema(propertyKey, schemaProperties);
     const formattedDateTime = getFormattedDateTimeValue(propertyKey, value);
 
+    if (!formattedDateTime) {
+        return null;
+    }
+
     return (
         <div className={classes.container}>
src/react/src/components/PartnerFields/FormatComponents/DateProperty/DateProperty.jsx (1)

8-18: Same missing-value guard concern as DateTimeProperty.

If value[propertyKey] is absent, getFormattedDateValue receives undefined and the component renders potentially empty or broken output. Consider adding a null guard consistent with the UriProperty pattern.

Suggested guard
 const DateProperty = ({ propertyKey, value, schemaProperties, classes }) => {
     const title = getTitleFromSchema(propertyKey, schemaProperties);
     const formattedDate = getFormattedDateValue(propertyKey, value);
 
+    if (!formattedDate) {
+        return null;
+    }
+
     return (
         <div className={classes.container}>
src/react/src/components/PartnerFields/TypeComponents/NestedObjectProperty/NestedObjectProperty.jsx (1)

9-30: Recursive rendering looks correct; consider a depth guard for safety.

The mutual recursion between NestedObjectPropertyPartnerFieldSchemaValue → (potentially) NestedObjectProperty is the right approach for nested objects. In practice, partner schemas should be finite-depth, but a malformed or deeply nested schema could cause a stack overflow.

If you want to be defensive, you could thread a depth prop and cap it. This is optional and can be deferred.

src/react/src/components/PartnerFields/FormatComponents/UriReferenceProperty/utils.js (2)

29-46: Seven positional parameters make call-sites fragile.

getDisplayLinkText accepts 7 positional arguments, which makes it easy to swap arguments at the call site. Consider using a single options object instead.

Example
-export const getDisplayLinkText = (
-    baseUrl,
-    displayText,
-    linkText,
-    absoluteUri,
-    schemaProperties,
-    propertyValue,
-    propertyKey,
-) => {
+export const getDisplayLinkText = ({
+    baseUrl,
+    displayText,
+    linkText,
+    absoluteUri,
+    schemaProperties,
+    propertyValue,
+    propertyKey,
+}) => {

1-6: Minor: lodash/endsWith is unnecessary for a simple string check.

Native String.prototype.endsWith is available in all modern JS environments and avoids pulling in a lodash module for a single check.

Proposed simplification
-import endsWith from 'lodash/endsWith';
-
-const constructUrlFromPartnerField = (baseUrl, value = '') => {
-    if (endsWith(baseUrl, '/')) return baseUrl + value.trim();
+const constructUrlFromPartnerField = (baseUrl, value = '') => {
+    if (baseUrl.endsWith('/')) return baseUrl + value.trim();
     return `${baseUrl}/${value.trim()}`;
 };
src/react/src/components/PartnerFields/PartnerFieldSchemaValue/utils.jsx (2)

13-29: The _text suffix skip logic is tightly coupled to URI format knowledge.

shouldSkipProperty knows that _text-suffixed keys should be skipped when the base key has a URI format. This works, but the coupling could be surprising to future maintainers. A brief inline comment explaining why would help.

Suggested comment
     if (propertyKey.endsWith('_text')) {
+        // URI properties render their own display text,
+        // so skip companion `*_text` fields to avoid duplication.
         const baseKey = propertyKey.slice(0, -5);

77-85: isValidValue rejects falsy value — fine for objects, but the name could mislead.

!value on line 78 rejects null, undefined, 0, '', etc. Since this is only called with object-typed data this is fine, but the generic name isValidValue might tempt future callers to use it for scalars. A more descriptive name like isValidObjectValue would make the contract clearer.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In
`@src/react/src/components/PartnerFields/TypeComponents/NestedObjectProperty/NestedObjectProperty.jsx`:
- Line 17: The displayPropertyKey computation uses propertyKey.replace('_', ' ')
which only replaces the first underscore; update the expression that defines
displayPropertyKey (the variable in NestedObjectProperty.jsx) to replace all
underscores — e.g., use a global regex or split/join on '_' before calling
toUpperCase — so keys like "some_nested_property" become "SOME NESTED PROPERTY".

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In
`@src/react/src/components/PartnerFields/TypeComponents/NestedObjectProperty/NestedObjectProperty.jsx`:
- Line 18: The component reads const nestedValue = value[propertyKey] without
guarding for value being null/undefined or nestedValue not being an object;
update NestedObjectProperty (where nestedValue, value and propertyKey are used)
to check that value is an object and that nestedValue exists and is an object
(or otherwise valid) before rendering PartnerFieldSchemaValue, and return null
or a fallback early if the guard fails so you don't rely solely on
PartnerFieldSchemaValue.isValidValue to reject invalid input.
🧹 Nitpick comments (1)
src/react/src/components/PartnerFields/PartnerFieldSchemaValue/utils.jsx (1)

89-108: Two minor observations on renderProperties.

  1. Redundant truthiness check (line 104): renderProperty always returns a React element (a truthy object), so if (rendered) is dead code. Consider removing the guard or, if you want to keep it as defensive coding, add a comment explaining why.

  2. No null guard on value: Object.keys(value) will throw a TypeError if value is null or undefined. The caller (PartnerFieldSchemaValue) presumably calls isValidValue first, but renderProperties is exported publicly and unprotected on its own. An early return (e.g., if (!value) return [];) would make this safer.

Optional hardening
 export const renderProperties = (
     value,
     schemaProperties,
     partnerConfigFields,
-) =>
-    Object.keys(value).reduce((acc, propertyKey) => {
+) => {
+    if (!value || typeof value !== 'object') {
+        return [];
+    }
+
+    return Object.keys(value).reduce((acc, propertyKey) => {
         if (shouldSkipProperty(propertyKey, schemaProperties)) {
             return acc;
         }
         const rendered = renderProperty(
             propertyKey,
             value,
             schemaProperties,
             partnerConfigFields,
         );
-        if (rendered) {
-            acc.push(rendered);
-        }
+        acc.push(rendered);
         return acc;
     }, []);
+};

Copy link
Contributor

@VadimKovalenkoSNF VadimKovalenkoSNF left a comment

Choose a reason for hiding this comment

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

Looks clear, approved 👍

Copy link
Collaborator

@protsack-stephan protsack-stephan left a comment

Choose a reason for hiding this comment

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

Great work! Couple of small comments from me.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Fix all issues with AI agents
In `@src/react/src/components/PartnerFields/FormatComponents/UriProperty.jsx`:
- Around line 24-31: The anchor is using propertyValue directly for href (see
the JSX anchor with key `${propertyKey}-uri-${propertyValue}`,
href={propertyValue}, linkText) which allows javascript: or data: URIs; update
UriProperty.jsx to validate/sanitize propertyValue before rendering: parse or
check the scheme and only render the <a> when the value begins with a safe
protocol (e.g., startsWith 'http://' or 'https://'), otherwise render linkText
as plain text (or prefix/normalize to https); ensure the same check is applied
where href={propertyValue} is used so no unsafe protocols are emitted to the
DOM.

In
`@src/react/src/components/PartnerFields/FormatComponents/UriReferenceProperty/utils.js`:
- Line 15: The current assignment to stringValue uses a truthy check that drops
valid values like 0 or false; in utils.js update the logic that sets const
stringValue from propertyValue so it treats null/undefined only as empty and
preserves 0/false/'' by using an explicit null/undefined check (e.g., check
propertyValue !== null && propertyValue !== undefined or propertyValue == null
appropriately) and then convert to String(propertyValue) when present; modify
the line that declares stringValue accordingly so integer 0 is retained.

In
`@src/react/src/components/PartnerFields/TypeComponents/DefaultProperty/utils.js`:
- Around line 1-4: The current getPropertyValueAsString function drops valid
falsy values because it uses a truthiness check; update the check to only treat
null/undefined as missing (e.g., test propertyValue === null || propertyValue
=== undefined or the inverse) so that values like 0, false, and '' are preserved
and then return String(propertyValue) when not null/undefined, otherwise return
''. Keep the reference to getPropertyValueAsString and the propertyKey/value
lookup as-is.

In `@src/react/src/components/PartnerFields/utils.js`:
- Around line 18-22: The getFormattedDateValue function currently calls
moment(propertyValue) which can render "Invalid date" for malformed input and
parse date-only strings in local time; update getFormattedDateValue to first
check that propertyValue is non-empty, then create a moment instance using
moment.utc(propertyValue) for date-only values (or otherwise use the existing
parsing strategy if local time is required) and call m.isValid() before
formatting; if !m.isValid() return an empty string (or fallback), and otherwise
return m.format(format). Reference getFormattedDateValue and the local variable
propertyValue when making these changes.
🧹 Nitpick comments (1)
src/react/src/components/PartnerFields/FormatComponents/UriReferenceProperty/utils.js (1)

29-46: Consider an options object to reduce parameter count.

This function takes 7 positional parameters, making call sites hard to read and error-prone regarding argument order. A single config/options object would improve clarity. This is a non-blocking suggestion.

@sonarqubecloud
Copy link

Copy link
Collaborator

@protsack-stephan protsack-stephan left a comment

Choose a reason for hiding this comment

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

Looks good!

Copy link
Contributor

@VadimKovalenkoSNF VadimKovalenkoSNF left a comment

Choose a reason for hiding this comment

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

LGTM

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.

3 participants