From 58c870846731bda1c7a5a65c35dfad67a3d72402 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torma=20Krist=C3=B3f?= Date: Thu, 11 Nov 2021 16:27:19 +0100 Subject: [PATCH] add schemas --- src/resources.py | 0 src/schemas.py | 34 +++++++++++++++++++++++++++++----- 2 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 src/resources.py diff --git a/src/resources.py b/src/resources.py new file mode 100644 index 0000000..e69de29 diff --git a/src/schemas.py b/src/schemas.py index 5d1c32f..dc39fd5 100644 --- a/src/schemas.py +++ b/src/schemas.py @@ -14,12 +14,36 @@ __module_name__ = "schemas" __version__text__ = "1" -class SampleSchema(ma.Schema): +class ServiceSchema(ma.Schema): """ Parameters: - - date (date) - - device_id (int) + - location (ipv4) + - zone (string) """ - date = fields.DateTime(required=True) - device_id = fields.Integer(required=True) + location = fields.IPv4(required=True) + zone = fields.String(required=True) + + +class ServiceDirectorySchema(ma.Schema): + """ + Parameters: + - name (string) + - id (uuid) + """ + + name = fields.String(required=True) + id = fields.UUID(required=True) + + +class ServiceLocatorSchema(ma.Schema): + """ + Parameters: + - name (string) + - id (uuid) + - servicearray (object) + """ + + name = fields.String(required=True) + id = fields.UUID(required=True) + servicearray = fields.Nested(ServiceSchema, many=True, required=True)