Skip to content

builtins: "deprecated" field should be exported #7912

@anderseknert

Description

@anderseknert

Extracting available built-in functions from the serialized form of OPA's capabilities struct (i.e. a "capabilities.json" file) provides applications most of the data they'll need about any given built-in function. However, this data crucially does not include the deprecated attribute, as that's not an exported field on the struct. Applications integrating via the Go API can use the IsDeprecated method to get this information (although why that's needed when e.g. Nondeterministic is an exported field, I don't know), but that obviously does little to help other types of integrations making use of capabilities.

My suggestion is that the deprecated field is renamed Deprecated, and that at least built-ins where this value is true includes that data in their serialized form.

If there are any concerns around adding a new exported field to the built-in struct, then we could at least consider custom JSON marshalling/unmarshalling methods that includes this field in serialization.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions