Skip to content

[OSDEV-2269] [Partner Fields Enhancement] Add URI (JSON Schema) support for Partner Fields#823

Merged
roman-stolar merged 23 commits intomainfrom
OSDEV-2269-add-uri-format-support-for-partner-field
Dec 3, 2025
Merged

[OSDEV-2269] [Partner Fields Enhancement] Add URI (JSON Schema) support for Partner Fields#823
roman-stolar merged 23 commits intomainfrom
OSDEV-2269-add-uri-format-support-for-partner-field

Conversation

@roman-stolar
Copy link
Contributor

@roman-stolar roman-stolar commented Nov 25, 2025

OSDEV-2269 [Partner Fields Enhancement] Add URI (JSON Schema) support for Partner Fields

  • Added URI format support for partner fields with JSON schema. Properties defined with "format": "uri" are rendered as clickable links on production location profile pages.

@roman-stolar roman-stolar self-assigned this Nov 25, 2025
@roman-stolar roman-stolar temporarily deployed to Quality Environment November 25, 2025 13:31 — with GitHub Actions Inactive
@roman-stolar roman-stolar temporarily deployed to Quality Environment November 25, 2025 13:31 — with GitHub Actions Inactive
@roman-stolar roman-stolar temporarily deployed to Quality Environment November 25, 2025 13:31 — with GitHub Actions Inactive
@roman-stolar roman-stolar temporarily deployed to Quality Environment November 25, 2025 13:31 — with GitHub Actions Inactive
@roman-stolar roman-stolar temporarily deployed to Quality Environment November 25, 2025 13:31 — with GitHub Actions Inactive
@roman-stolar roman-stolar temporarily deployed to Quality Environment November 25, 2025 13:31 — with GitHub Actions Inactive
@roman-stolar roman-stolar temporarily deployed to Quality Environment November 25, 2025 13:31 — with GitHub Actions Inactive
@roman-stolar roman-stolar temporarily deployed to Quality Environment November 25, 2025 13:31 — with GitHub Actions Inactive
@roman-stolar roman-stolar temporarily deployed to Quality Environment November 25, 2025 13:31 — with GitHub Actions Inactive
@roman-stolar roman-stolar temporarily deployed to Quality Environment November 25, 2025 13:31 — with GitHub Actions Inactive
@roman-stolar roman-stolar temporarily deployed to Quality Environment November 25, 2025 13:31 — with GitHub Actions Inactive
@roman-stolar roman-stolar temporarily deployed to Quality Environment November 25, 2025 13:31 — with GitHub Actions Inactive
@roman-stolar roman-stolar temporarily deployed to Quality Environment November 25, 2025 13:31 — with GitHub Actions Inactive
@roman-stolar roman-stolar temporarily deployed to Quality Environment November 25, 2025 13:31 — with GitHub Actions Inactive
@roman-stolar roman-stolar temporarily deployed to Quality Environment November 25, 2025 13:33 — with GitHub Actions Inactive
@barecheck
Copy link

barecheck bot commented Nov 25, 2025

React App | Jest test suite - Code coverage report

Total: 38.37%

Your code coverage diff: 0.35% ▴

✅ All code changes are covered

@roman-stolar roman-stolar temporarily deployed to Quality Environment November 25, 2025 13:37 — with GitHub Actions Inactive
@barecheck
Copy link

barecheck bot commented Nov 25, 2025

Dedupe Hub App | Unittest test suite - Code coverage report

Total: 55.73%

Your code coverage diff: 0.00% ▴

✅ All code changes are covered

@barecheck
Copy link

barecheck bot commented Nov 25, 2025

Countries App | Unittest test suite - Code coverage report

Total: 100%

Your code coverage diff: 0.00% ▴

✅ All code changes are covered

@barecheck
Copy link

barecheck bot commented Nov 25, 2025

Contricleaner App | Unittest test suite - Code coverage report

Total: 98.75%

Your code coverage diff: 0.00% ▴

✅ All code changes are covered

@roman-stolar roman-stolar temporarily deployed to Quality Environment November 25, 2025 13:47 — with GitHub Actions Inactive
@barecheck
Copy link

barecheck bot commented Nov 25, 2025

Django App | Unittest test suite - Code coverage report

Total: 81.51%

Your code coverage diff: 0.00% ▴

✅ All code changes are covered

…r-field

# Conflicts:
#	src/react/src/util/renderUtils.jsx
…69-add-uri-format-support-for-partner-field

# Conflicts:
#	doc/release/RELEASE-NOTES.md
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: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8effb97 and 5331897.

