Skip to content

Commit

Permalink
Update TxnOrPublishRevocationsResultSchema (#3164)
Browse files Browse the repository at this point in the history
* fix response for publish revocations

Signed-off-by: cl0ete <cloete.dupreez@gmail.com>

* add logging

Signed-off-by: cl0ete <cloete.dupreez@gmail.com>

* update model to make txn a list of TransactionRecordSchema

Signed-off-by: cl0ete <cloete.dupreez@gmail.com>

* update return value to match response model

Signed-off-by: cl0ete <cloete.dupreez@gmail.com>

* remove logging

Signed-off-by: cl0ete <cloete.dupreez@gmail.com>

* ran script generate-open-api-spec

Signed-off-by: cl0ete <cloete.dupreez@gmail.com>

* remove white space

Signed-off-by: cl0ete <cloete.dupreez@gmail.com>

* TxnOrPublishRevocations... extends PublishRevocationsSchema

Signed-off-by: cl0ete <cloete.dupreez@gmail.com>

* remove sent i.e. revert back

Signed-off-by: cl0ete <cloete.dupreez@gmail.com>

* ran script generate-open-api-spec

Signed-off-by: cl0ete <cloete.dupreez@gmail.com>

---------

Signed-off-by: cl0ete <cloete.dupreez@gmail.com>
  • Loading branch information
cl0ete committed Aug 14, 2024
1 parent 15af464 commit 06f1d36
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 34 deletions.
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

0 comments on commit 06f1d36

Please sign in to comment.