Adding test for any_of at the class level.#2292
Conversation
|
what would the difference between |
|
merged upstream fixes for CQ and linting |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2292 +/- ##
==========================================
+ Coverage 80.95% 84.39% +3.43%
==========================================
Files 156 156
Lines 18413 18433 +20
Branches 3848 3856 +8
==========================================
+ Hits 14907 15557 +650
+ Misses 2673 1994 -679
- Partials 833 882 +49
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Add handling for boolean class expressions (any_of, all_of, exactly_one_of, none_of) in the JSON Schema generator's generate_class method. This enables patterns like requiring either a `name` OR both `family_name` and `given_name` using slot_conditions with required: true inside class-level any_of. Fixes #2282
b285e2d to
42e59ea
Compare
kevinschaper
left a comment
There was a problem hiding this comment.
I ended up doing a force push to bring these changes into a fresh branch, to avoid pre-monorepo merge nightmares.
There was a problem hiding this comment.
Pull request overview
Adds JSON Schema generator support (and compliance coverage) for class-level boolean constraints that can drive conditional required slots, addressing #2282.
Changes:
- Added a new compliance test covering class-level
any_of/all_ofthat conditionally require different slot sets (including nested/inlined scenarios). - Updated
JsonSchemaGenerator.handle_classto emit class-levelanyOf/allOf/oneOf/not(anyOf)fromClassDefinitionboolean expressions.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
tests/linkml/test_compliance/test_boolean_slot_compliance.py |
Adds a new parametrized compliance test for class boolean constraints affecting requiredness (including nested case). |
packages/linkml/src/linkml/generators/jsonschemagen.py |
Emits JSON Schema boolean keywords for class-level any_of, all_of, exactly_one_of, and none_of. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ctly_one_of/none_of tests - Use boolean True instead of string "true" for required in test schema - Use dynamic op parameter in core_elements instead of hard-coded "any_of" - Add exactly_one_of and none_of parametrize cases to test_class_any_of_with_required - Fix line-too-long in description f-string
Fixes #2282