Skip to content

Handle nullable route binding columns - #299

Merged
joetannenbaum merged 1 commit into
nextfrom
nullable-route-binding-fix
Aug 10, 2026
Merged

Handle nullable route binding columns#299
joetannenbaum merged 1 commit into
nextfrom
nullable-route-binding-fix

Conversation

@joetannenbaum

Copy link
Copy Markdown
Collaborator

A model whose binding column is nullable (say {post:slug} where slug is nullable) produced arguments typed string | null, and the generated url() method then failed to compile: applyUrlDefaults() only takes UrlDefaults | undefined, and .toString() was called on a value that might be null.

Null is now dropped from the scalar argument forms, since a URL can never carry a null segment, so passing null directly is a type error. Objects keep the nullable column so a model can still be passed straight through, and the generated body sends the value through a new requireParameter() helper that throws if it really is null. The check runs after the ?? fallback, so URL defaults still win.

@joetannenbaum
joetannenbaum merged commit 67fffcf into next Aug 10, 2026
11 checks passed
@joetannenbaum
joetannenbaum deleted the nullable-route-binding-fix branch August 10, 2026 22:00
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