Updated the schema JSON format, schema comparison and tests#1159
Merged
VisLab merged 2 commits intohed-standard:mainfrom Dec 8, 2025
Merged
Updated the schema JSON format, schema comparison and tests#1159VisLab merged 2 commits intohed-standard:mainfrom
VisLab merged 2 commits intohed-standard:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the JSON schema output format to omit empty list attributes rather than serializing them as empty arrays. This fixes a conflict in the JSON format where attributes like suggestedTag, relatedTag, valueClass, and unitClass were being written even when empty.
Key changes:
- Modified JSON serialization to conditionally include list attributes only when non-empty
- Updated existing tests to verify empty lists are omitted, not present as empty arrays
- Added comprehensive new tests for empty list omission and extras section roundtrip
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
hed/schema/schema_io/schema2json.py |
Changed build_attributes_dict to check if list attributes are non-empty before adding them to the output dictionary |
tests/schema/test_json_explicit_attributes.py |
Updated test_empty_lists_omitted to verify empty lists are completely omitted rather than present as empty arrays |
tests/schema/test_schema_format_roundtrip.py |
Added three new comprehensive tests: test_json_empty_list_attributes_omitted, test_extras_sections_roundtrip, test_library_schema_extras_roundtrip, and test_library_schema_score |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the conflict with attributes in outputted JSON format.