Skip to content

feat(extensions)!: improve argument handling - #203

Merged
wackywendell merged 6 commits into
mainfrom
wendell/extension-argument-handling
Aug 13, 2026
Merged

feat(extensions)!: improve argument handling#203
wackywendell merged 6 commits into
mainfrom
wendell/extension-argument-handling

Conversation

@wackywendell

@wackywendell wackywendell commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Description

This changes the ExtensionArgs interface to follow standard Option usage / naming more closely, for ease of use:

fn from_args(args: &ExtensionArgs) -> Result<Self, ExtensionError> {
    let mut args = args.extractor();
    let path = args.expect_named::<&str>("path")?.to_owned();
    let batch_size = args.get_named::<i64>("batch_size")?.unwrap_or(1024);
    args.check_exhausted()?;
    Ok(Self { path, batch_size })
}

Also updates to error handling for extension errors, the addition of ExtensionValue::Null, and some GRAMMAR.md updates

Changes

  • Replaces get_named_or with get_named::<T>() -> Result<Option<T>, ExtensionError> and renames expect_named_arg to expect_named.
  • Includes the argument name in conversion errors, for example Invalid named argument 'count': ....
  • Adds ExtensionValue::Null for a present, untyped null extension value. Typed nulls such as null:i64? remain expressions.
  • Adds ExtensionValue::Error, allowing one malformed field to render as a local failure token without losing later arguments.
  • Added Fetch and Cast to GRAMMAR.md, since they weren't there...

API impact

This is a breaking public API change:

  • get_named_or is removed (in favor of get_named(...).unwrap_or(...), more standard Option naming) and expect_named_arg is renamed to expect_named.
  • ExtensionValue and ExtensionValueKind have new Null and Error variants, which affects exhaustive matches.

@wackywendell wackywendell changed the title Improve extension argument handling feat(extensions): improve argument handling Aug 7, 2026
@wackywendell wackywendell changed the title feat(extensions): improve argument handling feat(extensions)!: improve argument handling Aug 7, 2026
@wackywendell
wackywendell force-pushed the wendell/extension-argument-handling branch from 633f579 to 1d354bb Compare August 10, 2026 15:32
@wackywendell
wackywendell force-pushed the wendell/extension-argument-handling branch 4 times, most recently from 360b355 to 41768ba Compare August 12, 2026 19:54
@wackywendell
wackywendell force-pushed the wendell/extension-argument-handling branch from 41768ba to 3205845 Compare August 12, 2026 20:13
@wackywendell
wackywendell marked this pull request as ready for review August 12, 2026 20:14
@wackywendell
wackywendell requested a review from a team as a code owner August 12, 2026 20:14
@wackywendell
wackywendell merged commit 861ed65 into main Aug 13, 2026
4 checks passed
@wackywendell
wackywendell deleted the wendell/extension-argument-handling branch August 13, 2026 15:07
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.

2 participants