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

[Bug]: Request body not being documented when adding validation groups to MapRequestPayload #2376

Open
Methraen opened this issue Nov 5, 2024 · 0 comments
Labels

Comments

@Methraen
Copy link

Methraen commented Nov 5, 2024

Version

4.33

Description

When I add validation groups to MapRequestPayload, the request body resolved is an empty json array

this :

#[MapRequestPayload(
    validationGroups: [
        Constraint::DEFAULT_GROUP,
        "validation_group",
    ],
)] CharacterDTO $characterDTO,

returns that :

{}

JSON OpenApi

JSON OpenApi
{
    "openapi": "3.0.0",
    "info": {
        "title": "Projet A",
        "description": "This will probably be an awesome app!",
        "version": "1.0.0"
    },
    "paths": {
        "/api/users/{userUuid}/characters/create": {
            "post": {
                "tags": [
                    "Character"
                ],
                "operationId": "post_app_character_create",
                "parameters": [
                    {
                        "name": "userUuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "pattern": "[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/CharacterDTO"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Returned if successful",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/CharacterDTO"
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "CharacterDTO": {
                "type": "object"
            }
        },
        "securitySchemes": {
            "OAuth2Password": {
                "type": "oauth2",
                "flows": {
                    "password": {
                        "tokenUrl": "http://projet-a.perso/api/token",
                        "scopes": {}
                    }
                }
            }
        }
    },
    "security": [
        {
            "OAuth2Password": []
        }
    ],
    "tags": [
        {
            "name": "Character"
        }
    ]
}

Additional context

No response

@Methraen Methraen added the bug label Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant