Skip to content

feat: add ResourceMetadata value object from HEAD - #7

Open
soyuka wants to merge 3 commits into
dunglas:mainfrom
soyuka:feat/resource-metadata
Open

feat: add ResourceMetadata value object from HEAD#7
soyuka wants to merge 3 commits into
dunglas:mainfrom
soyuka:feat/resource-metadata

Conversation

@soyuka

Copy link
Copy Markdown
Collaborator

Summary

  • Adds ResourceMetadata value object parsed from HEAD response headers
  • Provides typed access to: contentType, contentLength, lastModified, ldpType, wacAllow, aclUrl
  • Adds getResourceMetadata() convenience method to SolidClient
  • isContainer() helper checks LDP type

Stack

2/8 — builds on #6 (feat/http-methods)

Test plan

  • Tests for header parsing (container, resource, empty headers)
  • All existing tests pass

🤖 Generated with Claude Code

@soyuka

Copy link
Copy Markdown
CollaboratorAuthor

Stack: 2/6 — builds on #6

soyukaand others added 2 commits February 23, 2026 21:43
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds the missing HTTP method wrappers to SolidClient:
- put(): creates/overwrites resources, with optional container Link header
- head(): retrieves resource metadata headers
- delete(): removes resources
- patch(): updates resources via SPARQL Update or N3 Patch
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@soyuka
soyukaforce-pushed the feat/resource-metadata branch from e7898c8 to 625edd5CompareFebruary 23, 2026 21:08
Parses HEAD response headers into a structured ResourceMetadata object
with content type, length, last modified, LDP type, WAC-Allow permissions,
and ACL URL from Link headers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@soyuka
soyukaforce-pushed the feat/resource-metadata branch from 625edd5 to 34512cfCompareFebruary 24, 2026 09:14
@dunglas
dunglas requested a review from CopilotMarch 19, 2026 11:43

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a ResourceMetadata value object that can be derived from HEAD response headers, and exposes a SolidClient::getResourceMetadata() convenience method to fetch and parse that metadata.

Changes:

  • Introduces ResourceMetadata with parsing for Content-Type, Content-Length, Last-Modified, Link (LDP type + ACL), and WAC-Allow.
  • Adds SolidClient::getResourceMetadata() (HEAD + header parsing) and related HTTP method helpers used by the client API.
  • Updates Composer requirements (PHP and Symfony versions) and adds unit tests for parsing behavior.

Reviewed changes

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

Show a summary per file
FileDescription
src/ResourceMetadata.phpNew value object and header parsing logic for resource metadata.
src/SolidClient.phpAdds getResourceMetadata() convenience method (and related HTTP helpers in this diff).
tests/ResourceMetadataTest.phpUnit tests for metadata parsing from normalized headers.
tests/SolidClientTest.phpAdds unit tests around SolidClient request construction for multiple HTTP methods.
composer.jsonBumps PHP/Symfony constraints and adds symfony/web-link dependency.
src/SolidClientFactory.phpMinor signature update to explicit nullable parameter type.
src/Bundle/Form/SolidLoginType.phpMakes the validation callback static (no capture).

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

public static function isContainerType(string $type): bool
{
return 'http://www.w3.org/ns/ldp#BasicContainer' === $type
|| 'http://www.w3.org/ns/ldp#Container' === $type;
Comment on lines +51 to +53
$contentLength = isset($responseHeaders['content-length'][0])
? (int) $responseHeaders['content-length'][0]
: null;
Comment threadsrc/SolidClient.php
Comment on lines +99 to +104
public function getResourceMetadata(string $url, array $options = []): ResourceMetadata
{
$response = $this->head($url, $options);

return ResourceMetadata::fromResponseHeaders($response->getHeaders(false));
}
Comment threadcomposer.json
Comment on lines 21 to +52
@@ -32,22 +33,22 @@
"web-token/jwt-signature-algorithm-rsa": "^3.0"
},
"require-dev": {
"symfony/form": "^6.0",
"symfony/framework-bundle": "^6.0",
"symfony/http-foundation": "^6.0",
"symfony/validator": "^6.0",
"symfony/dependency-injection": "^6.0",
"symfony/routing": "^6.0",
"symfony/security-bundle": "^6.0",
"symfony/twig-bundle": "^6.0",
"symfony/debug-bundle": "^6.0",
"symfony/web-profiler-bundle": "^6.0",
"symfony/console": "^6.0",
"symfony/stopwatch": "^6.0",
"symfony/phpunit-bridge": "^6.0",
"symfony/browser-kit": "^6.0",
"symfony/css-selector": "^6.0",
"symfony/security-core": "^6.0",
"vimeo/psalm": "^5.12"
"symfony/form": "^7.4",
"symfony/framework-bundle": "^7.4",
"symfony/http-foundation": "^7.4",
"symfony/validator": "^7.4",
"symfony/dependency-injection": "^7.4",
"symfony/routing": "^7.4",
"symfony/security-bundle": "^7.4",
"symfony/twig-bundle": "^7.4",
"symfony/debug-bundle": "^7.4",
"symfony/web-profiler-bundle": "^7.4",
"symfony/console": "^7.4",
"symfony/stopwatch": "^7.4",
"symfony/phpunit-bridge": "^7.4",
"symfony/browser-kit": "^7.4",
"symfony/css-selector": "^7.4",
"symfony/security-core": "^7.4",
"vimeo/psalm": "^5.12 || ^6.0"
Sign up for freeto 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.

2 participants

@soyuka