Skip to content

Commit

Permalink
Merge pull request hyperledger#2894 from ff137/fix/openapi-missing-mo…
Browse files Browse the repository at this point in the history
…del-IndyAttrValue

🐛 Fix IndyAttrValue model that was dropped from openapi spec
  • Loading branch information
dbluhm committed Apr 16, 2024
2 parents 8df6b3e + 662b264 commit e3670e6
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 2 deletions.
10 changes: 10 additions & 0 deletions aries_cloudagent/indy/models/cred.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
27 changes: 26 additions & 1 deletion open-api/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -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" : {
Expand Down Expand Up @@ -9646,8 +9662,10 @@
"type" : "object"
},
"values" : {
"additionalProperties" : {
"$ref" : "#/components/schemas/IndyCredential_values_value"
},
"description" : "Credential attributes",
"properties" : { },
"type" : "object"
},
"witness" : {
Expand Down Expand Up @@ -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"
Expand Down
24 changes: 23 additions & 1 deletion open-api/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -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" ],
Expand Down Expand Up @@ -8327,7 +8343,13 @@
"values" : {
"type" : "object",
"description" : "Credential attributes",
"properties" : { }
"additionalProperties" : {
"type" : "object",
"description" : "Attribute value",
"allOf" : [ {
"$ref" : "#/definitions/IndyAttrValue"
} ]
}
},
"witness" : {
"type" : "object",
Expand Down

0 comments on commit e3670e6

Please sign in to comment.