You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a user of this plugin, I would like to define my APIs to return a single object containing a list of results as my data source so that I do not have to perform any hacky workarounds on my API to conform with the plugin's requirements.
Describe the solution you'd like
Non-CRUD data sources should be created for any GET endpoint that returns a single object, not just ones that return an array.
Acceptance criteria
Data sources are created from all GET endpoints that return a single object.
A meta attribute is introduced to exclude certain GET endpoints from being converted to data sources.
A data source should be creatable for the following API response for example -
As you can see, the above workaround is a bit hacky. Users using my API directly will be fairly confused why I've got such a strange structure - with an array containing a single object containing an array.
If I don't wrap my response in such a manner and directly return my list of results I get the following error - Error: your query returned contains more than one result. Please change your search criteria to make it more specific because the plugin only wants one result (I think it is so that it can set the ID of the data source).
Additional context
Bonus points if an id/x-terraform-id doesn't have to be defined on the API response. I'm not sure Terraform even meaningfully uses the ID of a data source so you could even just set it to some random GUID.
Checklist (for admin only)
Don't forget to go through the checklist to make sure the issue is created properly:
I have added a corresponding label (feature request) to the issue (right side menu)
I have added this issue to the 'API Terraform Provider' GitHub project (right side menu)
The text was updated successfully, but these errors were encountered:
Wrapped responses are common, I'm surprised this hasn't been implemented (unless there's a workaround?). I'm using a public API so can't just change its responses:
Is your feature request related to a problem?
As a user of this plugin, I would like to define my APIs to return a single object containing a list of results as my data source so that I do not have to perform any hacky workarounds on my API to conform with the plugin's requirements.
Describe the solution you'd like
Non-CRUD data sources should be created for any GET endpoint that returns a single object, not just ones that return an array.
Acceptance criteria
A data source should be creatable for the following API response for example -
Describe alternatives you've considered
The alternative has been to return a single item array on my GET list requests.
Example -
As you can see, the above workaround is a bit hacky. Users using my API directly will be fairly confused why I've got such a strange structure - with an array containing a single object containing an array.
If I don't wrap my response in such a manner and directly return my list of results I get the following error -
Error: your query returned contains more than one result. Please change your search criteria to make it more specific
because the plugin only wants one result (I think it is so that it can set the ID of the data source).Additional context
Bonus points if an
id
/x-terraform-id
doesn't have to be defined on the API response. I'm not sure Terraform even meaningfully uses the ID of a data source so you could even just set it to some random GUID.Checklist (for admin only)
Don't forget to go through the checklist to make sure the issue is created properly:
The text was updated successfully, but these errors were encountered: