Last active
April 20, 2021 18:35
-
-
Save roee88/626d93f9e73776c7f1ec3aa59d7db988 to your computer and use it in GitHub Desktop.
kin-openapi external references bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "http://json-schema.org/draft-04/schema#", | |
"definitions": { | |
"a": { | |
"type": "string" | |
}, | |
"b": { | |
"type": "object", | |
"description": "I use a local reference.", | |
"properties": { | |
"name": { | |
"$ref": "#/definitions/a" | |
} | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package test | |
import ( | |
"testing" | |
"github.com/getkin/kin-openapi/openapi3" | |
) | |
func TestExternalRef(t *testing.T) { | |
loader := &openapi3.SwaggerLoader{ | |
IsExternalRefsAllowed: true, | |
} | |
_, err := loader.LoadSwaggerFromFile("spec.yaml") | |
if err != nil { | |
t.Error(err) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openapi: 3.0.1 | |
components: | |
schemas: | |
Test: | |
type: object | |
properties: | |
test: | |
$ref: 'ext.json#/definitions/b' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment