Skip to content

cel: support Extension.Subset in Lib, OptionalTypes, and ToConfig - #1677

Open
itzPranshul wants to merge 1 commit into
cel-expr:masterfrom
itzPranshul:feat/extension-subset
Open

itzPranshul wants to merge 1 commit into
cel-expr:masterfrom
itzPranshul:feat/extension-subset

Conversation

@itzPranshul

Copy link
Copy Markdown
Contributor

Follow-up to #1645 adding core Extension.Subset support in cel so any LibrarySubsetter extension can be subsetted and round-tripped through Env.ToConfig().

Changes

  • cel/library.go:
    • Updated Lib(l Library) to handle LibrarySubsetter generically: validates LibrarySubset, skips registration when Disabled is true, and filters macros, functions, and newly added overloads via applyLibrarySubset.
    • Added OptionalTypesSubset and (*optionalLib).LibrarySubset().
  • cel/options.go:
    • Wired ext.Subset (including Disabled) for "optional" in configToEnvOptions.
  • cel/env.go:
    • Updated Env.ToConfig() to serialize LibrarySubset onto env.Extension for LibrarySubsetter extensions.
  • cel/env_test.go:
    • Added TestEnvOptionalExtensionSubset covering macro/function exclusion, Disabled, and ToConfig() round-tripping.

Note: Wiring *Subset into ext.ExtensionOptionFactory and ext/ libraries will follow in a separate PR.

Refs #1131

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant