Skip to content

Commit f822f53

Browse files
committed
Improve comment and make validator-usage more understandable;
1 parent 4d1e5d9 commit f822f53

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

api/broker/binding_request_parser/parser.go

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,16 @@ func (brp *bindRequestParser) Parse(details domain.BindDetails) (models.AppScali
5353
scalingPolicyRaw = details.RawParameters
5454
}
5555

56-
var err error
57-
58-
// This just gets used for legacy-reasons. The actually parsing happens in the step
59-
// afterwards. But it still does not validate against the schema, which is done here.
60-
_, err = brp.getPolicyFromJsonRawMessage(scalingPolicyRaw)
56+
// 🏚️ This parser currently uses a module that originally was written to do the validation
57+
// against a json-schema. This validation however needs to be performed in the future within
58+
// this parser, because we want to support several parsers where each one may work with a
59+
// different json-schema.
60+
scalingPolicy, err := brp.getPolicyFromJsonRawMessage(scalingPolicyRaw)
6161
if err != nil {
6262
err := fmt.Errorf("validation-error against the json-schema:\n\t%w", err)
6363
return models.AppScalingConfig{}, err
6464
}
6565

66-
scalingPolicy, err := models.ScalingPolicyFromRawJSON(scalingPolicyRaw)
67-
if err != nil {
68-
err := fmt.Errorf("could not parse scaling policy from request:\n\t%w", err)
69-
return models.AppScalingConfig{}, err
70-
}
71-
7266
// 🏚️ Subsequently we assume that this credential-type-configuration is part of the
7367
// scaling-policy and check it accordingly. However this is legacy and not in line with the
7468
// current terminology of “PolicyDefinition”, “ScalingPolicy”, “BindingConfig” and

0 commit comments

Comments
 (0)