DOI-USGS / DOI-USGS/sbtools

could item_upsert be more flexible or rigid?

Open
#240 1 comment 0 reactions 1 assignee Claimed by @dblodgett-usgs View on GitHub
Dominant language
R
Stars
24
Forks
20
PR merge metrics
No merged PRs in 30d

Description

If you create a new item using `item_upsert` with the title in `info` rather than `title`, the value in `info$title` gets silently ignored.

After logging in:
```
# create a new item (works as expected)
test_item <- item_upsert(title="books.json")

# unexpected: the new item has the title "books.json" rather than "sbtools stuff".
item_upsert(test_item, title=NULL, info=list(title = "sbtools stuff"))
# This message was given: "title is NULL - re-using title from input SB item"
# But it's not clear from the message that/why info$title is getting ignored
```

Possible approaches to clarify/change this behavior:
1. Make `item_upsert` more clearly restrictive: either noisily override `title` with `info$title` if `info$title` exists, or always throw an error if `title` is included in `info`.
2. Make `item_upsert` more flexible: allow for all sorts of item queries, rather than just queries by `title`. All sorts of queries are available through the ScienceBase API for UPSERT (https://my.usgs.gov/confluence/display/sciencebase/ScienceBase+Catalog+Item+REST+Services#ScienceBaseCatalogItemRESTServices-UPSERTRequests). Maybe the `title` arg could be replaced by a `query_list` arg with the same definition as `query_list` in `query_sb`?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.