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

Create New Asset - Additional Properties Attribute #545

Closed
mpr13129 opened this issue Nov 17, 2023 · 2 comments
Closed

Create New Asset - Additional Properties Attribute #545

mpr13129 opened this issue Nov 17, 2023 · 2 comments
Labels
kind/bug Something isn't working. The software does not behave as expected or specified.

Comments

@mpr13129
Copy link

Description

  • In the Create New Asset Dialog, i added an extra field and trying to pass the value of that field as an additional property, since from the latest updates i can't add a new property by myself.

  • After i press the create button, in onSave() in the AssetCreateDialogComponent i can see the post request that is created with the additional property value inside. Also i can verify that the request is being sent to the backend ,from the dev's browser's console. (200 status)
    image

  • The problem is that the property doesnt exist inside the postgress.
    Screenshot from 2023-11-16 15-21-57

To be honest, i can't understand how additional properties really work and what they are for. From the AssetMapperTest.java in connector backend, there is a test: test_buildAssetDto() that builds the asset from a json file (example-asset.jsonld) . There the additional properies are along with the rest properties.

@mpr13129 mpr13129 added the kind/bug Something isn't working. The software does not behave as expected or specified. label Nov 17, 2023
@richardtreier
Copy link
Collaborator

There are fields additionalProperties and additionalJsonProperties in the UiAsset / UiAssetCreateRequest of our API: https://github.com/sovity/edc-extensions/blob/main/launchers/connectors/sovity-dev/src/test/java/de/sovity/edc/e2e/UiApiWrapperTest.java#L213

The key is that the JSON of assets properties was replaced by JSON-LD in the Eclipse EDC. All new custom properties will have to be URLs.

Starting points are JSON-LD and the V2 management API that is now in use.

@richardtreier
Copy link
Collaborator

richardtreier commented Dec 5, 2023

I am closing the issue for now.

The trouble of dealing with JSON-LD is not small at all, as it is a format that needs to be semantically interpreted.

Unfortunately, we did not get to decide on this. Our own UI API handles all the semantic JSON-LD Mapping in the backend. We left the additionalProperties and additionalJsonProperties fields so if people want to both use our API Wrapper that tries to follow the DCAT standard, but also read or write other parts of the Asset JSON-LD.

To get closest to "just let me use JSON" would be something along the lines of

const customProperties = {
  "this-property": "should not be affected by JSON-LD compaction / expansion"
  "some-array": ["do not compact this"]
}

const asset: UiAsset = {
  assetId: 'my-asset',
  // [...]
  additionalProperties: {
    // Stored as string, because otherwise JSON-LD compaction and expansion 
    // or the requirement of URL properties would ruin the JSON
    'http://unknown/customPropertiesJson': JSON.stringify(customProperties)
  }
}

Which is wild, I admit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working. The software does not behave as expected or specified.
Projects
None yet
Development

No branches or pull requests

2 participants