-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(read_)selector
handle selected part is removed out-of-band (#94)
For some *composite* API responses, where only the subset of the response represents the resource that the user currently tracks. In this case, users use `(read_)selector` to select the tracked resource from this response. Currently, the provider will always try to apply the selector (query) on the response and return the query result, even if queried out nothing, in which case the follow up modify body process in read function will fail with errors like below: ``` │ Error: Modifying `body` during Read ... │ unmarshal the body "": unexpected end of JSON input ``` This can be triggered by several cases, e.g.: 1. The selector is not correctly composed 2. The resource is removed out-of-band This PR changes the behavior when the query returns nothing, that we will regard this resource as non exist. This has no problem for the 2nd case, but might introduce in-convenience for the 1st case, as user now will need to either import the resource or remove it out-of-band... This change covers: - Resource `restful_resource` - `read_selector` - Data Source `restful_resource` - `selector`
- Loading branch information
Showing
4 changed files
with
56 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters