class TestSchema(Schema): id = fields.UUID() foo = fields.String(description="Foo", default="bar") choice = EnumField(Choices) value = EnumField(ValueType, by_value=True) names = fields.List(fields.String) payload = fields.Dict() ref = fields.Nested(NewPersonSchema)
class SearchCustomerEventSchema(SearchEventSchema): event_type = EnumField( CustomerEventType, ) pizza_id = fields.UUID() order_id = fields.UUID() pizza_size = EnumField(PizzaSize) pizza_type = EnumField(PizzaType) topping_type = EnumField(ToppingType)
class NewCustomerEventSchema(Schema): event_type = EnumField( CustomerEventType, required=True, ) pizza_id = fields.UUID() order_id = fields.UUID() pizza_size = EnumField(PizzaSize) pizza_type = EnumField(PizzaType) topping_type = EnumField(ToppingType)
class TestSchema(Schema): id = fields.UUID() foo = fields.String(description="Foo", default="bar") choice = EnumField(Choices) value = EnumField(ValueType, by_value=True) names = fields.List(fields.String) payload = fields.Dict() ref = fields.Nested(NewPersonSchema) decimal = fields.Decimal() decimalString = fields.Decimal(as_string=True) decorated = swagger_field(fields.Method()) datetime = fields.DateTime() unix_timestamp = TimestampField() iso_timestamp = TimestampField(use_isoformat=True) mixed = MixedField()
class NewPersonSchema(Schema): # both attribute and data_key fields should result in the same swagger definition firstName = fields.String(attribute="first_name", required=True) last_name = fields.String(data_key="lastName", required=True) eye_color = EnumField(EyeColor, data_key="eyeColor") email = fields.Email() @property def csv_column_order(self): return ["firstName", "lastName"]
class NewOrderEventSchema(Schema): # TODO Restore when migration fixed # customer_id = fields.UUID(required=True, data_key='customerId') order_id = fields.UUID(required=True, data_key="orderId") event_type = EnumField(OrderEventType, required=True, data_key="eventType")
class EnumSchema(Schema): name = EnumField(TestEnum, by_value=False) value = EnumField(TestEnum, by_value=True) int_name = EnumField(TestIntEnum, by_value=False) int_value = EnumField(TestIntEnum, by_value=True)
class SearchAddressPageSchema(OffsetLimitPageSchema): list_param = QueryStringList(String()) enum_param = EnumField(TestEnum)
class TestSchema(Schema): choice = EnumField(Choices) value = EnumField(ValueType, by_value=True)
class EnumQueryStringListSchema(Schema): foo_ids = QueryStringList(EnumField(TestEnum))
class SearchTaskEventSchema(SearchEventSchema): task_id = fields.UUID() event_type = EnumField(TaskEventType)
class NewTaskEventSchema(Schema): assignee = fields.String(required=False, allow_none=True) deadline = fields.DateTime(required=False, allow_none=True) taskId = fields.UUID(attribute="task_id", required=True) eventType = EnumField(TaskEventType, attribute="event_type", required=True)
class SearchToppingSchema(PageSchema): pizza_id = fields.UUID(required=True, ) topping_type = EnumField(ToppingType)