Closed mpr13129 closed 9 months ago
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.
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.
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)
The problem is that the property doesnt exist inside the postgress.
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.