From 88790752c4f56faff5e38266b1c5878f8b45f938 Mon Sep 17 00:00:00 2001 From: Arvid Fahlstrom Myrman <885076+arvidfm@users.noreply.github.com> Date: Tue, 30 Jan 2024 12:07:04 +0000 Subject: [PATCH] add doc comment --- reflect.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/reflect.go b/reflect.go index b47c81a..c2bd67e 100644 --- a/reflect.go +++ b/reflect.go @@ -628,7 +628,11 @@ func (t *Schema) structKeywordsFromTags(f reflect.StructField, parent *Schema, p t.extraKeywords(extras) } -func (t *Schema) parseValue(val string) (parsed interface{}, ok bool) { +// parseValue parses a string into a value matching the type of this schema. +// It is used to parse default and example values from a struct tag. +// If the string could be successfully parsed into the target type, +// the second return value will be set to true. +func (t *Schema) parseValue(val string) (any, bool) { switch t.Type { case "number": return toJSONNumber(val)