Skip to content

Conversation

@lukemelia
Copy link
Contributor

Summary

  • Allow JSON-API (application/vnd.card+json) GET on file URLs, returning filesystem-derived metadata (limited until FileDef indexing exists)
  • Reject POST/PATCH/PUT/DELETE to file URLs for this Accept header
  • Add realm-server tests for file JSON-API responses and mutation rejection

Note: JSON-API content for files is limited to filesystem-derived metadata for now, since FileDef indexing isn’t implemented yet.

Copy link
Contributor

Copilot AI left a comment

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 enables JSON-API (application/vnd.card+json) support for file URLs, allowing GET requests to retrieve filesystem-derived metadata for files, while rejecting mutation operations (POST/PATCH/PUT/DELETE) on file URLs.

Key Changes:

  • Added file URL detection and JSON-API document generation for files
  • Implemented early request validation to reject mutations on file URLs with CardJson Accept header
  • Added comprehensive test coverage for GET requests and mutation rejections on file URLs

Reviewed changes

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

File Description
packages/runtime-common/realm.ts Implements core functionality: adds openFileForCardJson() to identify file URLs, fileCardDocument() to generate JSON-API responses for files, inferContentType() for MIME type mapping, and adds validation to reject mutations on file URLs
packages/realm-server/tests/card-endpoints-test.ts Adds comprehensive tests validating that GET returns proper file JSON-API documents and that POST/PATCH/PUT/DELETE operations are correctly rejected with 405 status

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

@github-actions
Copy link

github-actions bot commented Dec 23, 2025

Host Test Results

    1 files  ±    0      1 suites  ±0   3h 5m 50s ⏱️ + 1h 32m 0s
1 847 tests +    2  1 830 ✅  -     1  14 💤 ± 0  1 ❌ +1  2 🔥 +2 
3 650 runs  +1 786  3 615 ✅ +1 765  28 💤 +14  4 ❌ +4  3 🔥 +3 

For more details on these failures and errors, see this check.

Results for commit f0da5d8. ± Comparison against base commit 7b26deb.

♻️ This comment has been updated with latest results.

@lukemelia lukemelia marked this pull request as ready for review December 23, 2025 20:57
@lukemelia lukemelia requested review from a team and habdelra December 23, 2025 20:57
@lukemelia lukemelia force-pushed the cs-8389-allow-fetching-json-api-document-for-file branch from a1e9d30 to f0da5d8 Compare December 24, 2025 05:05
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