📒 Files selected for processing (5)
  • doc/release/RELEASE-NOTES.md (2 hunks)
  • src/react/src/components/FacilityDetailsGeneralFields.jsx (1 hunks)
  • src/react/src/util/partnerFieldFormatter.jsx (1 hunks)
  • src/react/src/util/renderUtils.jsx (1 hunks)
  • src/react/src/util/util.js (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/react/src/components/FacilityDetailsGeneralFields.jsx
  • doc/release/RELEASE-NOTES.md
  • src/react/src/util/util.js
  • src/react/src/util/renderUtils.jsx
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-02-12T11:45:01.562Z
Learnt from: VadimKovalenkoSNF
Repo: opensupplyhub/open-supply-hub PR: 511
File: src/react/src/util/util.js:1436-1447
Timestamp: 2025-02-12T11:45:01.562Z
Learning: The `generateRangeField` utility function in `src/react/src/util/util.js` is meant for data transformation only. Input validation is handled separately on the frontend for specific input fields.

Applied to files:

  • src/react/src/util/partnerFieldFormatter.jsx
📚 Learning: 2024-12-10T15:07:54.819Z
Learnt from: roman-stolar
Repo: opensupplyhub/open-supply-hub PR: 448
File: src/react/src/util/util.js:1317-1317
Timestamp: 2024-12-10T15:07:54.819Z
Learning: Changes to date handling functions like `formatDate` in `src/react/src/util/util.js` should be made carefully, considering that different parts of the codebase may intentionally use local time instead of UTC, and broad changes to `moment()` usage may not be appropriate without context.

Applied to files:

  • src/react/src/util/partnerFieldFormatter.jsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
  • GitHub Check: run-dd-code-quality
  • GitHub Check: run-eslint-linter-and-prettier-formatter
  • GitHub Check: run-flake8-linter
  • GitHub Check: get-base-branch-dd-cov
  • GitHub Check: run-integration-test-code-quality
  • GitHub Check: run-contricleaner-code-quality
  • GitHub Check: get-base-branch-contricleaner-cov
  • GitHub Check: get-base-branch-countries-cov
  • GitHub Check: get-base-branch-django-cov
  • GitHub Check: run-countries-code-quality
  • GitHub Check: get-base-branch-fe-cov
  • GitHub Check: run-fe-code-quality
  • GitHub Check: run-django-code-quality
🔇 Additional comments (6)
src/react/src/util/partnerFieldFormatter.jsx (6)

1-9: LGTM! Good use of Object.freeze for immutability.

The constant structure is clean and extensible for future format types.


11-23: LGTM! Safe property access and appropriate data structure.

The use of optional chaining and Set for collecting unique property names is well-implemented.


33-42: LGTM! Clean implementation with safe defaults.

The default empty object fallback for schemaProperties prevents runtime errors.


58-70: LGTM! Clean implementation of the _text property pattern.

The helper functions correctly identify and retrieve display text for URI fields.


72-96: LGTM! Proper handling of empty URIs and mixed field types.

The function correctly filters out empty URI values and _text properties, returning a mixed array of formatted strings and React link elements.


28-31: The formatValueWithLabel function is appropriately designed for its use case.

The function correctly handles primitive values using String() coercion, which is suitable for partner field formatting. Input validation in formatPartnerFieldWithSchema ensures only plain objects are processed, and schema-driven extraction provides guidance on expected property types. The existing implementation and comprehensive test coverage confirm that only primitive values are formatted.

Likely an incorrect or invalid review comment.

…69-add-uri-format-support-for-partner-field

# Conflicts:
#	doc/release/RELEASE-NOTES.md
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

🧹 Nitpick comments (1)
src/react/src/components/FacilityDetailsItem.jsx (1)

33-50: jsonSchema prop wiring through FacilityDetailsItem is consistent and safe

Adding jsonSchema to the props and forwarding it to the primary and drawer FacilityDetailsDetail instances (gated by !embed, like secondary, sourceBy, and unit) looks correct and keeps embed behavior unchanged. The additional content rows can still carry their own jsonSchema via the spread, so no extra work is needed there. If you ever want schema‑aware rendering (e.g., clickable URIs) in embed views too, consider dropping the !embed guard for jsonSchema while keeping the others as‑is.

Also applies to: 60-71, 99-107

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 574b2f1 and 90b188a.

📒 Files selected for processing (7)
  • src/react/src/__tests__/components/PartnerFieldSchemaValue.test.js (1 hunks)
  • src/react/src/__tests__/utils.tests.js (1 hunks)
  • src/react/src/components/FacilityDetailsDetail.jsx (3 hunks)
  • src/react/src/components/FacilityDetailsGeneralFields.jsx (1 hunks)
  • src/react/src/components/FacilityDetailsItem.jsx (3 hunks)
  • src/react/src/components/PartnerFieldSchemaValue.jsx (1 hunks)
  • src/react/src/util/util.js (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/react/src/components/FacilityDetailsGeneralFields.jsx
  • src/react/src/util/util.js
🧰 Additional context used
🧠 Learnings (5)
📚 Learning: 2025-01-17T16:12:18.285Z
Learnt from: Innavin369
Repo: opensupplyhub/open-supply-hub PR: 483
File: src/react/src/__tests__/components/SearchByNameAndAddressSuccessResult.test.js:0-0
Timestamp: 2025-01-17T16:12:18.285Z
Learning: In the SearchByNameAndAddressSuccessResult component's tests, attempting to test internal navigation logic through mocking useHistory is not feasible, and button presence/click events should be covered in the main rendering test case.

Applied to files:

  • src/react/src/__tests__/components/PartnerFieldSchemaValue.test.js
📚 Learning: 2025-10-31T08:29:48.108Z
Learnt from: VadimKovalenkoSNF
Repo: opensupplyhub/open-supply-hub PR: 781
File: src/react/src/components/InitialClaimFlow/ClaimForm/validationSchemas.js:23-52
Timestamp: 2025-10-31T08:29:48.108Z
Learning: In src/react/src/components/InitialClaimFlow/ClaimForm/validationSchemas.js, the Redux state field `claimantEmploymentVerificationMethod` stores the label (full sentence, e.g., "Company website showing your name and title (e.g., About Us, Team page)") from EMPLOYMENT_VERIFICATION_OPTIONS, not the option value (e.g., "company-website-address"). The validation schema correctly compares against labels.

Applied to files:

  • src/react/src/components/PartnerFieldSchemaValue.jsx
  • src/react/src/components/FacilityDetailsItem.jsx
  • src/react/src/components/FacilityDetailsDetail.jsx
📚 Learning: 2024-12-10T07:09:35.641Z
Learnt from: VadimKovalenkoSNF
Repo: opensupplyhub/open-supply-hub PR: 436
File: src/react/src/components/Contribute/ProductionLocationDialog.jsx:33-181
Timestamp: 2024-12-10T07:09:35.641Z
Learning: In the `ProductionLocationDialog.jsx` component, hardcoded facility data is acceptable for now as per the project's requirements.

Applied to files:

  • src/react/src/components/FacilityDetailsItem.jsx
  • src/react/src/components/FacilityDetailsDetail.jsx
📚 Learning: 2024-12-05T10:43:59.922Z
Learnt from: Innavin369
Repo: opensupplyhub/open-supply-hub PR: 437
File: src/react/src/components/Filters/StyledSelect.jsx:31-39
Timestamp: 2024-12-05T10:43:59.922Z
Learning: In the `StyledSelect` component (`src/react/src/components/Filters/StyledSelect.jsx`), the `label` prop is optional. The `InputLabel` should be conditionally rendered only when a label is provided to prevent unnecessary DOM elements, extra padding, and browser console warnings.

Applied to files:

  • src/react/src/components/FacilityDetailsDetail.jsx
📚 Learning: 2024-12-10T15:07:54.819Z
Learnt from: roman-stolar
Repo: opensupplyhub/open-supply-hub PR: 448
File: src/react/src/util/util.js:1317-1317
Timestamp: 2024-12-10T15:07:54.819Z
Learning: Changes to date handling functions like `formatDate` in `src/react/src/util/util.js` should be made carefully, considering that different parts of the codebase may intentionally use local time instead of UTC, and broad changes to `moment()` usage may not be appropriate without context.

Applied to files:

  • src/react/src/__tests__/utils.tests.js
🧬 Code graph analysis (3)
src/react/src/__tests__/components/PartnerFieldSchemaValue.test.js (1)
src/react/src/components/PartnerFieldSchemaValue.jsx (1)
  • PartnerFieldSchemaValue (117-151)
src/react/src/components/FacilityDetailsDetail.jsx (2)
src/react/src/components/PartnerFieldSchemaValue.jsx (1)
  • PartnerFieldSchemaValue (117-151)
src/react/src/util/util.js (1)
  • primary (1792-1795)
src/react/src/__tests__/utils.tests.js (1)
src/react/src/util/util.js (2)
  • formatPartnerFieldValue (1906-1919)
  • formatPartnerFieldValue (1906-1919)
🔇 Additional comments (3)
src/react/src/components/FacilityDetailsDetail.jsx (1)

9-10: Schema‑aware primary rendering is correct; confirm fallback behavior with jsonSchema present

Wiring jsonSchema through and switching the primary rendering to PartnerFieldSchemaValue when jsonSchema is truthy is appropriate and aligns with the new schema‑driven partner fields. One subtle change is that when jsonSchema is present, the locationLabeled fallback is no longer used—PartnerFieldSchemaValue returns primary as‑is (including undefined), so an empty primary won’t fall back to locationLabeled anymore. That’s fine if jsonSchema is only set for partner fields that always provide an object value, but it’s worth double‑checking this assumption.

Also applies to: 61-71, 88-97

src/react/src/__tests__/components/PartnerFieldSchemaValue.test.js (1)

1-120: PartnerFieldSchemaValue tests comprehensively cover URI and non‑URI cases

The new test suite hits the key behaviors: URI fields with and without _text, non‑URI fields with titles, and mixed objects while skipping the _text property. Assertions on href, target, rel, and single occurrence of link text match the implementation and should guard future refactors well.

src/react/src/__tests__/utils.tests.js (1)

2739-2863: formatPartnerFieldValue tests thoroughly exercise the updated API

The new formatPartnerFieldValue suite does a good job of pinning down behavior across raw_value, raw_values (arrays/objects/strings), mixed types, and the new schema‑driven object case. Passing a second argument keeps tests aligned with the updated (fieldValueData, json_schema) signature while ensuring pre‑existing formatting expectations remain intact when no real schema is supplied.

…69-add-uri-format-support-for-partner-field

# Conflicts:
#	doc/release/RELEASE-NOTES.md
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: 0

🧹 Nitpick comments (4)
src/react/src/components/PartnerFieldSchemaValue.jsx (3)

23-32: Remove redundant key prop inside UriProperty.

The key prop at line 25 is unnecessary because renderProperty already provides a key when wrapping FormatComponent at line 105. React only needs the outermost key for list rendering.

Apply this diff to remove the redundant key:

     return (
         <a
-            key={`${propertyKey}-uri-${propertyValue}`}
             href={propertyValue}
             target="_blank"
             rel="noopener noreferrer"
         >
             {linkText}
         </a>
     );

43-46: Remove redundant key prop inside DefaultProperty.

Similar to UriProperty, the key prop at line 44 is redundant since renderProperty provides it at line 105.

Apply this diff:

     return (
-        <span key={`${propertyKey}-default`} style={{ display: 'block' }}>
+        <span style={{ display: 'block' }}>
             {displayText}
         </span>
     );

94-112: Remove redundant property existence check.

The check at lines 97-99 is redundant because propertyKey comes from Object.keys(value) (line 129), which only returns own enumerable properties. The condition will always be true.

Apply this diff to simplify the function:

 const renderProperty = (propertyKey, propertyValue, propertySchema, value) => {
     const format = getFormatFromSchema(propertySchema);
-
-    if (!Object.prototype.hasOwnProperty.call(value, propertyKey)) {
-        return null;
-    }
-
     const FormatComponent = getFormatComponent(format);

     return (
src/react/src/util/util.js (1)

1906-1924: Partner field raw_values/raw_value handling matches backend semantics; small cleanups possible

This function correctly reflects the convention that object‑type partner fields use raw_values while others use raw_value, and it sensibly bypasses stringification when a JSON Schema with properties is present so the schema‑aware renderer can handle URIs. Based on learnings, this aligns with the intended backend behavior.

Two small improvements you might consider:

  • Use optional chaining for the schema properties check (also aligns with the SonarCloud hint around Line 1911).
  • Be explicit that the schema‑driven path is for object‑shaped raw_values, to avoid accidentally treating non‑object values as schema‑driven in the future.

For example:

 export const formatPartnerFieldValue = (fieldValueData, json_schema) => {
     const { raw_values, raw_value } = fieldValueData;

     if (raw_values !== undefined) {
-        if (
-            json_schema &&
-            json_schema.properties &&
-            Object.keys(json_schema.properties).length > 0 &&
-            !Array.isArray(raw_values)
-        ) {
-            return raw_values;
-        }
+        if (
+            json_schema?.properties &&
+            Object.keys(json_schema.properties).length > 0 &&
+            typeof raw_values === 'object' &&
+            raw_values !== null &&
+            !Array.isArray(raw_values)
+        ) {
+            return raw_values;
+        }
         return formatRawValues(raw_values);
     }
     if (raw_value !== undefined) {
         return raw_value;
     }
     return fieldValueData;
 };
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3abbc7d and ad6bdd2.

📒 Files selected for processing (2)
  • src/react/src/components/PartnerFieldSchemaValue.jsx (1 hunks)
  • src/react/src/util/util.js (3 hunks)
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2025-10-31T08:29:48.108Z
Learnt from: VadimKovalenkoSNF
Repo: opensupplyhub/open-supply-hub PR: 781
File: src/react/src/components/InitialClaimFlow/ClaimForm/validationSchemas.js:23-52
Timestamp: 2025-10-31T08:29:48.108Z
Learning: In src/react/src/components/InitialClaimFlow/ClaimForm/validationSchemas.js, the Redux state field `claimantEmploymentVerificationMethod` stores the label (full sentence, e.g., "Company website showing your name and title (e.g., About Us, Team page)") from EMPLOYMENT_VERIFICATION_OPTIONS, not the option value (e.g., "company-website-address"). The validation schema correctly compares against labels.

Applied to files:

  • src/react/src/components/PartnerFieldSchemaValue.jsx
📚 Learning: 2024-12-10T15:07:54.819Z
Learnt from: roman-stolar
Repo: opensupplyhub/open-supply-hub PR: 448
File: src/react/src/util/util.js:1317-1317
Timestamp: 2024-12-10T15:07:54.819Z
Learning: Changes to date handling functions like `formatDate` in `src/react/src/util/util.js` should be made carefully, considering that different parts of the codebase may intentionally use local time instead of UTC, and broad changes to `moment()` usage may not be appropriate without context.

Applied to files:

  • src/react/src/util/util.js
📚 Learning: 2025-02-12T11:45:01.562Z
Learnt from: VadimKovalenkoSNF
Repo: opensupplyhub/open-supply-hub PR: 511
File: src/react/src/util/util.js:1436-1447
Timestamp: 2025-02-12T11:45:01.562Z
Learning: The `generateRangeField` utility function in `src/react/src/util/util.js` is meant for data transformation only. Input validation is handled separately on the frontend for specific input fields.

Applied to files:

  • src/react/src/util/util.js
📚 Learning: 2025-09-25T10:52:27.455Z
Learnt from: roman-stolar
Repo: opensupplyhub/open-supply-hub PR: 757
File: src/django/api/extended_fields.py:186-207
Timestamp: 2025-09-25T10:52:27.455Z
Learning: In partner extended fields, OBJECT_FIELD_TYPE fields use 'raw_values' while other partner field types use 'raw_value'. This is the correct and intended behavior as confirmed by the implementation team.

Applied to files:

  • src/react/src/util/util.js
🧬 Code graph analysis (1)
src/react/src/util/util.js (1)
src/react/src/util/renderUtils.jsx (1)
  • renderUniqueListItems (8-40)
🪛 GitHub Check: SonarCloud Code Analysis
src/react/src/components/PartnerFieldSchemaValue.jsx

[warning] 97-97: Use 'Object.hasOwn()' instead of 'Object.prototype.hasOwnProperty.call()'.

See more on https://sonarcloud.io/project/issues?id=opensupplyhub_open-supply-hub&issues=AZretOGAix4m0SbCn8lu&open=AZretOGAix4m0SbCn8lu&pullRequest=823


[warning] 19-19: Use 'Object.hasOwn()' instead of 'Object.prototype.hasOwnProperty.call()'.

See more on https://sonarcloud.io/project/issues?id=opensupplyhub_open-supply-hub&issues=AZretOGAix4m0SbCn8lt&open=AZretOGAix4m0SbCn8lt&pullRequest=823

src/react/src/util/util.js

[warning] 1911-1912: Prefer using an optional chain expression instead, as it's more concise and easier to read.

See more on https://sonarcloud.io/project/issues?id=opensupplyhub_open-supply-hub&issues=AZretOI1ix4m0SbCn8lv&open=AZretOI1ix4m0SbCn8lv&pullRequest=823

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
  • GitHub Check: run-flake8-linter
  • GitHub Check: run-contricleaner-code-quality
  • GitHub Check: get-base-branch-contricleaner-cov
  • GitHub Check: run-django-code-quality
  • GitHub Check: run-eslint-linter-and-prettier-formatter
  • GitHub Check: run-integration-test-code-quality
  • GitHub Check: run-countries-code-quality
  • GitHub Check: run-dd-code-quality
  • GitHub Check: get-base-branch-dd-cov
  • GitHub Check: get-base-branch-django-cov
  • GitHub Check: get-base-branch-countries-cov
  • GitHub Check: get-base-branch-fe-cov
  • GitHub Check: run-fe-code-quality
🔇 Additional comments (2)
src/react/src/components/PartnerFieldSchemaValue.jsx (1)

19-19: Verify target browser support before adopting Object.hasOwn().

Object.hasOwn() is an ES2022 feature supported in Chrome 93+, Edge 93+, Firefox 92+, Safari 15.4+, but not in Internet Explorer. Since React 16.13.1 targets "modern browsers" without specifying concrete version minimums, many projects still support older environments where Object.hasOwn() is unavailable. If your target browsers include IE or older evergreen versions, stick with Object.prototype.hasOwnProperty.call() or add a polyfill (core-js/es-shims). Check your project's Browserslist configuration to confirm whether ES2022 is viable.

src/react/src/util/util.js (1)

1780-1809: Extended field json_schema wiring and primary value formatting look correct

Accepting json_schema, passing it to formatValue(value, json_schema), and exposing it as jsonSchema in the returned object is coherent with the new schema‑driven rendering and remains backward‑compatible (extra arg to formatValue is ignored by existing single‑param implementations). No changes needed here.

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

🧹 Nitpick comments (3)
src/react/src/components/PartnerFieldSchemaValue.jsx (3)

19-25: Consider optional chaining for cleaner code.

Line 20 could be simplified using optional chaining for better consistency with the rest of the codebase.

Apply this diff:

-    const textPropertyDefined = schemaProperties && schemaProperties[textKey];
+    const textPropertyDefined = schemaProperties?.[textKey];

13-37: Consider adding PropTypes validation.

PropTypes would improve component maintainability and provide runtime validation in development. The same applies to DefaultProperty below.

Add at the top of the file:

import PropTypes from 'prop-types';

Add after the component definitions:

UriProperty.propTypes = {
    propertyKey: PropTypes.string.isRequired,
    value: PropTypes.object.isRequired,
    schemaProperties: PropTypes.object,
};

DefaultProperty.propTypes = {
    propertyKey: PropTypes.string.isRequired,
    value: PropTypes.object.isRequired,
    schemaProperties: PropTypes.object,
};

23-23: Consider using Object.hasOwn() for modern syntax.

Lines 23, 74, and 105 use Object.prototype.hasOwnProperty.call(). The modern Object.hasOwn() (ES2022) is more concise and readable.

Before applying this change, verify browser support requirements match your target environments. If ES2022 support is confirmed, apply:

-        Object.prototype.hasOwnProperty.call(value, textKey)
+        Object.hasOwn(value, textKey)
-    if (!Object.prototype.hasOwnProperty.call(schemaProperties, propertyKey)) {
+    if (!Object.hasOwn(schemaProperties, propertyKey)) {
-    if (!Object.prototype.hasOwnProperty.call(value, propertyKey)) {
+    if (!Object.hasOwn(value, propertyKey)) {

Also applies to: 74-74, 105-105

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ad6bdd2 and f41e18e.

📒 Files selected for processing (2)
  • src/react/src/__tests__/components/PartnerFieldSchemaValue.test.js (1 hunks)
  • src/react/src/components/PartnerFieldSchemaValue.jsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/react/src/tests/components/PartnerFieldSchemaValue.test.js
🧰 Additional context used
🪛 GitHub Check: SonarCloud Code Analysis
src/react/src/components/PartnerFieldSchemaValue.jsx

[warning] 74-74: Use 'Object.hasOwn()' instead of 'Object.prototype.hasOwnProperty.call()'.

See more on https://sonarcloud.io/project/issues?id=opensupplyhub_open-supply-hub&issues=AZre_YQcuQZ3sQy0ArEC&open=AZre_YQcuQZ3sQy0ArEC&pullRequest=823


[warning] 42-42: 'value' is missing in props validation

See more on https://sonarcloud.io/project/issues?id=opensupplyhub_open-supply-hub&issues=AZre_YQcuQZ3sQy0ArEA&open=AZre_YQcuQZ3sQy0ArEA&pullRequest=823


[warning] 42-42: 'propertyKey' is missing in props validation

See more on https://sonarcloud.io/project/issues?id=opensupplyhub_open-supply-hub&issues=AZre_YQcuQZ3sQy0ArD_&open=AZre_YQcuQZ3sQy0ArD_&pullRequest=823


[warning] 13-13: 'schemaProperties' is missing in props validation

See more on https://sonarcloud.io/project/issues?id=opensupplyhub_open-supply-hub&issues=AZre_YQcuQZ3sQy0ArD8&open=AZre_YQcuQZ3sQy0ArD8&pullRequest=823


[warning] 20-20: Prefer using an optional chain expression instead, as it's more concise and easier to read.

See more on https://sonarcloud.io/project/issues?id=opensupplyhub_open-supply-hub&issues=AZre_YQcuQZ3sQy0ArD9&open=AZre_YQcuQZ3sQy0ArD9&pullRequest=823


[warning] 42-42: 'schemaProperties' is missing in props validation

See more on https://sonarcloud.io/project/issues?id=opensupplyhub_open-supply-hub&issues=AZre_YQcuQZ3sQy0ArEB&open=AZre_YQcuQZ3sQy0ArEB&pullRequest=823


[warning] 23-23: Use 'Object.hasOwn()' instead of 'Object.prototype.hasOwnProperty.call()'.

See more on https://sonarcloud.io/project/issues?id=opensupplyhub_open-supply-hub&issues=AZre_YQcuQZ3sQy0ArD-&open=AZre_YQcuQZ3sQy0ArD-&pullRequest=823

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
  • GitHub Check: run-eslint-linter-and-prettier-formatter
  • GitHub Check: run-dd-code-quality
  • GitHub Check: get-base-branch-dd-cov
  • GitHub Check: run-integration-test-code-quality
  • GitHub Check: run-contricleaner-code-quality
  • GitHub Check: get-base-branch-contricleaner-cov
  • GitHub Check: get-base-branch-countries-cov
  • GitHub Check: run-countries-code-quality
  • GitHub Check: run-flake8-linter
  • GitHub Check: get-base-branch-django-cov
  • GitHub Check: run-fe-code-quality
  • GitHub Check: get-base-branch-fe-cov
🔇 Additional comments (3)
src/react/src/components/PartnerFieldSchemaValue.jsx (3)

1-8: LGTM!

Clean constant definition with proper immutability via Object.freeze.


60-63: LGTM!

Clean, extensible registry pattern that makes it easy to add new format types in the future.


126-148: LGTM!

The main component logic is well-structured with appropriate input validation and clean functional composition. The early return pattern for non-object values maintains backward compatibility while enabling schema-driven rendering for object values.

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: 0

🧹 Nitpick comments (2)
src/react/src/components/PartnerFieldSchemaValue.jsx (2)

29-29: Remove redundant key props from component return elements.

The <a> element at line 29 and <span> element at line 50 include key props, but renderProperty already assigns a key to the FormatComponent wrapper at line 115. Since these elements are not in an array/list context within the component, the inner keys serve no purpose and can be safely removed.

Apply this diff:

 const UriProperty = ({ propertyKey, value, schemaProperties }) => {
     // ...
     return (
         <a
-            key={`${propertyKey}-uri-${propertyValue}`}
             href={propertyValue}
             target="_blank"
             rel="noopener noreferrer"
         >
             {linkText}
         </a>
     );
 };
 const DefaultProperty = ({ propertyKey, value, schemaProperties }) => {
     // ...
     return (
-        <span key={`${propertyKey}-default`} style={{ display: 'block' }}>
+        <span style={{ display: 'block' }}>
             {displayText}
         </span>
     );
 };

Also applies to: 50-50


13-13: Consider adding PropTypes validation for component props.

Both UriProperty and DefaultProperty accept propertyKey, value, and schemaProperties props but lack PropTypes validation. While not strictly required in modern React, PropTypes improve maintainability by documenting expected prop shapes and catching type mismatches during development.

Add PropTypes at the end of the file:

import PropTypes from 'prop-types';

// ... existing code ...

UriProperty.propTypes = {
    propertyKey: PropTypes.string.isRequired,
    value: PropTypes.object.isRequired,
    schemaProperties: PropTypes.object,
};

DefaultProperty.propTypes = {
    propertyKey: PropTypes.string.isRequired,
    value: PropTypes.object.isRequired,
    schemaProperties: PropTypes.object,
};

PartnerFieldSchemaValue.propTypes = {
    value: PropTypes.object,
    jsonSchema: PropTypes.shape({
        properties: PropTypes.object,
    }),
};
🧰 Tools
🪛 GitHub Check: SonarCloud Code Analysis

[warning] 42-42: 'value' is missing in props validation

[warning] 42-42: 'propertyKey' is missing in props validation

[warning] 42-42: 'schemaProperties' is missing in props validation

Also applies to: 42-42

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f41e18e and fe1b620.

📒 Files selected for processing (1)
  • src/react/src/components/PartnerFieldSchemaValue.jsx (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-31T08:29:48.108Z
Learnt from: VadimKovalenkoSNF
Repo: opensupplyhub/open-supply-hub PR: 781
File: src/react/src/components/InitialClaimFlow/ClaimForm/validationSchemas.js:23-52
Timestamp: 2025-10-31T08:29:48.108Z
Learning: In src/react/src/components/InitialClaimFlow/ClaimForm/validationSchemas.js, the Redux state field `claimantEmploymentVerificationMethod` stores the label (full sentence, e.g., "Company website showing your name and title (e.g., About Us, Team page)") from EMPLOYMENT_VERIFICATION_OPTIONS, not the option value (e.g., "company-website-address"). The validation schema correctly compares against labels.

Applied to files:

  • src/react/src/components/PartnerFieldSchemaValue.jsx
🪛 GitHub Check: SonarCloud Code Analysis
src/react/src/components/PartnerFieldSchemaValue.jsx

[warning] 46-46: Unexpected negated condition.

See more on https://sonarcloud.io/project/issues?id=opensupplyhub_open-supply-hub&issues=AZrfBM3Uix4m0SbCquWn&open=AZrfBM3Uix4m0SbCquWn&pullRequest=823

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
  • GitHub Check: run-eslint-linter-and-prettier-formatter
  • GitHub Check: get-base-branch-django-cov
  • GitHub Check: run-flake8-linter
  • GitHub Check: run-django-code-quality
  • GitHub Check: get-base-branch-contricleaner-cov
  • GitHub Check: run-countries-code-quality
  • GitHub Check: run-integration-test-code-quality
  • GitHub Check: get-base-branch-dd-cov
  • GitHub Check: run-dd-code-quality
  • GitHub Check: get-base-branch-countries-cov
  • GitHub Check: run-contricleaner-code-quality
  • GitHub Check: run-fe-code-quality
  • GitHub Check: get-base-branch-fe-cov
🔇 Additional comments (3)
src/react/src/components/PartnerFieldSchemaValue.jsx (3)

1-8: LGTM!

Clean imports and well-structured format constants. Using Object.freeze prevents accidental mutations.


56-121: LGTM! Well-architected format handling.

The helper functions demonstrate solid design:

  • Frozen FORMAT_COMPONENTS registry prevents accidental mutations and makes extension points clear
  • shouldSkipProperty correctly filters _text companion fields when their base property uses URI format
  • hasOwnProperty checks guard against prototype pollution
  • Optional chaining provides safe property access
  • Clean separation of concerns with discrete helper functions

The format-based rendering strategy is extensible and maintainable.


123-148: LGTM! Robust input validation and clean rendering pipeline.

The main component demonstrates solid defensive programming:

  • Validates that jsonSchema and value meet requirements before proceeding
  • Gracefully degrades by returning the raw value when schema-based rendering isn't applicable
  • Uses safe property access with optional chaining and fallback to empty object
  • Clean filter/map/filter pipeline produces the rendered items
  • Fragment wrapper avoids unnecessary DOM nesting

The component integrates seamlessly with the helper functions to deliver schema-driven rendering.

Note: The static analysis warning about "negated condition" on line 46 is a false positive—the != null pattern is idiomatic JavaScript for checking both null and undefined.

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.

Request few changes, pls check.

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

🧹 Nitpick comments (3)
src/react/src/components/PartnerFields/UriProperty.jsx (2)

12-17: Use optional chaining for cleaner code.

As noted by static analysis, the condition on line 13 can be simplified using optional chaining.

-    const textPropertyDefined = schemaProperties && schemaProperties[textKey];
+    const textPropertyDefined = schemaProperties?.[textKey];

19-27: Consider validating URI protocol to prevent potential XSS.

While the rel="noopener noreferrer" is correctly used, propertyValue is directly used as href. If malicious data with javascript: protocol is passed, it could execute scripts. Consider validating that the URI uses an allowed protocol (e.g., http:, https:).

+const isValidUri = uri => {
+    try {
+        const url = new URL(uri);
+        return ['http:', 'https:'].includes(url.protocol);
+    } catch {
+        return false;
+    }
+};
+
 const UriProperty = ({ propertyKey, value, schemaProperties }) => {
     const propertyValue = value[propertyKey];
-    if (!propertyValue) {
+    if (!propertyValue || !isValidUri(propertyValue)) {
         return null;
     }
src/react/src/components/PartnerFields/utils.js (1)

14-33: Logic is correct and handles edge cases safely.

The function correctly identifies properties to skip based on schema presence and URI format logic. The optional chaining in getFormatFromSchema ensures safe handling of undefined schemas.

Optional: Consider extracting the magic number for clarity.

Line 23 uses -5 to remove the _text suffix. While this is correct, you could make it more explicit:

+const TEXT_SUFFIX = '_text';
+
 export const shouldSkipProperty = (propertyKey, schemaProperties) => {
     if (!(propertyKey in schemaProperties)) {
         return true;
     }
 
-    if (propertyKey.endsWith('_text')) {
-        const baseKey = propertyKey.slice(0, -5);
+    if (propertyKey.endsWith(TEXT_SUFFIX)) {
+        const baseKey = propertyKey.slice(0, -TEXT_SUFFIX.length);
         const baseSchema = schemaProperties[baseKey];
         const baseFormat = getFormatFromSchema(baseSchema);
 
         if (baseFormat === FORMAT_TYPES.URI) {
             return true;
         }
     }
 
     return false;
 };
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fe1b620 and 4c1f357.

📒 Files selected for processing (8)
  • src/react/src/__tests__/components/PartnerFieldSchemaValue.test.js (1 hunks)
  • src/react/src/__tests__/utils.tests.js (1 hunks)
  • src/react/src/components/FacilityDetailsDetail.jsx (3 hunks)
  • src/react/src/components/PartnerFields/DefaultProperty.jsx (1 hunks)
  • src/react/src/components/PartnerFields/PartnerFieldSchemaValue.jsx (1 hunks)
  • src/react/src/components/PartnerFields/UriProperty.jsx (1 hunks)
  • src/react/src/components/PartnerFields/utils.js (1 hunks)
  • src/react/src/util/util.js (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/react/src/util/util.js
  • src/react/src/tests/components/PartnerFieldSchemaValue.test.js
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2025-02-12T11:45:01.562Z
Learnt from: VadimKovalenkoSNF
Repo: opensupplyhub/open-supply-hub PR: 511
File: src/react/src/util/util.js:1436-1447
Timestamp: 2025-02-12T11:45:01.562Z
Learning: The `generateRangeField` utility function in `src/react/src/util/util.js` is meant for data transformation only. Input validation is handled separately on the frontend for specific input fields.

Applied to files:

  • src/react/src/components/PartnerFields/utils.js
  • src/react/src/__tests__/utils.tests.js
📚 Learning: 2024-12-10T15:07:54.819Z
Learnt from: roman-stolar
Repo: opensupplyhub/open-supply-hub PR: 448
File: src/react/src/util/util.js:1317-1317
Timestamp: 2024-12-10T15:07:54.819Z
Learning: Changes to date handling functions like `formatDate` in `src/react/src/util/util.js` should be made carefully, considering that different parts of the codebase may intentionally use local time instead of UTC, and broad changes to `moment()` usage may not be appropriate without context.

Applied to files:

  • src/react/src/components/PartnerFields/utils.js
  • src/react/src/__tests__/utils.tests.js
📚 Learning: 2025-10-31T08:29:48.108Z
Learnt from: VadimKovalenkoSNF
Repo: opensupplyhub/open-supply-hub PR: 781
File: src/react/src/components/InitialClaimFlow/ClaimForm/validationSchemas.js:23-52
Timestamp: 2025-10-31T08:29:48.108Z
Learning: In src/react/src/components/InitialClaimFlow/ClaimForm/validationSchemas.js, the Redux state field `claimantEmploymentVerificationMethod` stores the label (full sentence, e.g., "Company website showing your name and title (e.g., About Us, Team page)") from EMPLOYMENT_VERIFICATION_OPTIONS, not the option value (e.g., "company-website-address"). The validation schema correctly compares against labels.

Applied to files:

  • src/react/src/components/FacilityDetailsDetail.jsx
📚 Learning: 2024-12-05T10:43:59.922Z
Learnt from: Innavin369
Repo: opensupplyhub/open-supply-hub PR: 437
File: src/react/src/components/Filters/StyledSelect.jsx:31-39
Timestamp: 2024-12-05T10:43:59.922Z
Learning: In the `StyledSelect` component (`src/react/src/components/Filters/StyledSelect.jsx`), the `label` prop is optional. The `InputLabel` should be conditionally rendered only when a label is provided to prevent unnecessary DOM elements, extra padding, and browser console warnings.

Applied to files:

  • src/react/src/components/FacilityDetailsDetail.jsx
🧬 Code graph analysis (5)
src/react/src/components/PartnerFields/UriProperty.jsx (3)
src/react/src/components/PartnerFields/DefaultProperty.jsx (1)
  • propertyValue (7-7)
src/react/src/__tests__/utils.tests.js (1)
  • value (771-771)
src/react/src/components/PartnerFields/PartnerFieldSchemaValue.jsx (1)
  • schemaProperties (56-56)
src/react/src/components/PartnerFields/utils.js (2)
src/react/src/components/PartnerFields/DefaultProperty.jsx (2)
  • propertySchema (8-8)
  • propertySchema (9-9)
src/react/src/components/PartnerFields/PartnerFieldSchemaValue.jsx (2)
  • propertySchema (29-29)
  • schemaProperties (56-56)
src/react/src/components/FacilityDetailsDetail.jsx (2)
src/react/src/components/PartnerFields/PartnerFieldSchemaValue.jsx (1)
  • PartnerFieldSchemaValue (46-70)
src/react/src/util/util.js (1)
  • primary (1792-1795)
src/react/src/components/PartnerFields/PartnerFieldSchemaValue.jsx (3)
src/react/src/components/PartnerFields/utils.js (6)
  • FORMAT_TYPES (4-6)
  • FORMAT_TYPES (4-6)
  • getFormatFromSchema (11-12)
  • getFormatFromSchema (11-12)
  • shouldSkipProperty (17-33)
  • shouldSkipProperty (17-33)
src/react/src/components/PartnerFields/UriProperty.jsx (1)
  • UriProperty (6-29)
src/react/src/components/PartnerFields/DefaultProperty.jsx (3)
  • DefaultProperty (6-18)
  • propertySchema (8-8)
  • propertySchema (9-9)
src/react/src/__tests__/utils.tests.js (1)
src/react/src/util/util.js (2)
  • formatPartnerFieldValue (1906-1926)
  • formatPartnerFieldValue (1906-1926)
🪛 GitHub Check: SonarCloud Code Analysis
src/react/src/components/PartnerFields/UriProperty.jsx

[warning] 6-6: 'propertyKey' is missing in props validation

See more on https://sonarcloud.io/project/issues?id=opensupplyhub_open-supply-hub&issues=AZrfoyutVTACxFqvg7vt&open=AZrfoyutVTACxFqvg7vt&pullRequest=823


[warning] 6-6: 'schemaProperties' is missing in props validation

See more on https://sonarcloud.io/project/issues?id=opensupplyhub_open-supply-hub&issues=AZrfoyutVTACxFqvg7vv&open=AZrfoyutVTACxFqvg7vv&pullRequest=823


[warning] 6-6: 'value' is missing in props validation

See more on https://sonarcloud.io/project/issues?id=opensupplyhub_open-supply-hub&issues=AZrfoyutVTACxFqvg7vu&open=AZrfoyutVTACxFqvg7vu&pullRequest=823


[warning] 13-13: Prefer using an optional chain expression instead, as it's more concise and easier to read.

See more on https://sonarcloud.io/project/issues?id=opensupplyhub_open-supply-hub&issues=AZrfoyutVTACxFqvg7vw&open=AZrfoyutVTACxFqvg7vw&pullRequest=823

src/react/src/components/PartnerFields/DefaultProperty.jsx

[warning] 6-6: 'value' is missing in props validation

See more on https://sonarcloud.io/project/issues?id=opensupplyhub_open-supply-hub&issues=AZrfoyukVTACxFqvg7vq&open=AZrfoyukVTACxFqvg7vq&pullRequest=823


[warning] 6-6: 'propertyKey' is missing in props validation

See more on https://sonarcloud.io/project/issues?id=opensupplyhub_open-supply-hub&issues=AZrfoyukVTACxFqvg7vp&open=AZrfoyukVTACxFqvg7vp&pullRequest=823


[warning] 10-10: Unexpected negated condition.

See more on https://sonarcloud.io/project/issues?id=opensupplyhub_open-supply-hub&issues=AZrfoyukVTACxFqvg7vs&open=AZrfoyukVTACxFqvg7vs&pullRequest=823


[warning] 6-6: 'schemaProperties' is missing in props validation

See more on https://sonarcloud.io/project/issues?id=opensupplyhub_open-supply-hub&issues=AZrfoyukVTACxFqvg7vr&open=AZrfoyukVTACxFqvg7vr&pullRequest=823

src/react/src/components/PartnerFields/PartnerFieldSchemaValue.jsx

[warning] 56-56: 'jsonSchema.properties' is missing in props validation

See more on https://sonarcloud.io/project/issues?id=opensupplyhub_open-supply-hub&issues=AZrfoyrVVTACxFqvg7vo&open=AZrfoyrVVTACxFqvg7vo&pullRequest=823


[warning] 46-46: 'value' is missing in props validation

See more on https://sonarcloud.io/project/issues?id=opensupplyhub_open-supply-hub&issues=AZrfoyrVVTACxFqvg7vm&open=AZrfoyrVVTACxFqvg7vm&pullRequest=823


[warning] 46-46: 'jsonSchema' is missing in props validation

See more on https://sonarcloud.io/project/issues?id=opensupplyhub_open-supply-hub&issues=AZrfoyrVVTACxFqvg7vn&open=AZrfoyrVVTACxFqvg7vn&pullRequest=823

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
  • GitHub Check: run-flake8-linter
  • GitHub Check: get-base-branch-countries-cov
  • GitHub Check: run-eslint-linter-and-prettier-formatter
  • GitHub Check: run-integration-test-code-quality
  • GitHub Check: run-contricleaner-code-quality
  • GitHub Check: run-dd-code-quality
  • GitHub Check: get-base-branch-dd-cov
  • GitHub Check: get-base-branch-contricleaner-cov
  • GitHub Check: run-countries-code-quality
  • GitHub Check: run-django-code-quality
  • GitHub Check: get-base-branch-django-cov
  • GitHub Check: run-fe-code-quality
  • GitHub Check: get-base-branch-fe-cov
🔇 Additional comments (6)
src/react/src/components/FacilityDetailsDetail.jsx (1)

89-96: LGTM! Conditional rendering correctly delegates to schema-based rendering.

The conditional logic properly uses PartnerFieldSchemaValue when jsonSchema is provided, falling back to the original primary || locationLabeled behavior otherwise. The PartnerFieldSchemaValue component handles falsy values gracefully by returning them directly.

src/react/src/__tests__/utils.tests.js (1)

2835-2860: Test may pass for unintended reasons - verify intended behavior.

Based on the formatPartnerFieldValue implementation in the relevant code snippet, when raw_value (singular) is present, it's returned directly without considering jsonSchema. The schema-aware path only applies to raw_values (plural) when it's a non-array object.

If the intent is to test schema-aware formatting, consider using raw_values instead:

-        const value = {
-            raw_value: {
-                url: 'https://example.com/report',
-                url_text: 'View Report',
-            },
-        };
+        const value = {
+            raw_values: {
+                url: 'https://example.com/report',
+                url_text: 'View Report',
+            },
+        };
src/react/src/components/PartnerFields/DefaultProperty.jsx (1)

6-17: LGTM! Clean implementation with appropriate fallbacks.

The component correctly:

  • Handles missing schema with fallback to empty object
  • Safely converts values to strings with null/undefined handling
  • Conditionally includes title prefix when available

The key prop on line 14 is redundant since the parent already provides a key, but it's harmless.

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

58-67: Rendering logic is well-structured.

The reduce pattern cleanly aggregates rendered items while respecting the skip logic. The null check on line 63 is defensive, though renderProperty always returns a React element.

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

1-6: LGTM!

The FORMAT_TYPES constant is well-defined and clearly documents the supported format types.


8-12: LGTM!

The function correctly uses optional chaining to safely extract the format from the property schema, returning null when format is not present.

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.

Approved 👍

@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 3, 2025

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