1
0
mirror of https://github.com/rancher/norman.git synced 2025-09-01 07:08:59 +00:00

Add InputFormatter that runs before the builder/validation

This commit is contained in:
Darren Shepherd
2018-07-13 12:56:01 -07:00
parent 16ed673d50
commit f33accee7c
3 changed files with 9 additions and 0 deletions

View File

@@ -27,6 +27,12 @@ func ParseAndValidateBody(apiContext *types.APIContext, create bool) (map[string
if !create {
op = builder.Update
}
if apiContext.Schema.InputFormatter != nil {
err = apiContext.Schema.InputFormatter(apiContext, apiContext.Schema, data, create)
if err != nil {
return nil, err
}
}
data, err = b.Construct(apiContext.Schema, data, op)
if err != nil {
return nil, err