Skip to content

Commit 0b86fb6

Browse files
authored
Remove non-spec fields from resource content responses (#110)
* Remove non-spec fields from resource content responses * Update the minimum code coverage threshold to 91.7%
1 parent 6e49cfa commit 0b86fb6

File tree

8 files changed

+1
-25
lines changed

8 files changed

+1
-25
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"pint --test",
8181
"rector --dry-run"
8282
],
83-
"test:unit": "pest --ci --coverage --min=91.4",
83+
"test:unit": "pest --ci --coverage --min=91.7",
8484
"test:types": "phpstan",
8585
"test": [
8686
"@test:lint",

src/Server/Content/Blob.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ public function toResource(Resource $resource): array
4848
return $this->mergeMeta([
4949
'blob' => base64_encode($this->content),
5050
'uri' => $resource->uri(),
51-
'name' => $resource->name(),
52-
'title' => $resource->title(),
5351
'mimeType' => $resource->mimeType(),
5452
]);
5553
}

src/Server/Content/Text.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ public function toResource(Resource $resource): array
4343
return $this->mergeMeta([
4444
'text' => $this->text,
4545
'uri' => $resource->uri(),
46-
'name' => $resource->name(),
47-
'title' => $resource->title(),
4846
'mimeType' => $resource->mimeType(),
4947
]);
5048
}

tests/Pest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,7 @@ function expectedReadResourceResponse(): array
211211
'contents' => [[
212212
'text' => '2025-07-02 12:00:00 Error: Something went wrong.',
213213
'uri' => 'file://resources/last-log-line-resource',
214-
'title' => 'Last Log Line Resource',
215214
'mimeType' => 'text/plain',
216-
'name' => 'last-log-line-resource',
217215
]],
218216
],
219217
];

tests/Unit/Content/BlobTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
expect($payload)->toEqual([
2424
'blob' => base64_encode('raw-bytes'),
2525
'uri' => 'file://avatar.png',
26-
'name' => 'avatar',
27-
'title' => 'User Avatar',
2826
'mimeType' => 'image/png',
2927
]);
3028
});
@@ -49,8 +47,6 @@
4947
expect($payload)->toMatchArray([
5048
'blob' => base64_encode('raw-bytes'),
5149
'uri' => 'file://avatar.png',
52-
'name' => 'avatar',
53-
'title' => 'User Avatar',
5450
'mimeType' => 'image/png',
5551
'_meta' => ['encoding' => 'base64'],
5652
]);

tests/Unit/Content/TextTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
expect($payload)->toEqual([
2424
'text' => 'Hello world',
2525
'uri' => 'file://readme.txt',
26-
'name' => 'readme',
27-
'title' => 'Readme File',
2826
'mimeType' => 'text/plain',
2927
]);
3028
});
@@ -49,8 +47,6 @@
4947
expect($payload)->toEqual([
5048
'text' => 'Hello world',
5149
'uri' => 'file://readme.txt',
52-
'name' => 'readme',
53-
'title' => 'Readme File',
5450
'mimeType' => 'text/plain',
5551
'_meta' => ['author' => 'John'],
5652
]);

tests/Unit/Methods/ReadResourceTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,6 @@
124124
[
125125
'text' => 'Resource content with result meta',
126126
'uri' => 'file://resources/with-result-meta.txt',
127-
'name' => 'resource-with-result-meta-resource',
128-
'title' => 'Resource With Result Meta Resource',
129127
'mimeType' => 'text/plain',
130128
],
131129
],

tests/Unit/Resources/ResourceTest.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ public function handle(): Response
2222
$expected = [
2323
'text' => 'This is a test resource.',
2424
'uri' => $resource->uri(),
25-
'name' => $resource->name(),
26-
'title' => $resource->title(),
2725
'mimeType' => $resource->mimeType(),
2826
];
2927

@@ -61,8 +59,6 @@ public function handle(): Response
6159
$expected = [
6260
'blob' => base64_encode($binaryData),
6361
'uri' => 'file://resources/I_CAN_BE_OVERRIDDEN',
64-
'name' => $resource->name(),
65-
'title' => $resource->title(),
6662
'mimeType' => 'image/png',
6763
];
6864

@@ -90,8 +86,6 @@ public function handle(): Response
9086
'text' => 'This is a test resource.',
9187

9288
'uri' => $resource->uri(),
93-
'name' => $resource->name(),
94-
'title' => $resource->title(),
9589
'mimeType' => $resource->mimeType(),
9690
];
9791

@@ -118,8 +112,6 @@ public function handle(): Response
118112
'blob' => base64_encode('This is a test resource.'),
119113

120114
'uri' => $resource->uri(),
121-
'name' => $resource->name(),
122-
'title' => $resource->title(),
123115
'mimeType' => $resource->mimeType(),
124116
];
125117

0 commit comments

Comments
 (0)