From f6d1b8c132b1ba26fe4054238278b1c0c016248f Mon Sep 17 00:00:00 2001 From: Pierre Fenoll Date: Tue, 28 Nov 2023 11:51:16 +0100 Subject: [PATCH] fix after #870: make sure Bis does not surface up (#878) --- openapi2/marsh.go | 4 ++-- openapi3/marsh.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/openapi2/marsh.go b/openapi2/marsh.go index 6a9df466c..b15f3b82c 100644 --- a/openapi2/marsh.go +++ b/openapi2/marsh.go @@ -9,9 +9,9 @@ import ( ) func unmarshalError(jsonUnmarshalErr error) error { - if before, after, found := strings.Cut(jsonUnmarshalErr.Error(), "Bis."); found && before != "" && after != "" { + if before, after, found := strings.Cut(jsonUnmarshalErr.Error(), "Bis"); found && before != "" && after != "" { before = strings.ReplaceAll(before, " Go struct ", " ") - return fmt.Errorf("%s.%s", before, after) + return fmt.Errorf("%s%s", before, strings.ReplaceAll(after, "Bis", "")) } return jsonUnmarshalErr } diff --git a/openapi3/marsh.go b/openapi3/marsh.go index 5ef69ae8b..18036ae78 100644 --- a/openapi3/marsh.go +++ b/openapi3/marsh.go @@ -9,9 +9,9 @@ import ( ) func unmarshalError(jsonUnmarshalErr error) error { - if before, after, found := strings.Cut(jsonUnmarshalErr.Error(), "Bis."); found && before != "" && after != "" { + if before, after, found := strings.Cut(jsonUnmarshalErr.Error(), "Bis"); found && before != "" && after != "" { before = strings.ReplaceAll(before, " Go struct ", " ") - return fmt.Errorf("%s.%s", before, after) + return fmt.Errorf("%s%s", before, strings.ReplaceAll(after, "Bis", "")) } return jsonUnmarshalErr }