Skip to content

Commit

Permalink
Merge pull request #2746 from dbluhm/fix/connrecord-schema-name
Browse files Browse the repository at this point in the history
fix: partial revert of ConnRecord schema change
  • Loading branch information
swcurran authored Feb 13, 2024
2 parents 13bea7c + 595a9b0 commit dbe1198
Show file tree
Hide file tree
Showing 5 changed files with 990 additions and 449 deletions.
8 changes: 4 additions & 4 deletions aries_cloudagent/connections/models/conn_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ConnRecord(BaseRecord):
class Meta:
"""ConnRecord metadata."""

schema_class = "ConnRecordSchema"
schema_class = "MaybeStoredConnRecordSchema"

class Protocol(Enum):
"""Supported Protocols for Connection."""
Expand Down Expand Up @@ -637,11 +637,11 @@ def __eq__(self, other: Any) -> bool:
return super().__eq__(other)


class ConnRecordSchema(BaseRecordSchema):
class MaybeStoredConnRecordSchema(BaseRecordSchema):
"""Schema to allow serialization/deserialization of connection records."""

class Meta:
"""ConnRecordSchema metadata."""
"""MaybeStoredConnRecordSchema metadata."""

model_class = ConnRecord

Expand Down Expand Up @@ -763,7 +763,7 @@ class Meta:
)


class StoredConnRecordSchema(ConnRecordSchema):
class ConnRecordSchema(MaybeStoredConnRecordSchema):
"""Schema representing stored ConnRecords."""

class Meta:
Expand Down
14 changes: 7 additions & 7 deletions aries_cloudagent/protocols/connections/v1_0/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

from ....admin.request_context import AdminRequestContext
from ....cache.base import BaseCache
from ....connections.models.conn_record import ConnRecord, StoredConnRecordSchema
from ....connections.models.conn_record import ConnRecord, ConnRecordSchema
from ....messaging.models.base import BaseModelError
from ....messaging.models.openapi import OpenAPISchema
from ....messaging.valid import (
Expand Down Expand Up @@ -48,7 +48,7 @@ class ConnectionListSchema(OpenAPISchema):
"""Result schema for connection list."""

results = fields.List(
fields.Nested(StoredConnRecordSchema()),
fields.Nested(ConnRecordSchema()),
required=True,
metadata={"description": "List of connection records"},
)
Expand Down Expand Up @@ -233,7 +233,7 @@ class ConnectionStaticResultSchema(OpenAPISchema):
"example": INDY_RAW_PUBLIC_KEY_EXAMPLE,
},
)
record = fields.Nested(StoredConnRecordSchema(), required=True)
record = fields.Nested(ConnRecordSchema(), required=True)


class ConnectionsListQueryStringSchema(OpenAPISchema):
Expand Down Expand Up @@ -485,7 +485,7 @@ async def connections_list(request: web.BaseRequest):

@docs(tags=["connection"], summary="Fetch a single connection record")
@match_info_schema(ConnectionsConnIdMatchInfoSchema())
@response_schema(StoredConnRecordSchema(), 200, description="")
@response_schema(ConnRecordSchema(), 200, description="")
async def connections_retrieve(request: web.BaseRequest):
"""Request handler for fetching a single connection record.
Expand Down Expand Up @@ -670,7 +670,7 @@ async def connections_create_invitation(request: web.BaseRequest):
)
@querystring_schema(ReceiveInvitationQueryStringSchema())
@request_schema(ReceiveInvitationRequestSchema())
@response_schema(StoredConnRecordSchema(), 200, description="")
@response_schema(ConnRecordSchema(), 200, description="")
async def connections_receive_invitation(request: web.BaseRequest):
"""Request handler for receiving a new connection invitation.
Expand Down Expand Up @@ -711,7 +711,7 @@ async def connections_receive_invitation(request: web.BaseRequest):
)
@match_info_schema(ConnectionsConnIdMatchInfoSchema())
@querystring_schema(AcceptInvitationQueryStringSchema())
@response_schema(StoredConnRecordSchema(), 200, description="")
@response_schema(ConnRecordSchema(), 200, description="")
async def connections_accept_invitation(request: web.BaseRequest):
"""Request handler for accepting a stored connection invitation.
Expand Down Expand Up @@ -761,7 +761,7 @@ async def connections_accept_invitation(request: web.BaseRequest):
)
@match_info_schema(ConnectionsConnIdMatchInfoSchema())
@querystring_schema(AcceptRequestQueryStringSchema())
@response_schema(StoredConnRecordSchema(), 200, description="")
@response_schema(ConnRecordSchema(), 200, description="")
async def connections_accept_request(request: web.BaseRequest):
"""Request handler for accepting a stored connection request.
Expand Down
12 changes: 6 additions & 6 deletions aries_cloudagent/protocols/didexchange/v1_0/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from marshmallow import fields

