From 662b2641bddc6414cc9d0c6e49dcc8d35f384c17 Mon Sep 17 00:00:00 2001 From: ff137 Date: Tue, 16 Apr 2024 15:51:51 +0200 Subject: [PATCH] :bug: Fix IndyAttrValue model that was dropped from openapi spec Signed-off-by: ff137 --- aries_cloudagent/indy/models/cred.py | 10 ++++++++++ open-api/openapi.json | 27 ++++++++++++++++++++++++++- open-api/swagger.json | 24 +++++++++++++++++++++++- 3 files changed, 59 insertions(+), 2 deletions(-) diff --git a/aries_cloudagent/indy/models/cred.py b/aries_cloudagent/indy/models/cred.py index d0c7f7537a..f5d00a66b4 100644 --- a/aries_cloudagent/indy/models/cred.py +++ b/aries_cloudagent/indy/models/cred.py @@ -55,6 +55,16 @@ class Meta: class DictWithIndyAttrValueSchema(fields.Dict): """Dict with indy attribute value schema.""" + def __init__(self, **kwargs): + """Initialize the custom schema for a dictionary with IndyAttrValue.""" + super().__init__( + keys=fields.Str(metadata={"description": "Attribute name"}), + values=fields.Nested( + IndyAttrValueSchema(), metadata={"description": "Attribute value"} + ), + **kwargs, + ) + def _deserialize(self, value, attr, data, **kwargs): """Deserialize dict with indy attribute value.""" if not isinstance(value, dict): diff --git a/open-api/openapi.json b/open-api/openapi.json index be72c53d47..9f061e4426 100644 --- a/open-api/openapi.json +++ b/open-api/openapi.json @@ -9484,6 +9484,22 @@ "HolderModuleResponse" : { "type" : "object" }, + "IndyAttrValue" : { + "properties" : { + "encoded" : { + "description" : "Attribute encoded value", + "example" : "-1", + "pattern" : "^-?[0-9]*$", + "type" : "string" + }, + "raw" : { + "description" : "Attribute raw value", + "type" : "string" + } + }, + "required" : [ "encoded", "raw" ], + "type" : "object" + }, "IndyCredAbstract" : { "properties" : { "cred_def_id" : { @@ -9646,8 +9662,10 @@ "type" : "object" }, "values" : { + "additionalProperties" : { + "$ref" : "#/components/schemas/IndyCredential_values_value" + }, "description" : "Credential attributes", - "properties" : { }, "type" : "object" }, "witness" : { @@ -15931,6 +15949,13 @@ "description" : "Non-revocation interval from presentation request", "type" : "object" }, + "IndyCredential_values_value" : { + "allOf" : [ { + "$ref" : "#/definitions/IndyAttrValue" + } ], + "description" : "Attribute value", + "type" : "object" + }, "IndyPrimaryProof_eq_proof" : { "allOf" : [ { "$ref" : "#/components/schemas/IndyEQProof" diff --git a/open-api/swagger.json b/open-api/swagger.json index e35382e04f..911260e44e 100644 --- a/open-api/swagger.json +++ b/open-api/swagger.json @@ -8161,6 +8161,22 @@ "HolderModuleResponse" : { "type" : "object" }, + "IndyAttrValue" : { + "type" : "object", + "required" : [ "encoded", "raw" ], + "properties" : { + "encoded" : { + "type" : "string", + "example" : "-1", + "description" : "Attribute encoded value", + "pattern" : "^-?[0-9]*$" + }, + "raw" : { + "type" : "string", + "description" : "Attribute raw value" + } + } + }, "IndyCredAbstract" : { "type" : "object", "required" : [ "cred_def_id", "key_correctness_proof", "nonce", "schema_id" ], @@ -8327,7 +8343,13 @@ "values" : { "type" : "object", "description" : "Credential attributes", - "properties" : { } + "additionalProperties" : { + "type" : "object", + "description" : "Attribute value", + "allOf" : [ { + "$ref" : "#/definitions/IndyAttrValue" + } ] + } }, "witness" : { "type" : "object",