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

query location array can be comma separated #31

Closed
oste opened this issue Jul 4, 2014 · 2 comments
Closed

query location array can be comma separated #31

oste opened this issue Jul 4, 2014 · 2 comments

Comments

@oste
Copy link

oste commented Jul 4, 2014

I think it would be great if there could be a setting to switch the query location behavior to be comma separated rather than array based.

<?php
$description = [
    'operations' => [
        'GetData' => [
            'httpMethod' => 'GET',
            'responseModel' => 'getResponse',
            'parameters' => [
                'ids' => [
                    'type' => 'array',
                    'location' => 'query'
                ]
            ]
        ]
    ],
    'models' => [
        'getResponse' => [
            'type' => 'object',
            'additionalProperties' => [
                'location' => 'json'
            ]
        ]
    ]
];

It would be nice to be able to do something like this

$client = new Client();
$client->GetData(['ids' => ['one', 'two']]);

This would output ?ids=one,two

@oste oste changed the title query location array can be comma seperated query location array can be comma separated Jul 4, 2014
@kulisu
Copy link

kulisu commented Jul 11, 2014

Hi @oste,

reference: Parameter schema
please try the filters property below, this works for me :-D

        "GetData": {
            "httpMethod": "GET",
            "responseModel": "getResponse",
            "parameters": {
                "ids": {
                    "filters": [
                        {
                            "args": [
                                ",",
                                "@value"
                            ],
                            "method": "implode"
                        }
                    ],
                    "location": "query",
                    "type": "array"
                }
            }
        }

Chris Lin

@oste
Copy link
Author

oste commented Jul 27, 2014

cool, this works!

@oste oste closed this as completed Jul 27, 2014
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

2 participants