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

Improve JSON to Record Conversion #43482

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

Shadow-Devil
Copy link
Contributor

Purpose

I modified both json-mapper and json-to-record-converter (in the Language Server) to have the desired behaviour from the issue. Records are now always closed and might have a rest field with json...;. Also, no any or anydata is produced but only json.

Fixes #42610

Approach

Describe how you are implementing the solutions along with the design details.

Samples

Provide high-level details about the samples related to this feature.

Remarks

List any other known issues, related PRs, TODO items, or any other notes related to the PR.

Check List

  • Read the Contributing Guide
  • Updated Change Log
  • Checked Tooling Support (#)
  • Added necessary tests
    • Unit Tests
    • Spec Conformance Tests
    • Integration Tests
    • Ballerina By Example Tests
  • Increased Test Coverage
  • Added necessary documentation
    • API documentation
    • Module documentation in Module.md files
    • Ballerina By Examples


TypeDescriptorNode nonAnyDataNode = null;
TypeDescriptorNode nonJSONDataNode = null;
Copy link
Member

Choose a reason for hiding this comment

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

Shall we follow the standard camelCase?

Suggested change
TypeDescriptorNode nonJSONDataNode = null;
TypeDescriptorNode nonJsonDataNode = null;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, I will fix that soon

@AzeemMuzammil
Copy link
Member

There is a checkstyle failure as well, shall we check that as well?

@Shadow-Devil
Copy link
Contributor Author

I was a bit unsure about the open/closeness of the records since in the json-mapper the isClosed is also applied into inner records but in the language server json-to-record-converter this is only applied on the outer most level and all inner records were open. I now adjusted the language server module to be the same as json-mapper since I think this approach makes more sense.

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.

[Improvement]: Improvements to JSON to record conversion
3 participants