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

[Bug]: Incorrect document generated for a record with multiple included records #43503

Open
TharmiganK opened this issue Feb 16, 2024 · 1 comment

Comments

@TharmiganK
Copy link
Contributor

TharmiganK commented Feb 16, 2024

Description

When we have included multiple private records in another record and call bal doc to generate the document, the generated document has two rest parameter types which are inferred from the private included records. But there should be only one rest parameter.

Steps to Reproduce

Sample Ballerina code:

type Record1 record {
    int a;
    string b;
};

type Record2 record {
    boolean c;
    string[] d;
};

public type Record record {
    *Record2;
    *Record1;
    float e;
};

The Generated record documentation:
Screenshot 2024-02-16 at 10 23 59

Affected Version(s)

Ballerina SwanLake Update 8

OS, DB, other environment details and versions

No response

Related area

-> API Docs

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

@ballerina-bot ballerina-bot transferred this issue from ballerina-platform/ballerina-lang Feb 16, 2024
@TharmiganK
Copy link
Contributor Author

Notice an inconsistency in showing rest field

  • The rest parameter is not documented for inclusive record definition:

    public type OpenRecord record {      
        int a;
        string b;
    };
    Screenshot 2024-02-16 at 10 43 57
  • The rest parameter is shown when we have a exclusive record definition with a rest parameter. But there are inconsistencies when the rest field is another type

  • public type ClosedRecordWithAnyData record {|     
        int a;
        string b;
        anydata...;
    |};
    Screenshot 2024-02-16 at 10 48 30
    public type ClosedRecordWithString record {|
        int a;
        string b;
        string...;
    |};
    Screenshot 2024-02-16 at 10 49 18
    public type PublicRecord record {|
        int a;
        string b;
        record {boolean c; string[] d;}...;
    |};
    Screenshot 2024-02-16 at 11 20 36
    public type PublicRecord record {|
        int a;
        string b;
        Record...; // public
    |};
    Screenshot 2024-02-16 at 11 23 22

    We should decide on a proper way to document the rest field for a record type. Having anydata... does not make much sense for a included record. Having anydata... Rest Field is fine but can we do better?

    CC: @MaryamZi @SasinduDilshara @sm1990

@anupama-pathirage anupama-pathirage transferred this issue from ballerina-platform/ballerina-dev-tools Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

No branches or pull requests

3 participants