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

Needs to get the default value of an input parameter in a resource function #30106

Closed
ThisaruGuruge opened this issue Apr 20, 2021 · 9 comments
Closed
Assignees
Labels
Priority/High Team/jBallerina All the issues related to BIR, JVM backend code generation and runtime Type/Improvement

Comments

@ThisaruGuruge
Copy link
Member

Description:
When there is an input parameter with a default value in a resource function, there should be a way to get the default value of this parameter. This is a requirement for the Ballerina GraphQL package implementation.

Related: #27417, ballerina-platform/ballerina-library#1266

@hasithaa
Copy link
Contributor

Do you need this during the runtime or compile time? Default values will be captured as closures. So you can't get a value unless it is a constant value during the compile time. At runtime, you have to manually evaluate the closure to get the value. But that is dangerous because closures can mutate the state.

Can you summarize the use case here?

@ThisaruGuruge
Copy link
Member Author

Currently, we create the GraphQL schema for a given service at the runtime, since we don't have a direct way to create the schema at the compile time and propagate that to the runtime.

The use case of this specific scenario is that we need the default values of the input parameters to support GraphQL introspection. When a resource function has an input parameter, it maps to an InputValue type in GraphQL. If there is a default value for that input value, GraphQL clients should be able to query the GraphQL endpoint and view the default value of a given input value. Currently, we do not have a way to get this default value. (ballerina-platform/ballerina-library#1377)

@ThisaruGuruge
Copy link
Member Author

Any update on this?

@rdhananjaya
Copy link
Member

@chiranSachintha Can we do this after function default value change? I mean technically jBallerina backend team only need to provide an API to access the closures right?

@ThisaruGuruge
Copy link
Member Author

Hi, any update on this?

@rdhananjaya
Copy link
Member

@warunalakshitha can you look into this?

@ThisaruGuruge
Copy link
Member Author

Any update on this? We cannot fix ballerina-platform/ballerina-library#1377 without this.

@gimantha
Copy link
Contributor

Any update on this? We cannot fix ballerina-platform/ballerina-standard-library#1377 without this.

We are still working on passing default values to runtime( Can be tracked via #36020) We will update on the progress

@warunalakshitha
Copy link
Contributor

Closing the issue since #36020 is done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority/High Team/jBallerina All the issues related to BIR, JVM backend code generation and runtime Type/Improvement
Projects
None yet
Development

No branches or pull requests

5 participants