Skip to content

fix: Represent appended AnyOf types as schema objects - #3770

Draft
edgarrmondragon wants to merge 2 commits into
mainfrom
fix/anyof-null
Draft

edgarrmondragon wants to merge 2 commits into
mainfrom
fix/anyof-null

Conversation

@edgarrmondragon

@edgarrmondragon edgarrmondragon commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator

Summary by Sourcery

Ensure nullable composite properties produce valid JSON Schema definitions.

Bug Fixes:

  • Represent appended types in anyOf and oneOf schemas as valid JSON Schema subschema objects.

Tests:

  • Add regression coverage validating optional composite types against the JSON Schema meta-schema.

… schema object to the list instead of a bare type string

Signed-off-by: Edgar Ramírez-Mondragón <edgarrm358@gmail.com>
@edgarrmondragon edgarrmondragon self-assigned this Sep 6, 2026
@sourcery-ai

sourcery-ai Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Fix append_type so types added to existing anyOf schemas are represented as full JSON Schema objects, with corresponding test coverage updated for null appends.

File-Level Changes

Change Details Files
Normalize appended AnyOf entries to complete JSON Schema type objects.
  • Wrap the new type in {"type": new_type} before comparing or appending.
  • Preserve duplicate detection and scalar-to-list conversion while using full schema objects.
singer_sdk/helpers/_typing.py
Update typing behavior coverage to expect schema objects in anyOf.
  • Change the anyOf conformance expectation for appended null from a bare string to {"type": "null"}.
tests/core/test_typing.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@edgarrmondragon

Copy link
Copy Markdown
Collaborator Author

@sourcery-ai title

@sourcery-ai sourcery-ai Bot changed the title fix: Appending a type to an AnyOf schema now adds a full additional schema object to the list instead of a bare type string Represent appended AnyOf types as schema objects Sep 6, 2026
@edgarrmondragon edgarrmondragon changed the title Represent appended AnyOf types as schema objects fix: Represent appended AnyOf types as schema objects Sep 6, 2026
@edgarrmondragon edgarrmondragon added the kind/Bug Something isn't working label Sep 6, 2026
@codecov

codecov Bot commented Sep 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.38%. Comparing base (674db6f) to head (ece5e1c).

Files with missing lines Patch % Lines
singer_sdk/helpers/_typing.py 50.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3770   +/-   ##
=======================================
  Coverage   94.37%   94.38%           
=======================================
  Files          74       74           
  Lines        6298     6300    +2     
  Branches      771      772    +1     
=======================================
+ Hits         5944     5946    +2     
  Misses        265      265           
  Partials       89       89           
Flag Coverage Δ
core 83.09% <50.00%> (+<0.01%) ⬆️
end-to-end 75.68% <16.66%> (-0.03%) ⬇️
optional-components 44.96% <16.66%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@edgarrmondragon edgarrmondragon added this to the v0.55 milestone Sep 6, 2026
@codspeed

codspeed Bot commented Sep 6, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 14 untouched benchmarks


Comparing fix/anyof-null (ece5e1c) with main (674db6f)

Open in CodSpeed

Signed-off-by: Edgar Ramírez-Mondragón <edgarrm358@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

configuration kind/Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant