From 41c044bb256b54652f7fae51fde7c45cb6c4ccb9 Mon Sep 17 00:00:00 2001 From: Darren Shepherd Date: Mon, 26 Mar 2018 17:59:44 -0700 Subject: [PATCH] Make ints not nullable by default --- types/reflection.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/reflection.go b/types/reflection.go index ef3f123e..1935ab7a 100644 --- a/types/reflection.go +++ b/types/reflection.go @@ -270,6 +270,11 @@ func (s *Schemas) readFields(schema *Schema, t reflect.Type) error { } else if fieldType.Kind() == reflect.Bool { schemaField.Nullable = false schemaField.Default = false + } else if fieldType.Kind() == reflect.Int || + fieldType.Kind() == reflect.Int32 || + fieldType.Kind() == reflect.Int64 { + schemaField.Nullable = false + schemaField.Default = 0 } if err := applyTag(&field, &schemaField); err != nil {