-
Notifications
You must be signed in to change notification settings - Fork 82
🔧 Store full schema on FieldSchema
#1603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
FieldSchemaFieldSchema
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1603 +/- ##
==========================================
+ Coverage 86.87% 88.12% +1.24%
==========================================
Files 56 70 +14
Lines 6532 9687 +3155
==========================================
+ Hits 5675 8537 +2862
- Misses 857 1150 +293
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:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This will make it easier to implement #1547
6b500b2 to
c91d3a2
Compare
ubmarco
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This pull request refactors how field schemas are handled for extra options and core fields in the
sphinx_needsextension. The main change is moving from separatetypeanditem_typeattributes to a unifiedschemaattribute, which supports more flexible and robust validation using JSON Schema. Error handling is also improved to raise clear exceptions on misconfiguration. Several now-unnecessary validation utilities are removed, and the code is updated to consistently work with the new schema structure.This will make it easier to implement #1547
Schema handling and validation improvements:
typeanditem_typeattributes inFieldSchemawith a singleschemaattribute, and updated all relevant logic to use and validate this schema using JSON Schema. This allows for more flexible and accurate representation of field types, including arrays and nested types. (sphinx_needs/needs_schema.py,sphinx_needs/needs.py) [1] [2]FieldSchema.__post_init__to validate the schema usingvalidate_extra_option_schemaandvalidate_object_schema_compiles, raising a clear error if the schema is invalid. (sphinx_needs/needs_schema.py)typeanditem_typeproperties toFieldSchemafor backward compatibility, deriving them from the unified schema. (sphinx_needs/needs_schema.py)sphinx_needs/needs.py) [1] [2]Error handling improvements:
NeedsConfigExceptionimmediately on any error, instead of logging and continuing. This ensures misconfigurations are caught early and clearly reported. (sphinx_needs/needs.py,tests/__snapshots__/test_api_usage.ambr) [1] [2] [3] [4]Code cleanup and consistency:
validate_extra_option_schemasfunction and related logic, as schema validation is now handled directly in the schema creation process. (sphinx_needs/schema/config_utils.py) [1] [2] [3]sphinx_needs/schema/process.py)Documentation:
ExtraOptionSchemaTypesto the list of documented classes indocs/conf.py.