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

Fix sample body with array of object #720

Conversation

stephane-monnot
Copy link
Contributor

Hi,

Fix sample body with an object of array. For example :

    #[BodyParam('fields', 'object[]', 'Form\'s fields', required: false)]
    #[BodyParam('fields[].name', 'string', 'Field\'s name', required: true, example: 'experience')]
    #[BodyParam('fields[].label', 'string', 'Field\'s label', required: true, example: 'Expérience')]
    #[BodyParam('fields[].type', 'string', 'Field\'s type', required: true, example: 'textarea')]
    #[BodyParam('fields[].order', 'number', 'Field\'s order', required: true, example: 1)]

Before

{
    "name": "Experience Form",
    "fields": {
        "name": "experience",
        "label": "Exp\u00e9rience",
        "type": "textarea",
        "order": 1
    }
}

After

{
    "name": "Experience Form",
    "fields": [
        {
            "name": "experience",
            "label": "Exp\u00e9rience",
            "type": "textarea",
            "order": 1
        }
    ]
}

@shalvah
Copy link
Contributor

shalvah commented Sep 2, 2023

Cool. Could you rename some of those test methods? get_sample_body() and bodyParams() are too generic names for a test that's designed to test certain specific things (in this case, array fields).

@stephane-monnot
Copy link
Contributor Author

Thank you for the review. I have renamed the methods.

@shalvah shalvah merged commit 16a879d into knuckleswtf:master Sep 3, 2023
6 checks passed
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 this pull request may close these issues.

2 participants