From 9b0994cd83a5b341286167c056bd7546e32c1116 Mon Sep 17 00:00:00 2001 From: Pierre Fenoll Date: Sat, 2 Oct 2021 17:24:20 +0200 Subject: [PATCH] reproduce issue #423 Signed-off-by: Pierre Fenoll --- openapi3/loader_outside_refs_test.go | 31 ++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/openapi3/loader_outside_refs_test.go b/openapi3/loader_outside_refs_test.go index 5cec93452..fc6a2a135 100644 --- a/openapi3/loader_outside_refs_test.go +++ b/openapi3/loader_outside_refs_test.go @@ -18,3 +18,34 @@ func TestLoadOutsideRefs(t *testing.T) { require.Equal(t, "string", doc.Paths["/service"].Get.Responses["200"].Value.Content["application/json"].Schema.Value.Items.Value.AllOf[0].Value.Properties["created_at"].Value.Type) } + +func TestIssue423(t *testing.T) { + spec := ` +info: + description: test + title: test + version: 0.0.0 +openapi: 3.0.1 +paths: + /api/bundles: + get: + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Data' +components: + schemas: + Data: + description: rbac Data + properties: + roles: + $ref: https://raw.githubusercontent.com/kubernetes/kubernetes/132f29769dfecfc808adc58f756be43171054094/api/openapi-spec/swagger.json#/definitions/io.k8s.api.rbac.v1.RoleList +` + + loader := NewLoader() + loader.IsExternalRefsAllowed = true + loader.LoadFromData([]byte(spec)) +}