question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow data loading in REST integrations

See original GitHub issue

There are use cases where we would like to actually load the updatable view and deserialize onto that loaded instance. We could tell users to inject the EntityViewAwareObjectMapper if that is possible, and use it like this

@Inject EntityViewAwareObjectMapper mapper;

@Path("{id}")
public Response put(@PathParam("id") Long id, InputStream is) {
  MyView v = repository.findById(id);
  mapper.readerFor(MyView.class).withValueToUpdate(v);
}

That is IMO fine if it’s possible, but should definitely be documented.

Quote @beikov

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:16 (16 by maintainers)

github_iconTop GitHub Comments

1reaction
beikovcommented, Dec 14, 2020

I suggest two settings, ApplyMode and a boolean flag updateReference.

+--------------------------------+----------------+-------------------+----------------+-------------------+-----------------------------+--------------------------------+
|                                | creatable (id) | creatable (no id) | updatable (id) | updatable (no id) | creatable + updateable (id) | creatable + updateable (no id) |
+--------------------------------+----------------+-------------------+----------------+-------------------+-----------------------------+--------------------------------+
| CREATE                         | create         | create            | ERROR          | ERROR             | create                      | create                         |
| AUTO + updateReference=true    | create         | create            | update ref     | ERROR             | update ref                  | create                         |
| AUTO + updateReference=false   | create         | create            | update loaded  | ERROR             | update loaded               | create                         |
| UPDATE + updateReference=true  | ERROR          | ERROR             | update ref     | ERROR             | update ref                  | ERROR                          |
| UPDATE + updateReference=false | ERROR          | ERROR             | update loaded  | ERROR             | update loaded               | ERROR                          |
+--------------------------------+----------------+-------------------+----------------+-------------------+-----------------------------+--------------------------------+
0reactions
Mobe91commented, Dec 14, 2020

Ok, let me revise my suggestion:

+-------------------------+----------------+-------------------+----------------+-------------------+-----------------------------+--------------------------------+
|                         | creatable (id) | creatable (no id) | updatable (id) | updatable (no id) | Creatable + updateable (id) | Creatable + updateable (no id) |
+-------------------------+----------------+-------------------+----------------+-------------------+-----------------------------+--------------------------------+
| AUTO                    | create         | create            | update ref     | ERROR             | update ref                  | create                         |
| CREATE                  | create         | create            | ERROR          | ERROR             | create                      | create                         |
| UPDATE_REFERENCE        | ERROR          | ERROR             | update ref     | ERROR             | update ref                  | create                         |
| UPDATE_LOADED           | ERROR          | ERROR             | update loaded  | ERROR             | update loaded               | create                         |
| STRICT_UPDATE_REFERENCE | ERROR          | ERROR             | update ref     | ERROR             | update ref                  | ERROR                          |
| STRICT_UPDATE_LOADED    | ERROR          | ERROR             | update loaded  | ERROR             | update loaded               | ERROR                          |
+-------------------------+----------------+-------------------+----------------+-------------------+-----------------------------+--------------------------------+

This should cover all use cases. Do you agree?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Loading Data via REST API - Gooddata Enterprise
Loading data via REST API consists of the following steps: Prepare the SLI manifest. Prepare CSV files with data to load.
Read more >
Running Data Rules - Oracle Help Center
Executes a Data Management data load rule based on the start period and end period, and import or export options that you specify....
Read more >
Connect REST API to Salesforce: Loading & Querying Data ...
This article provides a comprehensive guide on REST API to Salesforce connection. It also provides information on API, REST API and ...
Read more >
Loading data in Oracle Fusion Cloud. Inbound integration or ...
HCM Data Loader (HDL) · Webservices (Soap) · Rest API · Excel loader Ad-on(ADFDi) · File based data import (FBDI) · More articles...
Read more >
Create a REST (Integration Hub) type data source
Use Batch Import, If selected, specifies that loading data should be batched when you click Load data or Test load 20 records. ;...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found