Closed peacekeeper closed 3 years ago
As with https://github.com/w3c/did-core/pull/595#issuecomment-772845778...
Needs much more detailed longdesc
description
Agreed with @OR13 .. there are terms in the JSON-LD representation which are not in the context, making this representation invalid, per:
Producers SHOULD NOT produce DID documents that contain properties not defined via the @context.
And also need to improve a11y, for #118
@rhiaro thanks, I agree. I just pushed an update that fixes this, and the JSON-LD representation should now be valid. Do you agree?
This diagram remains incorrect:
https://github.com/w3c/did-core/pull/596#issuecomment-774794739
I will not approve this PR until:
@context
is included in the DID Document INFRA map that is used to produce the JSON-LD....
Alternative solutions:
@context
but did+ld+json is produced from an ADM that contains an @context
.@context
in the ADM, but not in the JSON or CBOR representations@OR13
... for example, when serializing a DID Document with extensions for PGP...
The abstract data model would need to contain the
@context
for the registered extensions, such as:
Hm. If I am overly pedantic, then I do not agree...
In my view, the ADM does not include the context. The ADM representations for that particular DID includes a term (PgpVerificationKey2021
) that is not defined as a bona fide core DID term. The ADM "processor" (method, whatever) must then consult the registry, locate the PgpVerificationKey2021
entry in the registry, find the corresponding context reference, and must add that @context
to the generated JSON-LD. This does not mean that the context, per se, is part of the data model, it means that there is a well-defined course of action for a processor to handle the non-core terms which involves the registry and the generation of additional @context
statements. That is very different. (Whether the processor does this registry look up on the fly, or whether it has a cached version, becomes an implementation detail from the point of view of the DID Core spec.)
This process is not really described in the spec (and it probably should not, this should probably be the subject of the final version of the method specification when it comes). Maybe the spec should at least hint at this (oops, we have one more day to add a PR if we want to have that...:-)
I may agree that something about this may have to be part of the diagram but I am not sure: the diagram may become very bloated.
You may try to convince me not to be that pedantic:-)
@iherman https://w3c.github.io/did-core/#production-0
See the current normative requirements for JSON-LD production.
Its not possible to produce application/did+ld+json
for a "DID Document: INFRA<MAP>"
without it containing an @context
... I'm sorry this is confusing, but is pretty fundamental to consensus regarding the viability of the ADM... without my assertion being true, we don't have an ADM representation for JSON-LD, and we don't have consensus on the ADM at all... I recall making this point a number of times on WG calls, and my understanding of consensus has been captured in @peacekeeper 's image here:
@jricher and @iherman are correct, the ADM does NOT need to contain @context
or other representation-specific entries. I believe @OR13 's and @msporny 's characterization of the conclusion of the ADM discussions is inaccurate.
What we agreed on was that unknown entries including representation-specific ones such as @context
can be preserved in the ADM, e.g. when you first consume JSON-LD and then produce JSON, then you will still have the @context
. Personally I still believe this is a big mistake, but that was the agreement. This is why my diagram in https://github.com/w3c/did-core/pull/595 shows @context
as a representation-specific entry in the ADM.
However, this does NOT mean that @context
MUST be present in the ADM when you construct an instance of the DID document data model from scratch (or obtain one as a result of the resolve()
function), and then want to produce a JSON-LD representation from it.
I'm very surprised to hear that this is being proposed now.
If that's your position, then you are suggesting
Both approaches would render the concept of an "abstract" data model absurd. Both are likely to break as soon as another representation such as XML or YAML is added.
As you can see in https://github.com/w3c/did-core/pull/610 there is clearly a misunderstanding regarding JSON-LD DID Document Production and Consumption.
The problem is compounded by diagrams that appear to look like JSON....
It is true that an @context
might be internally represented differently than INFRA when the document is constructed from scratch.... it is FALSE that the the ADM will represent the @context
as something other than an INFRA when it consumes a serialized JSON-LD Document.... it is also false that consuming a JSON-LD document somehow "looses the context information"...
In other words... the reason the diagram is wrong is that consuming JSON-LD with an @context
means it is stored in the ADM (somehow)... full stop.
This makes the diagram false if it contains a consumption arrow for JSON that includes an @context
or $schema
and the ADM does not show those values... in the same way that the diagram would be false if it conveyed that properties were dropped as a result of consumption and production.
A separate problem with the diagram is that showing JSON-LD consumption and production require preserving @context
but the same DID Document being produced and consumed in JSON might not....
This is a function of having 2 representation... and is not solved by pretending that the same information in the ADM can support both... for example.. the diagram implies that somehow JSON->ADM->JSON-LD is possible... but its not... we have proved this... because the ADM cannot know the context for members in JSON..... and no amount of. "I think there is a way" is going to make it into the spec at this point.
So the diagram is confusing / wrong on 2 fronts.
@context
is preserved (somehow).@context
is somehow useful (even though its not)Part of having an ADM means the individual representation features might not be respected in other representations... to mitigate this, we adopted several resolutions regarding consumption and preservation of unregistered properties.
This PR attempts to undo those resolutions with an image that is misleading, and should not be accepted.
Part of having and ADM means the individual representation features might not be respected in other representations... to mitigate this, we adopted several resolutions regarding consumption and preservation of unregistered properties.
Found the meeting where this was discussed:
https://www.w3.org/2019/did-wg/Meetings/Minutes/2020-11-05-did#section2
@peacekeeper, could you please point out where we agreed to what you're suggesting? Perhaps it happened in another meeting?
@OR13 - There are several small but possibly troublesome typos in your last comment; at the least, they cause a hiccup in reading and trying to understand relatively important details. In most (I think, all) of these, and
has replaced the word which belonged there (mostly if not all as
or an
). I think I figured out what was meant in all cases, but it would be best if you could review and correct the typos in your comment...
The issue was discussed in a meeting on 2021-02-11
the diagram implies that somehow JSON->ADM->JSON-LD is possible... but its not... we have proved this...
@OR13 it should be possible if the JSON only contains registered properties. If you have a proof that this is not possible, I'd love to see it. Enabling this was the original reason why we introduced the registry (and the requirement to supply a JSON-LD context for each registered property) at the Amsterdam F2F.
If the JSON contains unregistered properties, then I agree this is not possible.
In an attempt to unblock this, @OR13 and @msporny would you agree with this diagram if I change it as follows:
In an attempt to unblock this, @OR13 and @msporny would you agree with this diagram if I change it as follows
The diagram is an improvement over the previous one. The diagram is still not clear wrt. where @context
comes from. I'm trying to add language in the Editorial pass to provide a bucket, expressible via the data model, where you can store/retrieve representation-specific entries during the consumption/production process.
Do you have the diagram above available in an editable format? It would be easier for me to just show you what I'm talking about.
@peacekeeper I would agree to the diagram in:
https://github.com/w3c/did-core/pull/596#issuecomment-779276110
IF and only IF:
A. @context
where present in the entries prior to JSON-LD production.
B. JSON-LD
production was defined as a process that took an @context
/ other representation specific entries.
we cannot create information from nothing...
we probably should have defined functional signatures for production and consumption ages ago....
A. produce(adm: entries) => Buffer (JSON-LD)
B. produce(adm: infraMap, options: infraMap ) => Buffer (JSON-LD)
I would accept either....but B would require significant changes to the spec.
It sounds to me like @peacekeeper might prefer B... in which case production would look like this:
const produceJsonLd = (entries: object, options: object) =>{
return JSON.stringify({...entries, ...options.requiredMembers});
}
We would be required to define options in did core, and requiredMembers
infra map... and it would be required to include an @context
for JSON-LD and a $schema
for JSON Schema.
A.
@context
where present in the entries prior to JSON-LD production.
Then how does it magically get removed to produce the plain JSON representation? Anyway, I think adding such requirements won't work, since that would break the concept of an abstract data model.
Do you have the diagram above available in an editable format?
I'm attaching the source file, yes maybe you can draw your perspective on how it should work..
A.
@context
where present in the entries prior to JSON-LD production.Then how does it magically get removed to produce the plain JSON representation? Anyway, I think adding such requirements won't work, since that would break the concept of an abstract data model.
why would you add an @context
and then try to produce application/did+json
?
...also... @context
and $schema
are legal members of JSON.. you can tell because JSON-LD and JSON Schema are BOTH JSON... you are introducing harmful complexity in an attempt to redefine what JSON is in this WG.
@peacekeeper now that we have the concept of a representation-specific entries map
can you please update the diagrams to include that (noting that @context
comes from that map for JSON-LD production). That should allow us to get these diagrams integrated. I will also note that the diagram in the data model section is now wrong (because it contemplates @context
in the DID Document data model, which is now incorrect).
I will also note that the diagram in the data model section is now wrong (because it contemplates
@context
in the DID Document data model, which is now incorrect).
Because I have re-created this diagram in draw.io, I guess I "own it" now... I will look into this.
I will also note that the diagram in the data model section is now wrong (because it contemplates
@context
in the DID Document data model, which is now incorrect).Because I have re-created this diagram in draw.io, I guess I "own it" now... I will look into this.
Hmm this really becomes harder to draw now, but how do people feel about this?
@peacekeeper I like this version very much. You did a good job of adding representation-specific entries. Spot on. Nice job.
@peacekeeper that picture is better, but is till not completely in line with the spec... for example:
https://w3c.github.io/did-core/#data-model
production and consumption are defined in terms of the "DID Document entries"... so sadly... this diagram is not consistent with those section... I hate to be pedantic, but this is still a problem.
production and consumption are not defined in term of "representation specific entries"...
They are defined in terms of DID Document entries... The new picture implies that representation specific entries are some how no did document entries... if thats true the production and consumption sections need to be rewritten.
For example, see https://github.com/transmute-industries/did-core/blob/main/packages/did-ld-json/src/did-ld-json.ts#L55
its possible that if you cover one eye and squint, the spec is implying that
1. DID Document = <DID Document Entries + DID Document Representation Specific Entries>
or...
2. DID Document = <DID Document Entries>, <DID Document Representation Specific Entries>
the spec says 1, this diagram implies 2.
@OR13: After merging @msporny 's PR https://github.com/w3c/did-core/pull/679, the section on Production and Consumption now says
A conforming producer MUST take a DID document data model and a representation-specific entries map as input into the production process.
I.e. the produce function now takes two maps as input, and the consume function returns two maps as output. That's what the new diagram in this PR here https://github.com/w3c/did-core/pull/596#issuecomment-784323901 is trying to show.
I agree this is now inconsistent with the data model diagram. @iherman is working on updating that in https://github.com/w3c/did-core/pull/692.
I would approve this, if the upper left hand corner looked like:
^ the data model must be presented consistently.
The issue was discussed in a meeting on 2021-02-25
@OR13
^ the data model must be presented consistently.
"Consistently" does not necessarily mean "identically", at least, not in any dictionary with which I'm familiar.
The two illustrations serve different purposes, and therefore show different perspectives of the same thing, which perspectives are not inconsistent with each other, in my opinion. In yesterday's call, it sounded to me like most others are in agreement with me on this.
Perhaps you can explain how you see the two to be in disagreement with each other, which might help us figure out how to communicate the different perspectives, serve the different purposes, without that apparent disagreement?
I'm running out of time to merge this PR before freeze this coming Monday COB ET. I need an update @peacekeeper -- ETA? If we can't get this in before CR, it's not a big deal, it's editorial, it can go in after we're in CR.
I pushed an updated version, based on recent conversations.
Changes:
For the "Representations" section:
Diagram illustrating how representations of the data model are produced and consumed, including in JSON, JSON-LD, and CBOR.
Preview | Diff