ballerina-platform / ballerina-lang

The Ballerina Programming Language
https://ballerina.io/
Apache License 2.0
3.66k stars 750 forks source link

[Bug]: Missing Record Field Documentations in `RecordFieldSymbol` #39219

Open DimuthuMadushan opened 1 year ago

DimuthuMadushan commented 1 year ago

Description

Currently, the GraphQL module access the Ballerina documentation to generate the GraphQL schema documentation. To get the record field documentation, we access RrecordFieldSymbol at the compiler plugin. But the documentation of the records fields is missing in the RecordFieldSymbol if the records are defined as follows.

# The review input type
#
# + stars - Num of stars
# + commentary - Review Commentary
public type ReviewInput record {
    int stars;
    string commentary;
};

The RecordFieldSymbol include the doc comments only if the documentation is done in-line. Ex:

# The review input type
public type ReviewInput record {
    # Num of stars
    int stars;
    # Review Commentary
    string commentary;
};

Affected Version(s)

2201.3.0

ThisaruGuruge commented 1 year ago

Is there any update on this? This is affecting the GraphQL schema generation, as we have to access the doc comments inorder to add them to the generated schema.

I've seen we are recommending the users to use inline doc comments in the record types, but that approach doesn't work in GraphQL.

ThisaruGuruge commented 5 months ago

@tharindu-nw any update on this? This is bad UX since we suggest users to use in-line documentation, but it doesn't work with GraphQL documentation. This should be fixed soon.

MaryamZi commented 5 months ago

For GraphQL is the original example/statement still correct? My observation was the opposite, as mentioned in https://github.com/ballerina-platform/ballerina-library/issues/6313.

If the original was correct, is it still the case? Can't we at least access it via the io.ballerina.compiler.api.impl.symbols.BallerinaTypeDefinitionSymbol when documented at type definition level (as opposed to field level)? cc @dulajdilshan

DimuthuMadushan commented 5 months ago

@MaryamZi In the original example, ReviewInput is a input parameter type(That detail was missed in the original statement). Your observation is also correct for output types.

dulajdilshan commented 5 months ago

For GraphQL is the original example/statement still correct? My observation was the opposite, as mentioned in ballerina-platform/ballerina-library#6313.

If the original was correct, is it still the case? Can't we at least access it via the io.ballerina.compiler.api.impl.symbols.BallerinaTypeDefinitionSymbol when documented at type definition level (as opposed to field level)? cc @dulajdilshan

We can access via documentation() API of the io.ballerina.compiler.api.symbols.TypeDefinitionSymbol.