You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let a schema allow every orderable relation at once (v0.19.2).
Ordering through a row-scoped relation is refused so a sort cannot rank rows
the caller may not read, and the override names the relations individually.
That reads well by hand and not at all for a schema that generates its order
inputs in a loop: the traversable names only exist once the type is built, so
there is nothing to name at the call site.
allow_scoped_ordering=True opts the whole order input in. Naming relations
stays the better habit, since it keeps the decision visible one relation at a
time, but a codebase that has decided every readable parent implies a readable
child can now say so once.
Co-authored-by: Cursor <cursoragent@cursor.com>
Copy file name to clipboardExpand all lines: README.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -648,6 +648,8 @@ class PostOrder:
648
648
649
649
`allow_scoped_ordering` only lifts the ordering restriction for the relations you name, on that one order input. `scope_rows` keeps scoping reads and filter traversal exactly as before, and another order input over the same model is unaffected. Naming a relation the order input cannot sort through is an error, so typos fail loudly.
650
650
651
+
Pass `allow_scoped_ordering=True` to allow every relation that order input can sort through. Naming them one by one is the better habit — it keeps the decision visible per relation — but the names only exist once the type is built, so a schema generating its order inputs in a loop cannot list them. Reach for it when you have decided the rule holds across the model: every readable parent implies a readable child.
652
+
651
653
If you build with `strawberry.Schema` directly instead of `orm.schema()`, the build-time check does not run; the offending query is rejected at execution instead.
0 commit comments