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
Creating an array parameter fails #35
Comments
That was fixed for 1.0.5: 83a4692 Can you double check your SDK version? |
The required dependency is "kusanagi/katana-sdk-php7", with the version constraint set as "^1.1". When running
Which corresponds the the latest commit on the 1.1 branch. |
Version branches was not being updated. Merged now. |
I now get the following:
The configuration for the <param name="params" type="array" required="true"/> And the definition of the $param = $request->newParam('params', [['a', 'b', 'c'], ['d', 'e', 'f']], 'array'); |
@nullproxy can you try adding |
I've done a couple tests with an array param set from the request middleware and I think the issue is in the framework, not in the SDK. I got an action with this config (removing the irrelevant for brevity): action:
- name: list
param:
- name: ids
type: array
http-gateway: false Then I did a test with a simple array and logging both the message sent to the framework and the result from the SDK: $param = $request->newParam('ids', ['a', 'b', 'c'], 'array'); The message looks correct. {
"cr": {
"n": "rest",
"r": {
"c": {
"s": "orgs",
"v": "1.1.0-qa.5",
"a": "list",
"p": [
{
"n": "ids",
"v": [
"a",
"b",
"c"
],
"t": "array"
}
]
}
}
}
} But the log does not match:
Then repeated the test with a multi array, with this other code: $param = $request->newParam('ids', [['a', 'b', 'c'], ['d', 'e', 'f']], 'array'); Once again, the message looks good. {
"cr": {
"n": "rest",
"r": {
"c": {
"s": "orgs",
"v": "1.1.0-qa.5",
"a": "list",
"p": [
{
"n": "ids",
"v": [
[
"a",
"b",
"c"
],
[
"d",
"e",
"f"
]
],
"t": "array"
}
]
}
}
}
} But now I get the same error mentioned in the comment above.
Then, trying with
I think there might be something wrong with the arrays in the framework here, but I can see no issue in the SDK. |
When defining a parameter as an array using
Request::newParam()
I got an error stating that the data type must be a string, yet I'm defining an array in PHP.In my case, I'm defining an array where each item is an array, for example:
Here is the error message received:
The issue appears to come from here:
https://github.com/kusanagi/katana-sdk-php7/blob/master/src/Api/ParamAccessorTrait.php#L76
This was using version 1.1.4 of the framework, with system info below:
The text was updated successfully, but these errors were encountered: