nelmio / NelmioApiDocBundle

Generates documentation for your REST API from annotations
MIT License
2.23k stars 836 forks source link

feat: add support for name based serialisation of JMS enums #2355

Closed bobvandevijver closed 1 month ago

bobvandevijver commented 1 month ago
Q A
Bug fix? no
New feature? yes
Deprecations? no
Issues -

This PR add a method to detect when the developer has annotated their property with a JMS type that specifies that the backed enum needs to be serialized with its name instead of value. I needed to use the serialization context as the model options are not included in the model hash, while I do need to generate a new unique description. I've chosen to append Name to the resulting Model name.

Depends on #2372

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 89.37%. Comparing base (1e283ef) to head (f90f083). Report is 1 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #2355 +/- ## ========================================== + Coverage 89.36% 89.37% +0.01% ========================================== Files 77 77 Lines 2849 2853 +4 ========================================== + Hits 2546 2550 +4 Misses 303 303 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

bobvandevijver commented 1 month ago

@DjordyKoert With JMS 3.31 out this change is required for this bundle to be able to work with that version of JMS.

DjordyKoert commented 1 month ago

@DjordyKoert With JMS 3.31 out this change is required for this bundle to be able to work with that version of JMS.

Would it make sense to split this PR? One to fix https://github.com/schmittjoh/serializer/pull/1561 and one to introduce the new feature. Makes it easier to review & to find the individual fix / feature in the commit history

bobvandevijver commented 1 month ago

@DjordyKoert With JMS 3.31 out this change is required for this bundle to be able to work with that version of JMS.

Would it make sense to split this PR? One to fix schmittjoh/serializer#1561 and one to introduce the new feature. Makes it easier to review & to find the individual fix / feature in the commit history

I splitted it on commit level for that purpose, but makes sense to split it on PR level as well. I've created #2372 for the fix, and updated this PR to only contain the new feature.

Removing the fix commit from this PR results in a merge conflict, so I will do that once the new PR has been handled.

DjordyKoert commented 1 month ago

@DjordyKoert With JMS 3.31 out this change is required for this bundle to be able to work with that version of JMS.

Would it make sense to split this PR? One to fix schmittjoh/serializer#1561 and one to introduce the new feature. Makes it easier to review & to find the individual fix / feature in the commit history

I splitted it on commit level for that purpose, but makes sense to split it on PR level as well. I've created #2372 for the fix, and updated this PR to only contain the new feature.

Removing the fix commit from this PR results in a merge conflict, so I will do that once the new PR has been handled.

https://github.com/nelmio/NelmioApiDocBundle/pull/2372 has been merged :)

bobvandevijver commented 1 month ago

Updates have been done, should be ready 😃

DjordyKoert commented 1 month ago

Thank you 😄