Skip to content

Commit a6c36d0

Browse files
committed
add validation to oob record
Signed-off-by: Roman Reinert <roman.reinert@gematik.de>
1 parent 4c6d7ca commit a6c36d0

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

aries_cloudagent/protocols/out_of_band/v1_0/models/oob_record.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import json
44
from typing import Any, Mapping, Optional, Union
55

6-
from marshmallow import fields
6+
from marshmallow import fields, validate
77

88
from .....connections.models.conn_record import ConnRecord
99
from .....core.profile import ProfileSession
@@ -248,6 +248,9 @@ class Meta:
248248
required=True,
249249
description="Out of band message exchange state",
250250
example=OobRecord.STATE_AWAIT_RESPONSE,
251+
validate=validate.OneOf(
252+
OobRecord.get_attributes_by_prefix("STATE_", walk_mro=True)
253+
),
251254
)
252255
invi_msg_id = fields.Str(
253256
required=True,
@@ -287,4 +290,7 @@ class Meta:
287290
description="OOB Role",
288291
required=False,
289292
example=OobRecord.ROLE_RECEIVER,
293+
validate=validate.OneOf(
294+
OobRecord.get_attributes_by_prefix("ROLE_", walk_mro=False)
295+
),
290296
)

0 commit comments

Comments
 (0)