Skip to content

Commit

Permalink
Improve error message for ChartRequestSchema param show_individual_tr…
Browse files Browse the repository at this point in the history
…aces_for.
  • Loading branch information
Flix6x committed Feb 26, 2021
1 parent 99beca7 commit 204bf90
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions flexmeasures/ui/views/charts.py
@@ -1,7 +1,7 @@
from flask_security import roles_accepted
from flask_json import as_json
from bokeh.embed import json_item
from marshmallow import Schema, fields
from marshmallow import Schema, fields, validate
from webargs.flaskparser import use_args

from flexmeasures.api.v2_0 import flexmeasures_api as flexmeasures_api_v2_0
Expand Down Expand Up @@ -43,7 +43,7 @@ class ChartRequestSchema(Schema):
resolution = DurationField(required=True)
show_consumption_as_positive = fields.Bool(missing=True)
show_individual_traces_for = fields.Str(
missing="none", validate=lambda x: x in ("none", "schedules", "power")
missing="none", validate=validate.OneOf(["none", "schedules", "power"])
)
forecast_horizon = DurationField(missing="PT6H")

Expand Down

1 comment on commit 204bf90

@nhoening
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat, I was just looking at that, thinking that should be done better !!

Please sign in to comment.