Skip to content

Way to extend builtin functions without compiling a custom version of OPA? #364

Answered by srenatus
jondot asked this question in Wasm
Discussion options

You must be logged in to vote

Short answer: Capabilities! If you create a capabilities.json with your builtin added, then opa build -t wasm --capabilities my-caps.json will build a wasm module that understands that semver.is_match is an SDK-dependant builtin function.

An easy way to generate said capabilities file is probably to run opa capabilities --current with your own opa version you've mentiond above. You'll only need to do that once, and you can reuse the capabilities.json file for a while (until OPA has another builtin that isn't yet in your capabilities.json but that you'd like to use).

All that said, semver.is_match sounds like a very reasonable builtin to have in upstream OPA, too. That wouldn't come with a…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jondot
Comment options

Answer selected by jondot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Wasm
Labels
None yet
2 participants