-
Notifications
You must be signed in to change notification settings - Fork 55
List DIDs should not return all DID Documents, just DID IDs #608
Comments
Let's first decide on what resource the
Regardless of what we choose, we should update all the verb endpoints to return only the resource in question. This includes the List endpoints. I favor to having the resource be |
it's kind of both, it stores DID Docs but the key is DIDs when thinking about the utility of the API, what use is it to get all of the DID Documents at once? my gut is it seems more useful to see which DIDs are there, and then make an additional GET query to see information specific to a DID |
I image a UI that will display a table with all the DID with their corresponding services and public keys. You could also do filtering to show only the did's that have certain properties, like a service.
Combining those two concepts will lead to confusion for consumers of the API. We are better off sticking to a single resource. It also makes documentation cleaner. Not doing so causes the same ambiguity that exists between The way I view this is that we should allow updates to DID Documents. Some DID Methods will allow those updates (like |
Can you elaborate on the problem you're describing / trying to avoid? Is it that there is a lot of data coming back? If so, what are the reasons that is a problem? |
It's not the amount of data it's the utility of the data. I believe the APIs would have more utility if you could progressively ask for more information. So, changing the List endpoints to not return the entire response that a GET on the specific resource would return, I believe, would be more useful. E.g. see which DIDs are available before getting details about them, see which schemas are available, before getting details about them. |
I find that there is more value in being consistent about the type of the resource that you're operating in, than crafting ad-hoc responses for every request. Additionally, progressively asking requires doing multiple requests for data that you could have readily available, and forces clients to do individual requests for every single resource that you want to display in full, instead of a single call.
This is, IMHO, is a concern at the layer that presents the data. This is typically a UI. Choosing which fields to get back is a feature in and of itself, and can be solved using different approaches (like using a read mask, a view enumeration, or a thin GraphQL wrapper) |
What about this would be inconsistent? It's up to us to determine what's most useful for each API; there would be consistency within each API boundary (schemas, dids, ...)
Sure, but we could also return all the data the service holds in each request and say "it's up to the presentation layer" but that would be a pretty bad experience. I like the idea of a read mask, and I think in fact we can consider my suggestion in this light, where the default is low detail, but you could pass a flag like |
The inconsistency is on the resource that the endpoints are operating on. IIUC, you are suggesting that
It's a balancing act. I disagree with the premise that it would be a bad experience. It depends on the needs of the consumers of the API.
As long as we're operating on the same resource, I think that's fine. For clarity, I think it's fine for {
"dids": [
{
"id": "did:key:xxx"
},
{
"id": "did:key:yyy"
}
]
} I would NOT recommend for it to return the following: {
"dids": ["did:key:xxx", "did:key:yyy"]
} |
Currently the GET on any DID method such as
v1/dids/key
returns all DIDs and their DID documents. This is too much info, and hard to read. We should return a list of DID ID strings instead, and use the get DID endpoint (v1/dids/key/{id}
) to get specific DID Documents.The text was updated successfully, but these errors were encountered: