From e41b4fd1b2143d1294379e933ed6710163cd81bc Mon Sep 17 00:00:00 2001 From: Frederic BIDON Date: Sun, 14 Jun 2026 14:22:08 +0200 Subject: [PATCH 1/2] fix(header): header extension should correctly marshal as JSON * fixes #277 Signed-off-by: Frederic BIDON --- header.go | 6 +++++- header_test.go | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/header.go b/header.go index 599ba2c..f656e07 100644 --- a/header.go +++ b/header.go @@ -150,7 +150,11 @@ func (h Header) MarshalJSON() ([]byte, error) { if err != nil { return nil, err } - return jsonutils.ConcatJSON(b1, b2, b3), nil + b4, err := json.Marshal(h.VendorExtensible) + if err != nil { + return nil, err + } + return jsonutils.ConcatJSON(b1, b2, b3, b4), nil } // UnmarshalJSON unmarshals this header from JSON. diff --git a/header_test.go b/header_test.go index ad34da3..e6e0b1a 100644 --- a/header_test.go +++ b/header_test.go @@ -75,6 +75,7 @@ const headerJSON = `{ func TestIntegrationHeader(t *testing.T) { assert.JSONUnmarshalAsT(t, header, headerJSON) + assert.JSONMarshalAsT(t, headerJSON, header) } func TestJSONLookupHeader(t *testing.T) { From 49846cbe73d1de80fdee6344b0d3e45e72ee31da Mon Sep 17 00:00:00 2001 From: Frederic BIDON Date: Sun, 14 Jun 2026 14:24:16 +0200 Subject: [PATCH 2/2] chore: relint Signed-off-by: Frederic BIDON --- .golangci.yml | 3 +++ debug_test.go | 2 +- schema_loader.go | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index dc7c960..9d27331 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -4,7 +4,10 @@ linters: disable: - depguard - funlen + - goconst - godox + - gomodguard + - gomodguard_v2 - exhaustruct - nlreturn - nonamedreturns diff --git a/debug_test.go b/debug_test.go index 6f6547b..af99d1e 100644 --- a/debug_test.go +++ b/debug_test.go @@ -38,7 +38,7 @@ func TestDebug(t *testing.T) { Debug = false _ = tmpFile.Close() - flushed, _ := os.Open(tmpName) //nolint:gosec // test file, path is from os.CreateTemp + flushed, _ := os.Open(tmpName) buf := make([]byte, 500) _, _ = flushed.Read(buf) specLogger.SetOutput(os.Stdout) diff --git a/schema_loader.go b/schema_loader.go index 0894c93..1e34606 100644 --- a/schema_loader.go +++ b/schema_loader.go @@ -117,7 +117,7 @@ func (r *schemaLoader) updateBasePath(transitive *schemaLoader, basePath string) func (r *schemaLoader) resolveRef(ref *Ref, target any, basePath string) error { tgt := reflect.ValueOf(target) - if tgt.Kind() != reflect.Ptr { + if tgt.Kind() != reflect.Pointer { return ErrResolveRefNeedsAPointer }