Skip to content

Commit

Permalink
allow list or string as service type + test cases
Browse files Browse the repository at this point in the history
Signed-off-by: pstlouis <patrick.st-louis@opsecid.ca>
  • Loading branch information
PatStLouis committed Jan 4, 2024
1 parent 9fe696f commit 1bcda80
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pydid/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Service(Resource):
"""Representation of DID Document Services."""

id: DIDUrl
type: str
type: Union[str, List[str]]
service_endpoint: Union[
EndpointStrings,
List[Union[EndpointStrings, Mapping[str, Any]]],
Expand Down
30 changes: 30 additions & 0 deletions tests/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@
"routingKeys": ["did:example:somemediator#somekey"],
},
},
{
"id": "did:web:example.com#linked-domain",
"type": ["LinkedDomains"],
"serviceEndpoint": "https://example.com",
},
]

INVALID_SERVICES = [
Expand All @@ -81,6 +86,31 @@
"type": "LinkedDomains",
"serviceEndpoint": True,
},
{
"id": "did:web:example.com#linked-domain",
"type": "",
"serviceEndpoint": "https://example.com",
},
{
"id": "did:web:example.com#linked-domain",
"type": ["Linked Domains"],
"serviceEndpoint": "https://example.com",
},
{
"id": "did:web:example.com#linked-domain",
"type": ["LinkedDomains", True],
"serviceEndpoint": "https://example.com",
},
{
"id": "did:web:example.com#linked-domain",
"type": [],
"serviceEndpoint": "https://example.com",
},
{
"id": "did:web:example.com#linked-domain",
"type": [""],
"serviceEndpoint": "https://example.com",
},
]


Expand Down

0 comments on commit 1bcda80

Please sign in to comment.