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

[Improvement]: Improvements to JSON to record conversion #42610

Open
MaryamZi opened this issue Apr 22, 2024 · 2 comments · May be fixed by #43482
Open

[Improvement]: Improvements to JSON to record conversion #42610

MaryamZi opened this issue Apr 22, 2024 · 2 comments · May be fixed by #43482

Comments

@MaryamZi
Copy link
Member

MaryamZi commented Apr 22, 2024

Description

$title.

Describe your problem(s)

For

{
    "a": 1, 
    "b": "str",
    "c": null
}

we generate

type NewRecord record {
    int a;
    string b;
    anydata c;
};

Describe your solution(s)

At the moment,

  1. when there are null values, the relevant field is generated as anydata, why not use json?
  2. the generated records are inclusive record typedescs, open by anydata. Can't we generate exclusive record typedescs with json as the rest descriptor instead?

This way, the generated record will also be a subtype of json.

type NewRecord record {|
    int a;
    string b;
    json c;
    json...;
|};

Related area

-> Other Area

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

@Shadow-Devil
Copy link
Contributor

Hey @azinneera, do you think this issue could also be included into the hacktoberfest? If yes, I would like to work on it and be assigned :)

@azinneera
Copy link
Contributor

Sure, I have assigned you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

3 participants