Skip to content

Conversation

@jordandukart
Copy link
Contributor

@jordandukart jordandukart commented Dec 17, 2025

Summary by CodeRabbit

  • Bug Fixes

    • Manifest API responses now correctly declare the IIIF Presentation v3 content type in HTTP headers.
  • Refactor

    • Centralized content type definition to use a consistent constant across the API.

✏️ Tip: You can customize this high-level summary in your review settings.

@jordandukart jordandukart added the patch Backwards compatible bug fixes. label Dec 17, 2025
@coderabbitai
Copy link

coderabbitai bot commented Dec 17, 2025

Walkthrough

The changes introduce a new IIIF Presentation API v3 content type constant in the IiifP encoder class and standardize its usage across the manifest controller and service provider by replacing hardcoded strings with the constant reference.

Changes

Cohort / File(s) Summary
Content-Type Constant Definition
src/Encoder/V3/IiifP.php
Adds public constant CONTENT_TYPE with IIIF Presentation API v3 profile value: 'application/ld+json;profile="http://iiif.io/api/presentation/3/context.json"'
Constant Usage
src/Controller/V3/ManifestController.php, src/IiifPresentationApiServiceProvider.php
Imports IiifP encoder and replaces hardcoded content type strings with IiifP::CONTENT_TYPE constant reference for HTTP header and middleware negotiation registration

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

  • Straightforward constant definition with no logic changes
  • Simple constant usage in two existing code paths
  • No behavioral changes beyond standardization

Poem

🐰 A constant hops into place, so neat,
No more strings scattered, content-type complete!
Three files now speak with one voice true,
IIIF headers, consistent through and through. 📋

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly relates to the main objective: updating the IIIF Presentation API to use the correct Content-Type header from the IIIF RFC specification.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/individualized-content-type

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 8c2ca57 and f0a60c5.

📒 Files selected for processing (3)
  • src/Controller/V3/ManifestController.php (2 hunks)
  • src/Encoder/V3/IiifP.php (1 hunks)
  • src/IiifPresentationApiServiceProvider.php (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
src/Controller/V3/ManifestController.php (1)
src/Encoder/V3/IiifP.php (1)
  • IiifP (10-26)
src/IiifPresentationApiServiceProvider.php (1)
src/Encoder/V3/IiifP.php (1)
  • IiifP (10-26)
🔇 Additional comments (5)
src/Controller/V3/ManifestController.php (2)

11-11: LGTM!

Clean import statement for the IiifP encoder class.


75-75: Excellent improvement for maintainability.

Using the centralized constant instead of a hardcoded string ensures consistency across the codebase and makes future updates easier to manage.

src/IiifPresentationApiServiceProvider.php (2)

7-7: LGTM!

Clean import statement for the IiifP encoder class.


22-22: Significant improvement in content type specificity.

Replacing the generic application/json with the IIIF Presentation API v3-specific content type (application/ld+json;profile="...") ensures proper content negotiation and aligns with the IIIF specification. This change correctly registers the format with the appropriate media type.

src/Encoder/V3/IiifP.php (1)

12-17: Good practice to centralize the content type as a constant.

The IIIF Presentation API v3 specification defines a specific media-type with the JSON-LD media type and the context in the profile parameter, following established conventions. The constant value is correctly aligned with official IIIF documentation. This change follows the DRY principle and makes the IIIF v3 content type reusable across the codebase. The documentation is clear and the constant is appropriately scoped as public.

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • JIRA integration encountered authorization issues. Please disconnect and reconnect the integration in the CodeRabbit UI.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@nchiasson-dgi nchiasson-dgi merged commit 9602c20 into main Dec 17, 2025
2 checks passed
@nchiasson-dgi nchiasson-dgi deleted the fix/individualized-content-type branch December 17, 2025 15:26
@github-actions
Copy link

Tag generated by PR: v2.7.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch Backwards compatible bug fixes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants