summaryrefslogtreecommitdiff
path: root/opendc-web/opendc-web-api/opendc/models/trace.py
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-07-02 14:26:23 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2021-07-02 18:07:42 +0200
commit45b73e4683cce35de79117c5b4a6919556d9644f (patch)
treefdbb282b639d03e0cc940c8587d5fe90c2283aa5 /opendc-web/opendc-web-api/opendc/models/trace.py
parente2ec16a1a40f3ffc437378b4e22fda64f86fe284 (diff)
api: Add stricter validation of input/output data
This change adds stricter validation of data that enters and leaves the database. As a result, we clearly separate the database model from the data model that the REST API exports.
Diffstat (limited to 'opendc-web/opendc-web-api/opendc/models/trace.py')
-rw-r--r--opendc-web/opendc-web-api/opendc/models/trace.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/opendc-web/opendc-web-api/opendc/models/trace.py b/opendc-web/opendc-web-api/opendc/models/trace.py
index 2f6e4926..69287f29 100644
--- a/opendc-web/opendc-web-api/opendc/models/trace.py
+++ b/opendc-web/opendc-web-api/opendc/models/trace.py
@@ -1,6 +1,15 @@
+from marshmallow import Schema, fields
+
from opendc.models.model import Model
+class TraceSchema(Schema):
+ """Schema for a Trace."""
+ _id = fields.String(dump_only=True)
+ name = fields.String()
+ type = fields.String()
+
+
class Trace(Model):
"""Model representing a Trace."""