Repository navigation
fix(schema): handle field named 'required' in strict mode - #6240
user-Param wants to merge 1 commit into
Conversation
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
|
def-Param seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
There was a problem hiding this comment.
No issues found across 2 files
Heads up: you’re close to your flex budget. Increase your flex budget so reviews don’t pause.
View guided diff | Re-trigger cubic
|
@gregpr07 Could you please review this PR? All tests pass and the fix addresses a real issue. Thank you! |
|
Thanks for addressing #6209. I found two review points before merge:
|
|
Thanks for the review, @r266-tech!
The PR is now focused solely on the schema fix (#6209) with a regression test. Ready for re-review. |
|
Thanks for the review, @r266-tech! Update on both points:
PR #6240 is now focused solely on the schema fix (#6209) with a regression test. PR #6239 has its own targeted tests. Ready for re-review. |
…e#6209) The _make_strict_compatible loop skipped dict/list values under a key named 'required' (thinking it was the schema's required array). When a user field is literally named 'required' and contains a nested model, that nested model's properties were never processed for strict mode. Changed the loop to iterate over schema.values() instead of schema.items(), so every dict/list value is recursed into regardless of its key name. Also adds regression test test_optimizer_handles_field_named_required_in_strict_mode. Fixes browser-use#6209.
d8edf42 to
ab11bf2
Compare
|
Thanks for the review, @r266-tech! Both points addressed:
This PR now contains only the schema fix (#6209) + regression test. Ready for re-review. |
|
Re-reviewed exact head ab11bf2. The change is now limited to _make_strict_compatible and the regression test. Recursing into the required keyword list is a no-op because its entries are strings, while a nested schema under a user field named required is now visited. The test covers both the required-named nested field and its sibling, and asserts the exact nested required members. The current hosted models/test_llm_schema_optimizer, code-style, and type-checker checks all pass. Both points from my earlier review are addressed; I have no remaining findings on this head. |
Fixes #6209 - SchemaOptimizer was skipping field names literally named 'required' due to an overbroad check in . The fix removes the key check since recursing into the 'required' array (list of strings) is a no-op, and correctly handles user fields named 'required'.
Summary by cubic
Fixes the strict-mode schema optimizer so user fields named
requiredcontaining nested models are still processed (regression for #6209).required, treating it as the schema's required array; iteratingschema.values()recurses into every dict/list value, and recursing into the actualrequiredlist of strings is a no-op.required.Written for commit ab11bf2. Summary will update on new commits.