refactor: replace manual Dict JSON building with Sury schemas in annotation meta builders#488
Merged
BlueHotDog merged 1 commit intomainfrom Mar 2, 2026
Merged
Conversation
Contributor
|
Minimum allowed coverage is Generated by 🐒 cobertura-action against 3b06b92 |
…tation meta builders Replace hand-rolled Dict.make()/Dict.set() with Sury S.object schemas for annotation _meta JSON serialization. This gives compile-time field name guarantees instead of stringly-typed keys. - Define annotationMeta, screenshotMeta, boundingBoxMeta schema types - Rewrite makeAnnotationMeta and makeMessageAnnotationMeta to use S.reverseConvertToJsonOrThrow with annotationMetaSchema - Replace inline screenshotMeta construction in both content block builders - Remove dead helpers: setOpt, boundingBoxToJson, serializeParentToJson - parentLocationMeta uses manual JSON serialization due to a Sury bug with S.recursive + S.dict(S.json) in reverseConvertToJson Closes #487
5415e68 to
3b06b92
Compare
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.
Summary
Dict.make()/Dict.set()with SuryS.objectschemas for annotation_metaJSON serialization, giving compile-time field name guarantees instead of stringly-typed keysannotationMeta,screenshotMeta,boundingBoxMeta) withS.objectands.field("snake_case", ...)mappingsmakeAnnotationMetaandmakeMessageAnnotationMetanow serialize via the sameannotationMetaSchemasetOpt,boundingBoxToJson,serializeParentToJson)Notes
parentLocationMetatype uses manual JSON serialization rather thanS.recursivedue to a Sury v11.0.0-alpha.4 bug whereS.dict(S.json)insideS.recursivecrashes onreverseConvertToJsonOrThrow. Documented in code comments.Closes #487