Problem/Motivation
When defining operations parameters in API resources' yml files, the "name" property is ignored and the key is always used as label (for example when manually adding http config request from the UI).
If it would be possible to have different parameter's key and name, I would also change the mapping to the action plugins: currently the parameter's "description" is used as label there, so we have no way of defining an actual description for Drupal actions fields.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 3419219-2.patch | 653 bytes | aronne |
Comments
Comment #2
aronne commentedHi @kopeboy,
here it is the patch which should do the work you were looking for.
You can now add a "label" property in your guzzle service description and it will be used as label for your parameter in the http config request form.
Regards,
aronne
Comment #5
aronne commentedComment #6
kopeboyThank you. That solves the form in the UI, but actually I have still a related unsolved issue about the actual name of the operation's parameter described in the yml.
The problem arises because there is a dot (".") in the name of a query parameter (of an API which I cannot change), and I can't find a way to use it with your module.
This gives me the error pagination.limit key contains a dot which is not supported.:
It seems like there is no way to escape the dot in a key, so I would need to use the "name", like:
But this seems unsupported, as the operation disappears (no errors logged).
If instead this is already supported, what syntax should I use? 🙏
FYI I also opened an issue in the SDK who's providing the API I'm trying to integrate (there you can find the swagger.yml of it): https://github.com/cosmos/cosmos-sdk/issues/19959
Comment #7
aronne commentedHi there,
you can use another name in your service description and then use the "sentAs" property to send it as "pagination.limit"
Regards,
aronne
Comment #8
kopeboyI just realized I can define the resource in json in the meantime! 😅
Comment #9
kopeboyActually I can't solve it even with JSON.
Still getting the
key contains a dot which is not supportederror when I use:The action still disappears with:
The parameter disappears as an input if I use:
And by removing the
[]array I getInvalidArgumentException: Parameters must be arrays, GetProposals.name is string in GuzzleHttp\Command\Guzzle\Operation->resolveParameters()Comment #10
aronne commentedDid you read what I wrote in comment #7?
Comment #11
kopeboySorry, I hadn't! Yep, that works, thank you very much! And sorry for the noise.
This could be another nice addition to the docs for noobs like me 🙃😅
Comment #12
aronne commentedComment #13
aronne commented