Skip to content

Commit

Permalink
wipwipwip
Browse files Browse the repository at this point in the history
Signed-off-by: Pierre Fenoll <pierrefenoll@gmail.com>
  • Loading branch information
fenollp committed Feb 14, 2023
1 parent c307ded commit 1014726
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions openapi3/issue341_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package openapi3

import (
"context"
"fmt"
"testing"

"github.com/stretchr/testify/require"
Expand All @@ -17,6 +18,9 @@ func TestIssue341(t *testing.T) {
require.NoError(t, err)

err = sl.ResolveRefsIn(doc, nil)
if false {
panic(fmt.Sprintf(">>> %+v", doc.Paths.Value("/testpath")))
}
require.NoError(t, err)

bs, err := doc.MarshalJSON()
Expand Down
8 changes: 7 additions & 1 deletion openapi3/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,10 @@ func (loader *Loader) resolveCallbackRef(doc *T, component *CallbackRef, documen
return nil
}

for _, pathItem := range value.Map() {
for k, pathItem := range value.Map() {
if true {
panic(fmt.Sprintf(">>> %q %+v", k, pathItem))
}
if err = loader.resolvePathItemRef(doc, pathItem, documentPath); err != nil {
return err
}
Expand Down Expand Up @@ -986,6 +989,9 @@ func (loader *Loader) resolvePathItemRef(doc *T, pathItem *PathItem, documentPat
if doc, documentPath, err = loader.resolveComponent(doc, ref, documentPath, &resolved); err != nil {
return
}
if true {
panic(fmt.Sprintf(">>> >>> %q => %+v", ref, resolved))
}
*pathItem = resolved
}
}
Expand Down
4 changes: 4 additions & 0 deletions openapi3/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,10 @@ func TestLoadYamlFileWithExternalPathRef(t *testing.T) {
doc, err := loader.LoadFromFile("testdata/pathref.openapi.yml")
require.NoError(t, err)

t.Logf(">>> %+v", doc.Paths)
t.Logf(">>> %+v", doc.Paths.Value("/test"))
t.Logf(">>> %+v", doc.Paths.Value("/test").Get)

require.NotNil(t, doc.Paths.Value("/test").Get.Responses.Value("200").Value.Content["application/json"].Schema.Value.Type)
require.Equal(t, "string", doc.Paths.Value("/test").Get.Responses.Value("200").Value.Content["application/json"].Schema.Value.Type)
}
Expand Down

0 comments on commit 1014726

Please sign in to comment.