Skip to content

Commit

Permalink
Merge pull request #320 from esune/fix/tweak-proof-request-model
Browse files Browse the repository at this point in the history
Deprecate name in favour of names array in requested_attributes
  • Loading branch information
esune authored Aug 29, 2023
2 parents 2baf012 + d61b5ab commit 0da3881
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ curl -X 'POST' \
"requested_attributes": [
{
"name": "email",
"names": ["email"],
"restrictions": [
{
"schema_name": "verified-email",
Expand Down
6 changes: 2 additions & 4 deletions oidc-controller/api/verificationConfigs/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"name": "Basic Proof",
"version": "1.0",
"requested_attributes": [
{"name": "first_name", "restrictions": []},
{"name": "last_name", "restrictions": []},
{"names": ["first_name", "last_name"], "restrictions": []},
],
"requested_predicates": [],
},
Expand All @@ -19,8 +18,7 @@
"name": "Basic Proof",
"version": "1.0",
"requested_attributes": [
{"name": "first_name", "restrictions": []},
{"name": "last_name", "restrictions": []},
{"names": ["first_name", "last_name"], "restrictions": []},
],
"requested_predicates": [],
},
Expand Down
3 changes: 1 addition & 2 deletions oidc-controller/api/verificationConfigs/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ class AttributeFilter(BaseModel):


class ReqAttr(BaseModel):
name: str
names: Optional[List[str]]
names: List[str]
label: Optional[str]
restrictions: List[AttributeFilter]

Expand Down
5 changes: 3 additions & 2 deletions oidc-controller/api/verificationConfigs/tests/test_vc_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ async def test_ver_config_patch_proof_request(db_client: Callable[[], MongoClien
VerificationConfigPatch(
proof_request=VerificationProofRequest(
version="0.0.2",
requested_attributes=[ReqAttr(name="first_name", restrictions=[])],
requested_attributes=[ReqAttr(names=["first_name"], restrictions=[])],
requested_predicates=[],
),
),
Expand All @@ -113,4 +113,5 @@ async def test_ver_config_patch_proof_request(db_client: Callable[[], MongoClien
{"ver_config_id": "test_ver_config"}
)
assert document["proof_request"]["version"] == "0.0.2"
assert document["proof_request"]["requested_attributes"][0]["name"] == "first_name"
assert len(document["proof_request"]["requested_attributes"][0]["names"]) == 1
assert document["proof_request"]["requested_attributes"][0]["names"][0] == "first_name"

0 comments on commit 0da3881

Please sign in to comment.