Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

alli83
Copy link
Contributor

@alli83 alli83 commented Oct 23, 2023

Q A
Branch? 3.1
Tickets #5514
License MIT
Doc PR

Based on symfony/symfony#47637 and taking into account #5514 , this PR aims to consider the default_context config option under serializer of FrameworkBundle when using ApiPlatform\JsonLd\Serializer\ItemNormalizer.

Maybe we should check for the other normalizers.

@alli83 alli83 force-pushed the serializer-default-context-itemNormalizer branch 2 times, most recently from 8934396 to fa0172a Compare October 23, 2023 11:12
@alli83 alli83 changed the title [Serializer] fix: defaultContext in ItemNormalizer fix(Serializer): defaultContext in ItemNormalizer Oct 23, 2023
@alli83 alli83 force-pushed the serializer-default-context-itemNormalizer branch from fa0172a to 762fb97 Compare October 23, 2023 11:23
@@ -45,7 +45,7 @@ final class ItemNormalizer extends AbstractItemNormalizer

public const FORMAT = 'jsonld';

public function __construct(ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory, PropertyNameCollectionFactoryInterface $propertyNameCollectionFactory, PropertyMetadataFactoryInterface $propertyMetadataFactory, IriConverterInterface $iriConverter, ResourceClassResolverInterface $resourceClassResolver, private readonly ContextBuilderInterface $contextBuilder, PropertyAccessorInterface $propertyAccessor = null, NameConverterInterface $nameConverter = null, ClassMetadataFactoryInterface $classMetadataFactory = null, array $defaultContext = [], ResourceAccessCheckerInterface $resourceAccessChecker = null)
Copy link
Member

Choose a reason for hiding this comment

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

we can't change the constructor it's a public interface. Maybe that we should provide this from our DI?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, I'll update it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@soyuka maybe I should add a compiler pass to enforce the use of the default value when encountering an empty string?

@alli83 alli83 force-pushed the serializer-default-context-itemNormalizer branch from 762fb97 to 8f24a52 Compare October 31, 2023 08:59
@alli83 alli83 force-pushed the serializer-default-context-itemNormalizer branch 2 times, most recently from 6c1ef3b to 5ca48a4 Compare November 20, 2023 10:46
@alli83 alli83 force-pushed the serializer-default-context-itemNormalizer branch from 5ca48a4 to 7d093c1 Compare November 20, 2023 10:49
Copy link

stale bot commented Jan 19, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jan 19, 2024
@stale stale bot closed this Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants