- Issue created by @kopeboy
- Status changed to Needs review
9 months ago 2:59pm 27 February 2024 - Open on Drupal.org →Core: 10.2.1 + Environment: PHP 8.2 & MySQL 8last update
9 months ago Waiting for branch to pass - 🇮🇹Italy aronne
Hi @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 - Status changed to Fixed
8 months ago 10:51am 29 March 2024 - Status changed to Needs review
7 months ago 12:41pm 9 April 2024 - 🇮🇹Italy kopeboy Milan
Thank 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.:
operations: GetProposals: httpMethod: GET uri: "juno/cosmos/gov/v1beta1/proposals" summary: "Gov Last Proposals" responseModel: Proposals parameters: pagination.limit: location: query description: Pagination limit type: string required: false default: '10'
It seems like there is no way to escape the dot in a key, so I would need to use the "name", like:
operations: GetProposals: httpMethod: GET uri: "juno/cosmos/gov/v1beta1/proposals" summary: "Gov Last Proposals" responseModel: Proposals parameters: - name: 'pagination.limit' location: query description: Pagination limit type: string required: false default: '10'
But this seems unsupported, as the operation disappears (no errors logged).
If instead this is already supported, what syntax should I use? 🙏
FYI this is the API I'm trying to integrate: https://raw.githubusercontent.com/cosmos/cosmos-sdk/main/client/docs/swa...
- 🇮🇹Italy aronne
Hi there,
you can use another name in your service description and then use the "sentAs" property to send it as "pagination.limit"operations: GetProposals: httpMethod: GET uri: "juno/cosmos/gov/v1beta1/proposals" summary: "Gov Last Proposals" responseModel: Proposals parameters: limit: location: query description: Pagination limit type: string required: false default: '10' sentAs: "pagination.limit"
Regards,
aronne - 🇮🇹Italy kopeboy Milan
I just realized I can define the resource in json in the meantime! 😅
- 🇮🇹Italy kopeboy Milan
Actually I can't solve it even with JSON.
Still getting thekey contains a dot which is not supported
error when I use:{ "parameters": { "pagination.limit": { "location": "query", "description": "Pagination limit", "type": "string", "required": false, "default": "10" }
The action still disappears with:
"parameters": [ { "name": "pagination.limit", "location": "query", "description": "Pagination limit", "type": "string", "required": false, "default": "10" } ]
And by removing the
[]
array I getInvalidArgumentException: Parameters must be arrays, GetProposals.name is string in GuzzleHttp\Command\Guzzle\Operation->resolveParameters()
- 🇮🇹Italy aronne
Did you read what I wrote in comment #7 ✨ Use the name property of Guzzle service description Needs review ?
- Status changed to RTBC
7 months ago 1:34pm 9 April 2024 - 🇮🇹Italy kopeboy Milan
Sorry, 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 🙃😅
- Status changed to Fixed
6 months ago 7:58am 23 May 2024 Automatically closed - issue fixed for 2 weeks with no activity.