Skip to content

Conversation

@Le-Caignec
Copy link
Contributor

@Le-Caignec Le-Caignec commented Jun 30, 2025

This file is designed to parse the JSON schema emitted on-chain and display it in the subgraph. Like that :
Capture d’écran 2025-06-30 à 10 57 56

Bug Description
The issue arises when some fields in the schema contain an empty JSON object (e.g., "field":{}). These cases are not currently handled properly and result in a rendering/display bug.

Fix Summary
This fix addresses the issue by correctly handling fields with empty JSON objects, ensuring the schema is displayed as expected.

@Le-Caignec Le-Caignec self-assigned this Jun 30, 2025
@Le-Caignec Le-Caignec marked this pull request as ready for review June 30, 2025 08:51

if (entry.value.kind == JSONValueKind.OBJECT) {
const object = entry.value.toObject();
for (let i = 0; i < object.entries.length; i++) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This for loop is a mistake. We shouldn’t keep it, I think.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok, I don't have the history of this

Copy link
Member

Choose a reason for hiding this comment

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

@Le-Caignec do you remember why was it added?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no i think it's an issue

@zguesmi zguesmi requested a review from Copilot June 30, 2025 09:00
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a bug that causes rendering issues when encountering empty JSON objects by adding a check to prevent unnecessary recursive parsing.

  • Removes a redundant loop over object entries and adds a condition to check for non-empty objects before recursion.
  • Improves both the clarity and efficiency of the recursive parsing function.

Copy link
Member

@PierreJeanjacquot PierreJeanjacquot left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +8 to +10
runs-on:
group: Azure_runners
labels: [ self-hosted, Linux, X64 ]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need runner connected to iexec infra to make deployment

it('should work as expected', async () => {
// --- GIVEN
const dataProtector = new IExecDataProtector();
const dataProtector = new IExecDataProtector(...getTestConfig());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was connected to the production subgraph, causing the test to fail.

@Le-Caignec Le-Caignec merged commit 5367bb3 into main Jun 30, 2025
4 of 5 checks passed
@Le-Caignec Le-Caignec deleted the fix/nested-empty-json branch June 30, 2025 13:44
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