Automate OpenApi Path Aliasing for NelmioApiDoc

When using Nelmio with serialization groups, there’s a “small” caveat. As mentioned in the documentation:

If you are using serialization contexts (e.g. Groups) each permutation will be treated as a separate Path. – source

This means that for each serialization group, the number of generated paths will grow really fast, since it provides each permutation with its own path. For example, if you have list and detail groups, you’ll have (2 custom + 1 default)! = 6 possible paths.

While it seems to be a non-issue at first, imagine when you’re building a structure to consume the API and can’t decide whether User1 and User23 can be simplified into a union type before actually inspecting the actual response. Worse still, any changes in backend code that affect either serialization group or parsing logic would remove any guarantee that the variant number still refer to the same structure. Madness!

Lanjutkan membaca Automate OpenApi Path Aliasing for NelmioApiDoc