Skip to content

Commit

Permalink
added IntegerForeignProperty and updated BatchSize on the SQSEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
brianjinwright committed Jun 28, 2018
1 parent da41a25 commit aca8eee
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 3 additions & 2 deletions sammy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
from valley.contrib import Schema
from valley.utils.json_utils import ValleyEncoderNoType

from sammy.custom_properties import ForeignInstanceListProperty, CharForeignProperty
from sammy.custom_properties import ForeignInstanceListProperty, \
CharForeignProperty, IntForeignProperty


API_METHODS = {
Expand Down Expand Up @@ -156,7 +157,7 @@ class SQSEvent(EventSchema):
_event_type = 'SQS'

Queue = CharForeignProperty(Ref, required=True)
BatchSize = IntegerProperty()
BatchSize = IntForeignProperty(Ref)


class KinesisEvent(EventSchema):
Expand Down
9 changes: 8 additions & 1 deletion sammy/custom_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from valley.mixins import ListMixin
from valley.properties import BaseProperty, MultiProperty
from valley.utils.json_utils import ValleyEncoder
from valley.validators import ForeignListValidator, StringValidator, ForeignValidator
from valley.validators import ForeignListValidator, StringValidator, ForeignValidator, IntegerValidator


class ForeignSubclassListValidator(ForeignListValidator):
Expand Down Expand Up @@ -58,3 +58,10 @@ def __init__(self,foreign_class,**kwargs):
StringValidator()],**kwargs)


class IntForeignProperty(MultiProperty):

def __init__(self,foreign_class,**kwargs):

super(IntForeignProperty, self).__init__(
validators=[ForeignValidator(foreign_class),
IntegerValidator()],**kwargs)

0 comments on commit aca8eee

Please sign in to comment.