From 21b8caf025f0dcf2a361ec47204d0bd4c500f874 Mon Sep 17 00:00:00 2001 From: Jared O'Connell Date: Thu, 14 Nov 2024 13:53:04 -0500 Subject: [PATCH] Fix comments --- schema/enum_string_test.go | 2 +- schema/string.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/schema/enum_string_test.go b/schema/enum_string_test.go index c52f540..896879c 100644 --- a/schema/enum_string_test.go +++ b/schema/enum_string_test.go @@ -82,7 +82,7 @@ func TestStringEnumSerialization(t *testing.T) { func TestStringEnumTypedSerialization(t *testing.T) { // In this test a typed enum is being inputted into Serialize, but - // it is not using a typed + // it is not using a typed enum schema. type Size string s := schema.NewStringEnumSchema(map[string]*schema.DisplayValue{ "small": {NameValue: schema.PointerTo("Small")}, diff --git a/schema/string.go b/schema/string.go index e5dd404..337141b 100644 --- a/schema/string.go +++ b/schema/string.go @@ -17,6 +17,9 @@ type String interface { } // NewStringSchema creates a new string schema. +// If the corresponding Golang type is not a string, but a type +// defined from a string (example `type NameOfType string`), use +// `NewTypedStringEnumSchema` instead. func NewStringSchema(minLen *int64, maxLen *int64, pattern *regexp.Regexp) *StringSchema { return &StringSchema{ MinValue: minLen,