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

@type property disappears from asset-API #3376

Closed
arnoweiss opened this issue Aug 21, 2023 · 8 comments
Closed

@type property disappears from asset-API #3376

arnoweiss opened this issue Aug 21, 2023 · 8 comments
Labels
stale Open for x days with no activity

Comments

@arnoweiss
Copy link

Bug Report

Describe the Bug

v2/asset endpoint of the Managment API ignores "@type" property and redundantly adds "edc:id"-property.

Steps to Reproduce

First, create the Asset.

POST /api/management/v2/assets HTTP/1.1
Host: myedc.com
X-Api-Key: {{apiKey}}
Content-Type: application/json
Authorization: Bearer mytoken
Content-Length: 625

{
    "@context": {
        "@vocab": "https://w3id.org/edc/v0.0.1/ns/",
        "cx-common": "https://w3id.org/catenax/ontology/common#"
    },
    "asset": {
        "@type": "Asset",
        "@id": "asset-73586fe5-fcc5-40dd-b98a-8d809dbdf17c",
        "properties": {
            "@type": "cx-common:GraphAsset" // this is intended
        }
    },
    "dataAddress": {
        "@type": "DataAddress",
        "type": "HttpData",
        "baseUrl": "http://mysubmodelrepository.com/submodels/myDppId/submodel",
        "proxyPath": "true",
        "proxyBody": "true",
        "proxyMethod": "true",
        "proxyQueryParams": "true"
    }
}

Then, get the Asset by its id.

GET /api/management/v2/assets/asset-73586fe5-fcc5-40dd-b98a-8d809dbdf17c HTTP/1.1
Host: myedc.com
X-Api-Key: {{apiKey}}
Content-Type: application/json
Authorization: Bearer myToken

Expected Behavior

{
    "@id": "asset-73586fe5-fcc5-40dd-b98a-8d809dbdf17c", 
    "@type": "edc:Asset",
    "edc:properties": {
            "@type": "cx-common:GraphAsset" 
    },
    "@context": {
        "dct": "https://purl.org/dc/terms/",
        "tx": "https://w3id.org/tractusx/v0.0.1/ns/",
        "edc": "https://w3id.org/edc/v0.0.1/ns/",
        "dcat": "https://www.w3.org/ns/dcat/",
        "odrl": "http://www.w3.org/ns/odrl/2/",
        "dspace": "https://w3id.org/dspace/v0.8/"
    }
}

Observed Behavior

{
    "@id": "asset-73586fe5-fcc5-40dd-b98a-8d809dbdf17c",
    "@type": "edc:Asset",
    "edc:properties": {
        "edc:id": "asset-73586fe5-fcc5-40dd-b98a-8d809dbdf17c" // this is the result
    },
    "@context": {
        "dct": "https://purl.org/dc/terms/",
        "tx": "https://w3id.org/tractusx/v0.0.1/ns/",
        "edc": "https://w3id.org/edc/v0.0.1/ns/",
        "dcat": "https://www.w3.org/ns/dcat/",
        "odrl": "http://www.w3.org/ns/odrl/2/",
        "dspace": "https://w3id.org/dspace/v0.8/"
    }
}
@github-actions
Copy link

Thanks for your contribution 🔥 We will take a look asap 🚀

@ndr-brt
Copy link
Member

ndr-brt commented Aug 21, 2023

/v2/assets has been deprecated in favor of /v3/assets that already solves this issue, please try it out

EDIT: not properly, edc:properties does not expect a @type field, you should add the type as a generic property eventually, as edc:type

@arnoweiss
Copy link
Author

arnoweiss commented Aug 21, 2023

If I understand correctly, "@type" should be interpreted as equivalent to "rdf:type" in json-ld. In case this isn't recognized, "@type" should at least behave like any other property.

@github-actions
Copy link

github-actions bot commented Sep 5, 2023

This issue is stale because it has been open for 14 days with no activity.

@github-actions github-actions bot added the stale Open for x days with no activity label Sep 5, 2023
@arnoweiss
Copy link
Author

If the "properties" section really allows arbitrary json-ld conformant entries, it should accept @type as a key. If that's not the scope, it should at least be documented what keys are disallowed - otherwise people will assume that everything allowed in json-ld is allowed in the EDC as well.

@github-actions github-actions bot removed the stale Open for x days with no activity label Sep 6, 2023
@github-actions
Copy link

This issue is stale because it has been open for 14 days with no activity.

@github-actions github-actions bot added the stale Open for x days with no activity label Sep 20, 2023
@github-actions
Copy link

This issue was closed because it has been inactive for 7 days since being marked as stale.

1 similar comment
@github-actions
Copy link

This issue was closed because it has been inactive for 7 days since being marked as stale.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 27, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Open for x days with no activity
Projects
None yet
Development

No branches or pull requests

2 participants