From 9324ec8b0987d7702f5b7b9c0cb633c57261d00c Mon Sep 17 00:00:00 2001 From: Darren Shepherd Date: Fri, 13 Jul 2018 13:05:08 -0700 Subject: [PATCH] Add Optional to access mapper --- types/mapper/access.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/types/mapper/access.go b/types/mapper/access.go index 2ecbd55b..e1140048 100644 --- a/types/mapper/access.go +++ b/types/mapper/access.go @@ -7,7 +7,8 @@ import ( ) type Access struct { - Fields map[string]string + Fields map[string]string + Optional bool } func (e Access) FromInternal(data map[string]interface{}) { @@ -20,6 +21,9 @@ func (e Access) ToInternal(data map[string]interface{}) error { func (e Access) ModifySchema(schema *types.Schema, schemas *types.Schemas) error { for name, access := range e.Fields { if err := ValidateField(name, schema); err != nil { + if e.Optional { + continue + } return err }