Skip to content

Commit

Permalink
Revert /revocation endpoint schema to INDY
Browse files Browse the repository at this point in the history
Signed-off-by: DaevMithran <[email protected]>
  • Loading branch information
DaevMithran committed Dec 11, 2024
1 parent 5739bcb commit 31ea8cf
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 29 deletions.
46 changes: 23 additions & 23 deletions acapy_agent/revocation/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@
from ..messaging.models.openapi import OpenAPISchema
from ..messaging.responder import BaseResponder
from ..messaging.valid import (
ANONCREDS_CRED_DEF_ID_EXAMPLE,
ANONCREDS_CRED_DEF_ID_VALIDATE,
INDY_CRED_DEF_ID_EXAMPLE,
INDY_CRED_DEF_ID_VALIDATE,
INDY_CRED_REV_ID_EXAMPLE,
INDY_CRED_REV_ID_VALIDATE,
ANONCREDS_REV_REG_ID_EXAMPLE,
ANONCREDS_REV_REG_ID_VALIDATE,
INDY_REV_REG_ID_EXAMPLE,
INDY_REV_REG_ID_VALIDATE,
INDY_REV_REG_SIZE_EXAMPLE,
INDY_REV_REG_SIZE_VALIDATE,
UUID4_EXAMPLE,
Expand Down Expand Up @@ -86,10 +86,10 @@ class RevRegCreateRequestSchema(OpenAPISchema):
"""Request schema for revocation registry creation request."""

credential_definition_id = fields.Str(
validate=ANONCREDS_CRED_DEF_ID_VALIDATE,
validate=INDY_CRED_DEF_ID_VALIDATE,
metadata={
"description": "Credential definition identifier",
"example": ANONCREDS_CRED_DEF_ID_EXAMPLE,
"example": INDY_CRED_DEF_ID_EXAMPLE,
},
)
max_cred_num = fields.Int(
Expand Down Expand Up @@ -143,10 +143,10 @@ def validate_fields(self, data, **kwargs):

rev_reg_id = fields.Str(
required=False,
validate=ANONCREDS_REV_REG_ID_VALIDATE,
validate=INDY_REV_REG_ID_VALIDATE,
metadata={
"description": "Revocation registry identifier",
"example": ANONCREDS_REV_REG_ID_EXAMPLE,
"example": INDY_REV_REG_ID_EXAMPLE,
},
)
cred_rev_id = fields.Str(
Expand Down Expand Up @@ -182,18 +182,18 @@ def validate_fields(self, data, **kwargs):

rev_reg_id = fields.Str(
required=False,
validate=ANONCREDS_REV_REG_ID_VALIDATE,
validate=INDY_REV_REG_ID_VALIDATE,
metadata={
"description": "Revocation registry identifier",
"example": ANONCREDS_REV_REG_ID_EXAMPLE,
"example": INDY_REV_REG_ID_EXAMPLE,
},
)
cred_def_id = fields.Str(
required=False,
validate=ANONCREDS_CRED_DEF_ID_VALIDATE,
validate=INDY_CRED_DEF_ID_VALIDATE,
metadata={
"description": "Credential definition identifier",
"example": ANONCREDS_CRED_DEF_ID_EXAMPLE,
"example": INDY_CRED_DEF_ID_EXAMPLE,
},
)

Expand Down Expand Up @@ -270,7 +270,7 @@ class PublishRevocationsSchema(OpenAPISchema):

rrid2crid = fields.Dict(
required=False,
keys=fields.Str(metadata={"example": ANONCREDS_REV_REG_ID_EXAMPLE}),
keys=fields.Str(metadata={"example": INDY_REV_REG_ID_EXAMPLE}),
values=fields.List(
fields.Str(
validate=INDY_CRED_REV_ID_VALIDATE,
Expand Down Expand Up @@ -303,7 +303,7 @@ class ClearPendingRevocationsRequestSchema(OpenAPISchema):

purge = fields.Dict(
required=False,
keys=fields.Str(metadata={"example": ANONCREDS_REV_REG_ID_EXAMPLE}),
keys=fields.Str(metadata={"example": INDY_REV_REG_ID_EXAMPLE}),
values=fields.List(
fields.Str(
validate=INDY_CRED_REV_ID_VALIDATE,
Expand Down Expand Up @@ -383,10 +383,10 @@ class RevRegsCreatedSchema(OpenAPISchema):

rev_reg_ids = fields.List(
fields.Str(
validate=ANONCREDS_REV_REG_ID_VALIDATE,
validate=INDY_REV_REG_ID_VALIDATE,
metadata={
"description": "Revocation registry identifiers",
"example": ANONCREDS_REV_REG_ID_EXAMPLE,
"example": INDY_REV_REG_ID_EXAMPLE,
},
)
)
Expand All @@ -401,7 +401,7 @@ class RevRegUpdateTailsFileUriSchema(OpenAPISchema):
"description": "Public URI to the tails file",
"example": (
"http://192.168.56.133:6543/revocation/registry/"
f"{ANONCREDS_REV_REG_ID_EXAMPLE}/tails-file"
f"{INDY_REV_REG_ID_EXAMPLE}/tails-file"
),
},
)
Expand All @@ -412,10 +412,10 @@ class RevRegsCreatedQueryStringSchema(OpenAPISchema):

cred_def_id = fields.Str(
required=False,
validate=ANONCREDS_CRED_DEF_ID_VALIDATE,
validate=INDY_CRED_DEF_ID_VALIDATE,
metadata={
"description": "Credential definition identifier",
"example": ANONCREDS_CRED_DEF_ID_EXAMPLE,
"example": INDY_CRED_DEF_ID_EXAMPLE,
},
)
state = fields.Str(
Expand Down Expand Up @@ -452,10 +452,10 @@ class RevRegIdMatchInfoSchema(OpenAPISchema):

rev_reg_id = fields.Str(
required=True,
validate=ANONCREDS_REV_REG_ID_VALIDATE,
validate=INDY_REV_REG_ID_VALIDATE,
metadata={
"description": "Revocation Registry identifier",
"example": ANONCREDS_REV_REG_ID_EXAMPLE,
"example": INDY_REV_REG_ID_EXAMPLE,
},
)

Expand All @@ -465,10 +465,10 @@ class RevocationCredDefIdMatchInfoSchema(OpenAPISchema):

cred_def_id = fields.Str(
required=True,
validate=ANONCREDS_CRED_DEF_ID_VALIDATE,
validate=INDY_CRED_DEF_ID_VALIDATE,
metadata={
"description": "Credential definition identifier",
"example": ANONCREDS_CRED_DEF_ID_EXAMPLE,
"example": INDY_CRED_DEF_ID_EXAMPLE,
},
)

Expand Down
10 changes: 4 additions & 6 deletions acapy_agent/revocation/tests/test_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,23 +74,21 @@ async def test_validate_cred_rev_rec_qs_and_revoke_req(self):
):
req.validate_fields(
{
"rev_reg_id": test_module.ANONCREDS_REV_REG_ID_EXAMPLE,
"rev_reg_id": test_module.INDY_REV_REG_ID_EXAMPLE,
"cred_rev_id": test_module.INDY_CRED_REV_ID_EXAMPLE,
}
)
req.validate_fields({"cred_ex_id": test_module.UUID4_EXAMPLE})
with self.assertRaises(test_module.ValidationError):
req.validate_fields({})
with self.assertRaises(test_module.ValidationError):
req.validate_fields(
{"rev_reg_id": test_module.ANONCREDS_REV_REG_ID_EXAMPLE}
)
req.validate_fields({"rev_reg_id": test_module.INDY_REV_REG_ID_EXAMPLE})
with self.assertRaises(test_module.ValidationError):
req.validate_fields({"cred_rev_id": test_module.INDY_CRED_REV_ID_EXAMPLE})
with self.assertRaises(test_module.ValidationError):
req.validate_fields(
{
"rev_reg_id": test_module.ANONCREDS_REV_REG_ID_EXAMPLE,
"rev_reg_id": test_module.INDY_REV_REG_ID_EXAMPLE,
"cred_ex_id": test_module.UUID4_EXAMPLE,
}
)
Expand All @@ -104,7 +102,7 @@ async def test_validate_cred_rev_rec_qs_and_revoke_req(self):
with self.assertRaises(test_module.ValidationError):
req.validate_fields(
{
"rev_reg_id": test_module.ANONCREDS_REV_REG_ID_EXAMPLE,
"rev_reg_id": test_module.INDY_REV_REG_ID_EXAMPLE,
"cred_rev_id": test_module.INDY_CRED_REV_ID_EXAMPLE,
"cred_ex_id": test_module.UUID4_EXAMPLE,
}
Expand Down

0 comments on commit 31ea8cf

Please sign in to comment.