From 8cd26318e8b901acb17e11a33f13c116e3dd66e6 Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Fri, 6 Sep 2024 15:30:32 +0200 Subject: [PATCH] fix test --- libs/jsonschema/from_type.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libs/jsonschema/from_type.go b/libs/jsonschema/from_type.go index 07c8716d..0528a925 100644 --- a/libs/jsonschema/from_type.go +++ b/libs/jsonschema/from_type.go @@ -81,7 +81,7 @@ func (c *constructor) Definitions() map[string]any { return res } -// FromType converts a reflect.Type to a jsonschema.Schema. Nodes in the final JSON +// FromType converts a [reflect.Type] to a [Schema]. Nodes in the final JSON // schema are guaranteed to be one level deep, which is done using defining $defs // for every Go type and referring them using $ref in the corresponding node in // the JSON schema. @@ -253,11 +253,16 @@ func (c *constructor) fromTypeStruct(typ reflect.Type) (Schema, error) { bundleTags := strings.Split(structField.Tag.Get("bundle"), ",") // Fields marked as "readonly", "internal" or "deprecated" are skipped // while generating the schema + skip := false for _, tag := range skipTags { if slices.Contains(bundleTags, tag) { - continue + skip = true + break } } + if skip { + continue + } jsonTags := strings.Split(structField.Tag.Get("json"), ",") fieldName := jsonTags[0]