Skip to content

Commit 1b69857

Browse files
authored
Merge pull request #278 from fredbi/fix/277-header-ext
Fix/277 header ext
2 parents 536d375 + 49846cb commit 1b69857

5 files changed

Lines changed: 11 additions & 3 deletions

File tree

.golangci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ linters:
44
disable:
55
- depguard
66
- funlen
7+
- goconst
78
- godox
9+
- gomodguard
10+
- gomodguard_v2
811
- exhaustruct
912
- nlreturn
1013
- nonamedreturns

debug_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func TestDebug(t *testing.T) {
3838
Debug = false
3939
_ = tmpFile.Close()
4040

41-
flushed, _ := os.Open(tmpName) //nolint:gosec // test file, path is from os.CreateTemp
41+
flushed, _ := os.Open(tmpName)
4242
buf := make([]byte, 500)
4343
_, _ = flushed.Read(buf)
4444
specLogger.SetOutput(os.Stdout)

header.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,11 @@ func (h Header) MarshalJSON() ([]byte, error) {
150150
if err != nil {
151151
return nil, err
152152
}
153-
return jsonutils.ConcatJSON(b1, b2, b3), nil
153+
b4, err := json.Marshal(h.VendorExtensible)
154+
if err != nil {
155+
return nil, err
156+
}
157+
return jsonutils.ConcatJSON(b1, b2, b3, b4), nil
154158
}
155159

156160
// UnmarshalJSON unmarshals this header from JSON.

header_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ const headerJSON = `{
7575

7676
func TestIntegrationHeader(t *testing.T) {
7777
assert.JSONUnmarshalAsT(t, header, headerJSON)
78+
assert.JSONMarshalAsT(t, headerJSON, header)
7879
}
7980

8081
func TestJSONLookupHeader(t *testing.T) {

schema_loader.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func (r *schemaLoader) updateBasePath(transitive *schemaLoader, basePath string)
117117

118118
func (r *schemaLoader) resolveRef(ref *Ref, target any, basePath string) error {
119119
tgt := reflect.ValueOf(target)
120-
if tgt.Kind() != reflect.Ptr {
120+
if tgt.Kind() != reflect.Pointer {
121121
return ErrResolveRefNeedsAPointer
122122
}
123123

0 commit comments

Comments
 (0)