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

fix: Correct handling for metadata and resourceMetadata query params + other fixes [DEV-4758] #340

Merged
merged 46 commits into from
Feb 21, 2025

Conversation

DaevMithran
Copy link
Contributor

@DaevMithran DaevMithran commented Feb 18, 2025

  1. Remove isSingleQuery in services/diddoc/echo_handlers.go and handle the metadata and resourceMetadata in QueryDIDDocRequestService
  2. Rename DidDocResourceCollectionEchoHandler (update testcases as well)
  3. Rename DIDDocResourceDereferencingService
  4. Rename ResourceService.ResolveCollectionResources
  5. Rename resourceCheck Variable in services/request_service_base.go
  6. Replace the removed Testcase "can get DIDDoc with an existent versionId and versionTime query parameters with Chrome Accept header"
  7. Return invalidDidUrl Error when any query parameter is misspelt

DaevMithran and others added 30 commits January 31, 2025 14:44
Signed-off-by: Sownak Roy <sownak@cheqd.io>
Signed-off-by: Sownak Roy <sownak@cheqd.io>
Signed-off-by: Sownak Roy <sownak@cheqd.io>
Signed-off-by: Sownak Roy <sownak@cheqd.io>
Signed-off-by: Sownak Roy <sownak@cheqd.io>
Signed-off-by: Sownak Roy <sownak@cheqd.io>
Signed-off-by: Sownak Roy <sownak@cheqd.io>
Signed-off-by: Sownak Roy <sownak@cheqd.io>
Signed-off-by: Sownak Roy <sownak@cheqd.io>
Signed-off-by: Sownak Roy <sownak@cheqd.io>
@ankurdotb ankurdotb changed the title fix: Support metadata=false && resourceMetadata with W3DIDRes header fix: Correct handling for metadata and resourceMetadata query params + other fixes [DEV-4758] Feb 19, 2025
@ankurdotb
Copy link
Contributor

Task linked: DEV-4758 Bug fixes from DID Resolution task

sownak and others added 4 commits February 19, 2025 18:42
Signed-off-by: Sownak Roy <sownak@cheqd.io>
Signed-off-by: Sownak Roy <sownak@cheqd.io>
Copy link
Contributor

@ankurdotb ankurdotb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Examples of non-working queries:

  1. http://localhost:8080/1.0/identifiers/did:cheqd:testnet:9cdea85b-7524-4962-ad11-c943b8303692?versionTime=2025-01-24&resourceMetadata=false - Returns the contents of a resource, rather than a specific DID Document with DLR metadata taken out
  2. Sent http://localhost:8080/1.0/identifiers/did:cheqd:testnet:9cdea85b-7524-4962-ad11-c943b8303692?resourceName=didScidExample&resourceType=didScidLogEntry with accept header application/ld+json;profile="https://w3id.org/did-url-dereferencing" - Expected to get both the resource as well as it's metadata when this specific header/profile was applied since that's the whole point of the DID URL dereferencing task that we're supposed to be doing, i.e., if no header supplied return resource but if this header's passed, return resource + metadata. And this doesn't seem to be doing that.
  3. http://localhost:8080/1.0/identifiers/did:cheqd:testnet:55dbc8bf-fba3-4117-855c-1e0dc1d3bb47?resourceName=Eventbrite Logo with same accept header as previous one returns just image, rather than Base64 encoded resource + it's metadata

@DaevMithran
Copy link
Contributor Author

@ankurdotb

  1. http://localhost:8080/1.0/identifiers/did:cheqd:testnet:9cdea85b-7524-4962-ad11-c943b8303692?versionTime=2025-01-24&resourceMetadata=false - Returns the contents of a resource, rather than a specific DID Document with DLR metadata taken out

DIDDocuments are only returned on DIDResolution. Default behaviour for resource queries is dereferencing as discussed. The below curl request should provide the output you expected
curl -X GET "http://localhost:8080/1.0/identifiers/did:cheqd:testnet:9cdea85b-7524-4962-ad11-c943b8303692?versionTime=2025-01-24&resourceMetadata=false" -H "Accept: application/ld+json;profile=\"https://w3id.org/did-resolution\""

  1. Sent http://localhost:8080/1.0/identifiers/did:cheqd:testnet:9cdea85b-7524-4962-ad11-c943b8303692?resourceName=didScidExample&resourceType=didScidLogEntry with accept header application/ld+json;profile="https://w3id.org/did-url-dereferencing" - Expected to get both the resource as well as it's metadata when this specific header/profile was applied since that's the whole point of the DID URL dereferencing task that we're supposed to be doing, i.e., if no header supplied return resource but if this header's passed, return resource + metadata. And this doesn't seem to be doing that.

Resource queries do not return content + contentMetadata, This was not specified in the task. This works only for http://localhost:8080/1.0/identifiers/did:cheqd:testnet:9cdea85b-7524-4962-ad11-c943b8303692/resources/<resource_id>.
If needed we can work this feature on a separate PR.

  1. http://localhost:8080/1.0/identifiers/did:cheqd:testnet:55dbc8bf-fba3-4117-855c-1e0dc1d3bb47?resourceName=Eventbrite Logo with same accept header as previous one returns just image, rather than Base64 encoded resource + it's metadata

Same as above

@ankurdotb ankurdotb merged commit d0eb1f9 into develop Feb 21, 2025
18 checks passed
@ankurdotb ankurdotb deleted the resource-query branch February 21, 2025 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants