Skip to content

Commit

Permalink
Merge pull request #498 from sklump/create-pres-req-needs-no-conn-id
Browse files Browse the repository at this point in the history
create-pres-req does not need connection: adjust body schema
  • Loading branch information
andrewwhitehead authored May 8, 2020
2 parents 4db02e7 + 0fa13e7 commit e81a2b8
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions aries_cloudagent/protocols/present_proof/v1_0/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,9 @@ class IndyProofRequestSchema(Schema):
non_revoked = fields.Nested(IndyProofReqNonRevokedSchema(), required=False)


class V10PresentationRequestRequestSchema(AdminAPIMessageTracingSchema):
"""Request schema for sending a proof request."""
class V10PresentationCreateRequestRequestSchema(AdminAPIMessageTracingSchema):
"""Request schema for creating a proof request free of any connection."""

connection_id = fields.UUID(
description="Connection identifier", required=True, example=UUIDFour.EXAMPLE
)
proof_request = fields.Nested(IndyProofRequestSchema(), required=True)
comment = fields.Str(required=False)
trace = fields.Bool(
Expand All @@ -219,6 +216,16 @@ class V10PresentationRequestRequestSchema(AdminAPIMessageTracingSchema):
)


class V10PresentationSendRequestRequestSchema(
V10PresentationCreateRequestRequestSchema
):
"""Request schema for sending a proof request on a connection."""

connection_id = fields.UUID(
description="Connection identifier", required=True, example=UUIDFour.EXAMPLE
)


class IndyRequestedCredsRequestedAttrSchema(Schema):
"""Schema for requested attributes within indy requested credentials structure."""

Expand Down Expand Up @@ -511,7 +518,7 @@ async def presentation_exchange_send_proposal(request: web.BaseRequest):
Creates a presentation request not bound to any proposal or existing connection
""",
)
@request_schema(V10PresentationRequestRequestSchema())
@request_schema(V10PresentationCreateRequestRequestSchema())
@response_schema(V10PresentationExchangeSchema(), 200)
async def presentation_exchange_create_request(request: web.BaseRequest):
"""
Expand Down Expand Up @@ -577,7 +584,7 @@ async def presentation_exchange_create_request(request: web.BaseRequest):
tags=["present-proof"],
summary="Sends a free presentation request not bound to any proposal",
)
@request_schema(V10PresentationRequestRequestSchema())
@request_schema(V10PresentationSendRequestRequestSchema())
@response_schema(V10PresentationExchangeSchema(), 200)
async def presentation_exchange_send_free_request(request: web.BaseRequest):
"""
Expand Down Expand Up @@ -653,7 +660,7 @@ async def presentation_exchange_send_free_request(request: web.BaseRequest):
summary="Sends a presentation request in reference to a proposal",
)
@match_info_schema(PresExIdMatchInfoSchema())
@request_schema(V10PresentationRequestRequestSchema())
@request_schema(V10PresentationSendRequestRequestSchema())
@response_schema(V10PresentationExchangeSchema(), 200)
async def presentation_exchange_send_bound_request(request: web.BaseRequest):
"""
Expand Down

0 comments on commit e81a2b8

Please sign in to comment.