Skip to content

Commit

Permalink
cleanup a bit
Browse files Browse the repository at this point in the history
Signed-off-by: Pierre Fenoll <pierrefenoll@gmail.com>
  • Loading branch information
fenollp committed Jun 18, 2023
1 parent 62b76dd commit 191b429
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 18 deletions.
3 changes: 0 additions & 3 deletions openapi3/callback.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ var _ jsonpointer.JSONPointable = (*Callback)(nil)
// JSONLookup implements https://github.com/go-openapi/jsonpointer#JSONPointable
func (callback *Callback) JSONLookup(token string) (interface{}, error) {
pathItem, ok := callback.Get(token)
if true {
panic(fmt.Sprintf(">>> token=%q pathItem=%v callback=%#v", token, pathItem, callback))
}
if !ok {
return nil, fmt.Errorf("invalid token reference: %q", token)
}
Expand Down
4 changes: 0 additions & 4 deletions openapi3/issue341_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package openapi3

import (
"context"
"fmt"
"testing"

"github.com/stretchr/testify/require"
Expand All @@ -18,9 +17,6 @@ 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
4 changes: 0 additions & 4 deletions openapi3/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -447,10 +447,6 @@ 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
6 changes: 0 additions & 6 deletions openapi3/operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,16 +170,10 @@ func (operation *Operation) AddResponse(status int, response *Response) {
if 0 < status && status < 1000 {
code = strconv.FormatInt(int64(status), 10)
}
// if operation == nil {
// panic(">>>")
// }
if operation.Responses == nil {
operation.Responses = &Responses{}
}
operation.Responses.Set(code, &ResponseRef{Value: response})
if operation.Responses.Len() == 0 {
panic(fmt.Sprintf(">>> operation.Responses = %#v \n", operation.Responses))
}
}

// Validate returns an error if Operation does not comply with the OpenAPI spec.
Expand Down
1 change: 0 additions & 1 deletion openapi3/paths.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ func (paths *Paths) UnmarshalJSON(data []byte) (err error) {
// JSONLookup implements https://github.com/go-openapi/jsonpointer#JSONPointable
func (paths *Paths) JSONLookup(token string) (interface{}, error) {
pathItem, ok := paths.Get(token)
fmt.Printf(">>> token=%q ref=%v paths=%#v", token, pathItem, paths)
if !ok {
return nil, fmt.Errorf("invalid token reference: %q", token)
}
Expand Down

0 comments on commit 191b429

Please sign in to comment.