Skip to content

fix(silo): Handle JSON API returns single doc#122

Merged
scottmessinger merged 4 commits into
mainfrom
mweidner/fix/json-api-single-docs
Jun 29, 2026
Merged

fix(silo): Handle JSON API returns single doc#122
scottmessinger merged 4 commits into
mainfrom
mweidner/fix/json-api-single-docs

Conversation

@mweidner037

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the jsonApiProcessor to handle JSON-API responses where data is a single resource object (not an array), and adds a regression test to cover that behavior.

Changes:

  • Extend the JSON-API envelope typing so data may be a single object or an array.
  • Normalize data to an array before inserting documents into the store.
  • Add a new Vitest case ensuring single-object data is inserted correctly.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
packages/silo/src/processors/json-api.ts Accept data as object-or-array and normalize to an iterable list before inserting.
packages/silo/tests/processors/json-api.test.ts Add test coverage for single-object data envelopes.
.oxlintrc.json Adjust lint configuration related to nested ternaries (but currently introduces invalid strict JSON via trailing commas).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .oxlintrc.json
Comment thread .oxlintrc.json
Comment on lines +118 to +122
const data = envelope.data
? Array.isArray(envelope.data)
? envelope.data
: [envelope.data]
: [];
@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (8a6ccc2) to head (2472e53).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #122   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           58        58           
  Lines         2055      2056    +1     
  Branches       484       485    +1     
=========================================
+ Hits          2055      2056    +1     

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Apparently the VSCode oxc extension doesn't actually format with oxfmt?
@scottmessinger scottmessinger merged commit e8bc108 into main Jun 29, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants