Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
soyuka committed Nov 30, 2020
1 parent 8769b25 commit cb7cf2b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion features/main/patch.feature
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ Feature: Sending PATCH requets
}
}
"""
Then print last JSON response
Then the response status code should be 200
And the response should be in JSON
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
Expand Down
4 changes: 2 additions & 2 deletions src/Serializer/SerializerContextBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function createFromRequest(Request $request, bool $normalization, array $
$context['api_allow_update'] = \in_array($method = $request->getMethod(), ['PUT', 'PATCH'], true);

if ($context['api_allow_update'] && 'PATCH' === $method) {
$context[AbstractItemNormalizer::DEEP_OBJECT_TO_POPULATE] = $context[AbstractItemNormalizer::DEEP_OBJECT_TO_POPULATE] ?? true;
$context['deep_object_to_populate'] = $context['deep_object_to_populate'] ?? true;
}
}

Expand Down Expand Up @@ -108,7 +108,7 @@ public function createFromRequest(Request $request, bool $normalization, array $
// TODO: We should always use `skip_null_values` but changing this would be a BC break, for now use it only when `merge-patch+json` is activated on a Resource
foreach ($resourceMetadata->getItemOperations() as $operation) {
if ('PATCH' === ($operation['method'] ?? '') && \in_array('application/merge-patch+json', $operation['input_formats']['json'] ?? [], true)) {
$context[AbstractItemNormalizer::SKIP_NULL_VALUES] = true;
$context['skip_null_values'] = true;

break;
}
Expand Down

0 comments on commit cb7cf2b

Please sign in to comment.