-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Support named function arguments for documentation and tooling #4080
Comments
This issue has been automatically marked as inactive because it has not had any activity in the last 30 days. |
Given we had this, an entry in the capabilities file might look something like the below: {
"name": "abs",
"description": "return the absolute value of x",
"wasm_supported": true,
"introduced_in": "v0.11.0",
"decl": {
"args": [
{
"name": "x",
"type": "number",
"description": "the number to return in absolute form"
}
],
"result": {
"type": "number",
"description": "the absolute value of x"
},
"type": "function"
}
} This would be easy to use as a source for e.g. both the policy reference docs as well as VS Code, Playground, etc. Wasm support could be determined from https://github.com/open-policy-agent/opa/blob/v0.36.1/internal/compiler/wasm/wasm.go#L83-L176 As @srenatus pointed out, |
🤔 I'd propose the "introduced in" section to be changed just a bit:
or perhaps putting all of that into an extra key,
|
This issue has been automatically marked as inactive because it has not had any activity in the last 30 days. |
Yay or nay? I think yay. Let's do this. For context, in some WIP I'm adding names to the function arguments and return values -- I have not taken on the extra desirables about version (wasm) support yet. |
Definitely yay! |
Fixed by #4705 |
What part of OPA would you like to see improved?
In order to leverage features like tool tips, auto-suggestions and in-line documentation in the various tools used for policy authoring, it would be useful if OPA supported named function arguments, and that these names got included in the capabilities.json file included with each release (as that's easily parsed by that type of tools).
Some considerations:
argX
or similar.Out of scope:
startswith(str="abcd", prefix="ab")
. This is mainly for documentation and tooling.The text was updated successfully, but these errors were encountered: