Skip to content

[FrameworkBundle][Serializer] Wire the CustomNormalizer #51237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

HypeMC
Copy link
Member

@HypeMC HypeMC commented Aug 2, 2023

Q A
Branch? 7.1
Bug fix? no
New feature? yes
Deprecations? no
Tickets -
License MIT
Doc PR -

Currently the CustomNormalizer is not wired out of the box. I'm not sure what the reason for that is but I suggest wiring it as it only applies to objects implementing the NormalizableInterface or DenormalizableInterface. I also think it'd make sense for it to have the highest priority:

Symfony Container Services Tagged with "serializer.normalizer" Tag
==================================================================

 ------------------------------------------------- ---------- ------------------------------------------------------------------------------------------- 
  Service ID                                        priority   Class name                                                                                 
 ------------------------------------------------- ---------- ------------------------------------------------------------------------------------------- 
  serializer.normalizer.custom                      1100       Symfony\Component\Serializer\Normalizer\CustomNormalizer                                   
  serializer.denormalizer.unwrapping                1000       Symfony\Component\Serializer\Normalizer\UnwrappingDenormalizer                             
  serializer.normalizer.flatten_exception           -880       Symfony\Component\Messenger\Transport\Serialization\Normalizer\FlattenExceptionNormalizer  
  serializer.normalizer.problem                     -890       Symfony\Component\Serializer\Normalizer\ProblemNormalizer                                  
  serializer.normalizer.uid                         -890       Symfony\Component\Serializer\Normalizer\UidNormalizer                                      
  serializer.normalizer.translatable                -890       Symfony\Component\Serializer\Normalizer\TranslatableNormalizer                             
  serializer.normalizer.datetime                    -910       Symfony\Component\Serializer\Normalizer\DateTimeNormalizer                                 
  serializer.normalizer.constraint_violation_list   -915       Symfony\Component\Serializer\Normalizer\ConstraintViolationListNormalizer                  
  serializer.normalizer.mime_message                -915       Symfony\Component\Serializer\Normalizer\MimeMessageNormalizer                              
  serializer.normalizer.datetimezone                -915       Symfony\Component\Serializer\Normalizer\DateTimeZoneNormalizer                             
  serializer.normalizer.dateinterval                -915       Symfony\Component\Serializer\Normalizer\DateIntervalNormalizer                             
  serializer.normalizer.form_error                  -915       Symfony\Component\Serializer\Normalizer\FormErrorNormalizer                                
  serializer.normalizer.backed_enum                 -915       Symfony\Component\Serializer\Normalizer\BackedEnumNormalizer                               
  serializer.normalizer.data_uri                    -920       Symfony\Component\Serializer\Normalizer\DataUriNormalizer                                  
  serializer.normalizer.json_serializable           -950       Symfony\Component\Serializer\Normalizer\JsonSerializableNormalizer                         
  serializer.denormalizer.array                     -990       Symfony\Component\Serializer\Normalizer\ArrayDenormalizer                                  
  serializer.normalizer.object                      -1000      Symfony\Component\Serializer\Normalizer\ObjectNormalizer                                   
 ------------------------------------------------- ---------- ------------------------------------------------------------------------------------------- 

@mtarld
Copy link
Contributor

mtarld commented Aug 21, 2023

I'd put a negative priority like -870 because even if it's a special normalizer, it's not 100% backward compatible.
Indeed, it might replace an userland normalizer with a 0 (or upper) priority.

@HypeMC HypeMC force-pushed the wire-customnormalizer branch from 72a39f8 to 4fd7248 Compare September 5, 2023 18:56
@HypeMC HypeMC force-pushed the wire-customnormalizer branch from 4fd7248 to caed09a Compare September 29, 2023 04:01
@nicolas-grekas nicolas-grekas modified the milestones: 6.4, 7.1 Nov 15, 2023
@HypeMC HypeMC force-pushed the wire-customnormalizer branch from caed09a to 2d25af4 Compare December 27, 2023 21:08
@xabbuh xabbuh modified the milestones: 7.1, 7.2 May 15, 2024
@HypeMC HypeMC closed this Aug 11, 2024
@HypeMC HypeMC deleted the wire-customnormalizer branch August 11, 2024 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants