Open robertschubert opened 1 month ago
BTW: workaround for me as user of that library is to call credential.getCredentialSubject().getJsonObject()
and then get @type
from the map.
When I understood it right,
@type
is a keyword in JSON-LD used to set the type of an object, whiletype
is a term that is defined by the@context
and its meaning it can vary based on the context.
@robertschubert You are correct about this from a pure JSON-LD perspective. However, the W3C VCDM specification is clear that it uses type
, not @type
. See here and here.
Therefore I think our implementation should not support a dedicated call to get @type
, and if you really need that, you coud use the workaround you mention.
Do you agree, or do you see that differently?
Hi @peacekeeper thanks for your answer. I can live with the workaround.
But: When going through both links you provided there is a note in both (just ctrl - f "@type"):
NOTE: The Verifiable Credentials Data Model is based on JSON-LD The type system for the Verifiable Credentials Data Model is the same as for [JSON-LD11] and is detailed in Section 3.5: Specifying the Type and Section 9: JSON-LD Grammar. When using a JSON-LD context (see Section 5.2 Extensibility), this specification aliases the @type keyword to type to make the JSON-LD documents more easily understood. While application developers and document authors do not need to understand the specifics of the JSON-LD type system, implementers of this specification who want to support interoperable extensibility, do.
If I understand it correctly an implementation should alias the @type
to type
. So I guess it should be supported from a specification point of view.
I am using the
verifiable-credentials-java
module.When executing
credential.getCredentialSubject().getTypes()
the method returns the values of the field with the nametype
in thecredentialSubject
.Looking into the code obviously the type is returned in
JsonLDObject
:I have a json object defined like this:
When I understood it right,
@type
is a keyword in JSON-LD used to set the type of an object, whiletype
is a term that is defined by the@context
and its meaning it can vary based on the context.In the current implementation I cannot get the
@type
since onlytype
is processed.Can you add support for
@type
in theJsonLDObject
?