from ....admin.request_context import AdminRequestContext
from ....connections.models.conn_record import ConnRecord, StoredConnRecordSchema
from ....connections.models.conn_record import ConnRecord, ConnRecordSchema
from ....messaging.models.base import BaseModelError
from ....messaging.models.openapi import OpenAPISchema
from ....messaging.valid import (
Expand Down Expand Up @@ -197,7 +197,7 @@ class DIDXRejectRequestSchema(OpenAPISchema):
)
@match_info_schema(DIDXConnIdMatchInfoSchema())
@querystring_schema(DIDXAcceptInvitationQueryStringSchema())
@response_schema(StoredConnRecordSchema(), 200, description="")
@response_schema(ConnRecordSchema(), 200, description="")
async def didx_accept_invitation(request: web.BaseRequest):
"""Request handler for accepting a stored connection invitation.
Expand Down Expand Up @@ -243,7 +243,7 @@ async def didx_accept_invitation(request: web.BaseRequest):
summary="Create and send a request against public DID's implicit invitation",
)
@querystring_schema(DIDXCreateRequestImplicitQueryStringSchema())
@response_schema(StoredConnRecordSchema(), 200, description="")
@response_schema(ConnRecordSchema(), 200, description="")
async def didx_create_request_implicit(request: web.BaseRequest):
"""Request handler for creating and sending a request to an implicit invitation.
Expand Down Expand Up @@ -294,7 +294,7 @@ async def didx_create_request_implicit(request: web.BaseRequest):
)
@querystring_schema(DIDXReceiveRequestImplicitQueryStringSchema())
@request_schema(DIDXRequestSchema())
@response_schema(StoredConnRecordSchema(), 200, description="")
@response_schema(ConnRecordSchema(), 200, description="")
async def didx_receive_request_implicit(request: web.BaseRequest):
"""Request handler for receiving a request against public DID's implicit invitation.
Expand Down Expand Up @@ -340,7 +340,7 @@ async def didx_receive_request_implicit(request: web.BaseRequest):
)
@match_info_schema(DIDXConnIdMatchInfoSchema())
@querystring_schema(DIDXAcceptRequestQueryStringSchema())
@response_schema(StoredConnRecordSchema(), 200, description="")
@response_schema(ConnRecordSchema(), 200, description="")
async def didx_accept_request(request: web.BaseRequest):
"""Request handler for accepting a stored connection request.
Expand Down Expand Up @@ -385,7 +385,7 @@ async def didx_accept_request(request: web.BaseRequest):
)
@match_info_schema(DIDXConnIdMatchInfoSchema())
@request_schema(DIDXRejectRequestSchema())
@response_schema(StoredConnRecordSchema(), 200, description="")
@response_schema(ConnRecordSchema(), 200, description="")
async def didx_reject(request: web.BaseRequest):
"""Abandon or reject a DID Exchange."""
context: AdminRequestContext = request["context"]
Expand Down
Loading

0 comments on commit dbe1198

Please sign in to comment.