File tree Expand file tree Collapse file tree 3 files changed +72
-0
lines changed Expand file tree Collapse file tree 3 files changed +72
-0
lines changed Original file line number Diff line number Diff line change 1+ package openapi3
2+
3+ import (
4+ "path/filepath"
5+ "testing"
6+
7+ "github.com/stretchr/testify/require"
8+ )
9+
10+ func TestIssue220 (t * testing.T ) {
11+ specPath := filepath .FromSlash ("testdata/my-openapi.json" )
12+
13+ loader := NewSwaggerLoader ()
14+ loader .IsExternalRefsAllowed = true
15+ doc , err := loader .LoadSwaggerFromFile (specPath )
16+ require .NoError (t , err )
17+
18+ err = doc .Validate (loader .Context )
19+ require .NoError (t , err )
20+ }
Original file line number Diff line number Diff line change 1+ {
2+ "openapi" : " 3.0.2" ,
3+ "info" : {
4+ "title" : " My API" ,
5+ "version" : " 0.1.0"
6+ },
7+ "paths" : {
8+ "/foo" : {
9+ "get" : {
10+ "responses" : {
11+ "200" : {
12+ "$ref" : " my-other-openapi.json#/components/responses/DefaultResponse"
13+ }
14+ }
15+ }
16+ }
17+ }
18+ }
Original file line number Diff line number Diff line change 1+ {
2+ "openapi" : " 3.0.2" ,
3+ "info" : {
4+ "title" : " My other API" ,
5+ "version" : " 0.1.0"
6+ },
7+ "components" : {
8+ "schemas" : {
9+ "DefaultObject" : {
10+ "type" : " object" ,
11+ "properties" : {
12+ "foo" : {
13+ "type" : " string"
14+ },
15+ "bar" : {
16+ "type" : " string"
17+ }
18+ }
19+ }
20+ },
21+ "responses" : {
22+ "DefaultResponse" : {
23+ "description" : " " ,
24+ "content" : {
25+ "application/json" : {
26+ "schema" : {
27+ "$ref" : " #/components/schemas/DefaultObject"
28+ }
29+ }
30+ }
31+ }
32+ }
33+ }
34+ }
You can’t perform that action at this time.
0 commit comments