Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: put DataAddress as Asset field #3244

Merged

Conversation

ndr-brt
Copy link
Member

@ndr-brt ndr-brt commented Jun 29, 2023

What this PR changes/adds

Put DataAddress as a field of Asset

Why it does that

At first they were kept separated because DataAddress was like "private data for asset", but now we have also privateProperties in Asset, so there aren't good reasons to keep them split. Doing this we'll end up with a way more clean api.

Further notes

  • added a /v3/assets api endpoint that would avoid breaking changes, though the advice is to switch to the new api as soon as possible.
  • cleaned up AssetIndex tests on both in memory and postgresql, likely they could broke in the cosmosdb, eventually I will take care of fixing them

Linked Issue(s)

Closes #3151

Please be sure to take a look at the contributing guidelines and our etiquette for pull requests.

* @return {@link StoreResult#success()} if the objects were stored, {@link StoreResult#alreadyExists(String)} when an object with the same ID already exists.
*/
default StoreResult<Void> create(Asset asset) {
return create(new AssetEntry(asset, asset.getDataAddress()));

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation

Invoking [AssetIndex.create](1) should be avoided because it has been deprecated.
@ndr-brt ndr-brt added refactoring Cleaning up code and dependencies api Feature related to the (REST) api labels Jun 29, 2023
@codecov-commenter
Copy link

Codecov Report

Patch coverage: 71.75% and project coverage change: +0.02 🎉

Comparison is base (33a22bc) 65.93% compared to head (86e62ee) 65.96%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3244      +/-   ##
==========================================
+ Coverage   65.93%   65.96%   +0.02%     
==========================================
  Files         842      844       +2     
  Lines       16875    16954      +79     
  Branches      926      930       +4     
==========================================
+ Hits        11126    11183      +57     
- Misses       5380     5400      +20     
- Partials      369      371       +2     
Impacted Files Coverage Δ
...or/api/management/asset/v2/AssetApiController.java 100.00% <ø> (ø)
...ement/asset/validation/AssetEntryDtoValidator.java 63.63% <ø> (-22.73%) ⬇️
.../connector/store/sql/assetindex/SqlAssetIndex.java 0.00% <0.00%> (ø)
...ql/assetindex/schema/BaseSqlDialectStatements.java 0.00% <0.00%> (ø)
...ain/java/org/eclipse/edc/spi/asset/AssetIndex.java 0.00% <0.00%> (ø)
.../org/eclipse/edc/spi/types/domain/asset/Asset.java 67.74% <40.00%> (-15.60%) ⬇️
...d/transformer/to/JsonObjectToAssetTransformer.java 83.33% <50.00%> (-4.91%) ⬇️
...pi/management/asset/validation/AssetValidator.java 80.00% <80.00%> (ø)
...efaults/storage/assetindex/InMemoryAssetIndex.java 94.80% <80.95%> (+0.13%) ⬆️
.../edc/connector/service/asset/AssetServiceImpl.java 97.61% <100.00%> (+0.05%) ⬆️
... and 3 more

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@paullatzelsperger paullatzelsperger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are not exposing raw Assets (and thus: DataAddresses) to the public, this change is good. It'll simplifies our management API.

However, since the DataAddress itself is only a wrapper around a Map (i.e. properties) with named accessors, we could perhaps take things one step further and simplify even more by completely collapsing DataAddress into Asset. In another PR though.

@ndr-brt ndr-brt merged commit 7019768 into eclipse-edc:main Jul 5, 2023
@ndr-brt ndr-brt deleted the 3151-put-dataaddress-into-asset branch July 5, 2023 07:17
bjungs pushed a commit to imec-int/edc that referenced this pull request Aug 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Feature related to the (REST) api refactoring Cleaning up code and dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

management api: Create asset payload inconsistent with the rest of the API entities
4 participants