Skip to content
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

V3.2.20 Did Not Fix The BackedEnum Serialization Priority Error #6285

Closed
gnito-org opened this issue Apr 3, 2024 · 4 comments · Fixed by symfony/symfony#54484
Closed

V3.2.20 Did Not Fix The BackedEnum Serialization Priority Error #6285

gnito-org opened this issue Apr 3, 2024 · 4 comments · Fixed by symfony/symfony#54484

Comments

@gnito-org
Copy link

gnito-org commented Apr 3, 2024

API Platform version(s) affected: 3.2.20

Description
Refer to symfony/symfony#54478.

I do not use GraphQL, and the issue still exists in 3.2.20.

The only work-around I can find is to hack the priority in services.yaml.

How to reproduce

Here is a repository with a problem replicator.

Possible Solution

Additional Context

@gnito-org
Copy link
Author

# config/services.yaml

    serializer.normalizer.backed_enum:
        class: Symfony\Component\Serializer\Normalizer\BackedEnumNormalizer
        tags:
            - { name: 'serializer.normalizer', priority: -891 }

Any priority from -891 and lower fixes the problem.

@gnito-org
Copy link
Author

In my case, the GraphQL normalizer is not even listed.

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

 ----------------------------------------------------------- ---------- ------------------------------------------------------------------------------------------- 
  Service ID                                                  priority   Class name                                                                                 
 ----------------------------------------------------------- ---------- ------------------------------------------------------------------------------------------- 
  serializer.denormalizer.unwrapping                          1000       Symfony\Component\Serializer\Normalizer\UnwrappingDenormalizer                             
  api_platform.openapi.normalizer.legacy                                 ApiPlatform\OpenApi\Serializer\LegacyOpenApiNormalizer                                     
  api_platform.normalizer.constraint_violation_list           -780       ApiPlatform\Serializer\ConstraintViolationListNormalizer                                   
  api_platform.hydra.normalizer.constraint_violation_list     -780       ApiPlatform\Hydra\Serializer\ConstraintViolationListNormalizer                             
  api_platform.problem.normalizer.constraint_violation_list   -780       ApiPlatform\Problem\Serializer\ConstraintViolationListNormalizer                           
  api_platform.jsonld.normalizer.validation_exception         -800       ApiPlatform\Symfony\Validator\Serializer\ValidationExceptionNormalizer                     
  api_platform.hydra.normalizer.documentation                 -800       ApiPlatform\Hydra\Serializer\DocumentationNormalizer                                       
  api_platform.hydra.normalizer.entrypoint                    -800       ApiPlatform\Hydra\Serializer\EntrypointNormalizer                                          
  api_platform.hydra.normalizer.error                         -800       ApiPlatform\Hydra\Serializer\ErrorNormalizer                                               
  api_platform.serializer.normalizer.validation_exception     -800       ApiPlatform\Symfony\Validator\Serializer\ValidationExceptionNormalizer                     
  api_platform.problem.normalizer.error                       -810       ApiPlatform\Problem\Serializer\ErrorNormalizer                                             
  serializer.normalizer.backed_enum                           -880       Symfony\Component\Serializer\Normalizer\BackedEnumNormalizer                               
  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                             
  api_platform.jsonld.normalizer.item                         -890       ApiPlatform\JsonLd\Serializer\ItemNormalizer                                               
  api_platform.serializer.normalizer.item                     -895       ApiPlatform\Serializer\ItemNormalizer                                                      
  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.data_uri                              -920       Symfony\Component\Serializer\Normalizer\DataUriNormalizer                                  
  serializer.normalizer.json_serializable                     -950       Symfony\Component\Serializer\Normalizer\JsonSerializableNormalizer                         
  api_platform.hydra.normalizer.collection_filters            -985       ApiPlatform\Hydra\Serializer\CollectionFiltersNormalizer                                   
  serializer.denormalizer.array                               -990       Symfony\Component\Serializer\Normalizer\ArrayDenormalizer                                  
  api_platform.jsonld.normalizer.object                       -995       ApiPlatform\JsonLd\Serializer\ObjectNormalizer                                             
  serializer.normalizer.object                                -1000      Symfony\Component\Serializer\Normalizer\ObjectNormalizer                                   
 ----------------------------------------------------------- ---------- ------------------------------------------------------------------------------------------- 

@ambroisemaupate
Copy link
Contributor

Related to #6279

@soyuka
Copy link
Member

soyuka commented Apr 4, 2024

Closing as not an API Platform bug, hopefully this gets fixed in Symfony.

@soyuka soyuka closed this as completed Apr 4, 2024
nicolas-grekas added a commit to symfony/symfony that referenced this issue Apr 4, 2024
… translatable (GwendolenLynch)

This PR was squashed before being merged into the 6.4 branch.

Discussion
----------

[Serializer] reset backed_enum priority, and re-prioritise translatable

| Q             | A
| ------------- | ---
| Branch?       | 6.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | Fix #54478 Fix api-platform/core#6285 Fix api-platform/core#6279
| License       | MIT

- `serializer.normalizer.translatable` -920 (was -890)
- `serializer.normalizer.backed_enum` -915 (originally -915, changed to -880)

Floating this as as solution to the knock-on issues from #54478

Context:
- #54478 (comment)
- api-platform/core#6288

Commits
-------

b559aa5 [Serializer] reset backed_enum priority, and re-prioritise translatable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants