Skip to content

Commit

Permalink
Fix error in discovery reader. (#202)
Browse files Browse the repository at this point in the history
* Fix error in discovery reader.

* test command-line discovery format reader.
  • Loading branch information
timburks authored Jul 20, 2020
1 parent 3e1e1bd commit 0b9e7d4
Show file tree
Hide file tree
Showing 3 changed files with 1,059 additions and 1 deletion.
6 changes: 6 additions & 0 deletions gnostic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,3 +288,9 @@ func TestEmptyRequiredFields_v3(t *testing.T) {
"examples/v3.0/yaml/empty-v3.yaml",
"testdata/v3.0/json/empty-v3.json")
}

func TestDiscoveryJSON(t *testing.T) {
testNormal(t,
"examples/discovery/discovery-v1.json",
"testdata/discovery/discovery-v1.text")
}
2 changes: 1 addition & 1 deletion lib/gnostic.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ func (g *Gnostic) readOpenAPIText(bytes []byte) (message proto.Message, err erro
}
message = document
} else {
document, err := discovery_v1.NewDocument(info, compiler.NewContextWithExtensions("$root", nil, &g.extensionHandlers))
document, err := discovery_v1.NewDocument(info.Content[0], compiler.NewContextWithExtensions("$root", nil, &g.extensionHandlers))
if err != nil {
return nil, err
}
Expand Down
Loading

0 comments on commit 0b9e7d4

Please sign in to comment.