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

Duplicated Properties with snake_case variables #2153

Open
NotLeQuack opened this issue Nov 21, 2023 · 0 comments
Open

Duplicated Properties with snake_case variables #2153

NotLeQuack opened this issue Nov 21, 2023 · 0 comments

Comments

@NotLeQuack
Copy link

NotLeQuack commented Nov 21, 2023

Hello, i am configuring Nelmio docs to output the docs, and im running into a problem with how Nelmio decided to serialize objects.

Here is the Annotation of the editor_id variable.

/**
     * @OA\Property(
     *    property="editor_id",
     *   type="integer",
     *  format="int32")
     */
    #[Groups(["reg:read"])]
    #[ORM\Column]
    private ?int $editor_id = null;

For some reasons, Nelmio decided to seperate this into 2 different properties, one in camelCase, one in snake_case. However, the group allocation is only given to the snake_case one, but not the camelCase. Only camelCase is then used to generate the docs. The snake_case one is unused.

Here is the output when i debug the serializer.
snake_case

| editor_id        | [                                 |
|                  |   "groups" => [                   |
|                  |     "reg:read"                    |
|                  |   ],                              |
|                  |   "maxDepth" => null,             |
|                  |   "serializedName" => null,       |
|                  |   "ignore" => false,              |
|                  |   "normalizationContexts" => [],  |
|                  |   "denormalizationContexts" => [] |
|                  | ]                                 |

camelCase

| editorId         | [                                 |
|                  |   "groups" => [],                 |
|                  |   "maxDepth" => null,             |
|                  |   "serializedName" => null,       |
|                  |   "ignore" => false,              |
|                  |   "normalizationContexts" => [],  |
|                  |   "denormalizationContexts" => [] |
|                  | ]                                 |

This resulted in schemas that are missing some of it properties when used with a group annotation. How do i move the group allocation to camelCase one?

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

No branches or pull requests

1 participant