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

Update TxnOrPublishRevocationsResultSchema #3164

Merged
merged 10 commits into from
Aug 14, 2024
34 changes: 14 additions & 20 deletions aries_cloudagent/revocation/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,20 +290,17 @@ class PublishRevocationsSchema(OpenAPISchema):
)


class TxnOrPublishRevocationsResultSchema(OpenAPISchema):
class TxnOrPublishRevocationsResultSchema(PublishRevocationsSchema):
"""Result schema for credential definition send request."""

sent = fields.Nested(
PublishRevocationsSchema(),
required=False,
metadata={"definition": "Content sent"},
)
txn = fields.Nested(
TransactionRecordSchema(),
required=False,
metadata={
"description": "Revocation registry revocations transaction to endorse"
},
txn = fields.List(
fields.Nested(
TransactionRecordSchema(),
required=False,
metadata={
"description": "Revocation registry revocations transaction to endorse"
},
)
)


Expand Down Expand Up @@ -661,13 +658,10 @@ async def publish_revocations(request: web.BaseRequest):
raise web.HTTPBadRequest(reason=err.roll_up) from err

if create_transaction_for_endorser:
return web.json_response(
(
await _process_publish_response_for_endorsement(
profile, rev_reg_responses, outbound_handler, endorser_conn_id
)
)
list_of_txns = await _process_publish_response_for_endorsement(
profile, rev_reg_responses, outbound_handler, endorser_conn_id
)
return web.json_response({"txn": list_of_txns})

return web.json_response({"rrid2crid": result})

Expand Down Expand Up @@ -702,7 +696,7 @@ async def _process_publish_response_for_endorsement(

await outbound_handler(transaction_request, connection_id=endorser_conn_id)

txn_responses.append({"txn": transaction.serialize()})
txn_responses.append(transaction.serialize())

return txn_responses

Expand Down Expand Up @@ -1926,4 +1920,4 @@ def post_process_routes(app: web.Application):
methods["get"]["responses"]["200"]["schema"] = {
"type": "string",
"format": "binary",
}
}
27 changes: 20 additions & 7 deletions open-api/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -13703,15 +13703,28 @@
},
"TxnOrPublishRevocationsResult" : {
"properties" : {
"sent" : {
"$ref" : "#/components/schemas/PublishRevocations"
"rrid2crid" : {
"additionalProperties" : {
"items" : {
"description" : "Credential revocation identifier",
"example" : "12345",
"pattern" : "^[1-9][0-9]*$",
"type" : "string"
},
"type" : "array"
},
"description" : "Credential revocation ids by revocation registry id",
"type" : "object"
},
"txn" : {
"allOf" : [ {
"$ref" : "#/components/schemas/TransactionRecord"
} ],
"description" : "Revocation registry revocations transaction to endorse",
"type" : "object"
"items" : {
"allOf" : [ {
"$ref" : "#/components/schemas/TransactionRecord"
} ],
"description" : "Revocation registry revocations transaction to endorse",
"type" : "object"
},
"type" : "array"
}
},
"type" : "object"
Expand Down
27 changes: 20 additions & 7 deletions open-api/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -12148,11 +12148,28 @@
"TxnOrPublishRevocationsResult" : {
"type" : "object",
"properties" : {
"sent" : {
"$ref" : "#/definitions/PublishRevocations"
"rrid2crid" : {
"type" : "object",
"description" : "Credential revocation ids by revocation registry id",
"additionalProperties" : {
"type" : "array",
"items" : {
"type" : "string",
"example" : "12345",
"description" : "Credential revocation identifier",
"pattern" : "^[1-9][0-9]*$"
}
}
},
"txn" : {
"$ref" : "#/definitions/TxnOrPublishRevocationsResult_txn"
"type" : "array",
"items" : {
"type" : "object",
"description" : "Revocation registry revocations transaction to endorse",
"allOf" : [ {
"$ref" : "#/definitions/TransactionRecord"
} ]
}
}
}
},
Expand Down Expand Up @@ -14803,10 +14820,6 @@
"type" : "object",
"description" : "Credential definition transaction to endorse"
},
"TxnOrPublishRevocationsResult_txn" : {
"type" : "object",
"description" : "Revocation registry revocations transaction to endorse"
},
"TxnOrRegisterLedgerNymResponse_txn" : {
"type" : "object",
"description" : "DID transaction to endorse"
Expand Down
Loading