-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Got '&errors.errorString{s:"child url is nil"}' when expanding spec. #14
Comments
Below is my test code. package main
import (
"testing"
"github.com/go-openapi/loads"
"github.com/stretchr/testify/assert"
)
func TestSpec(t *testing.T) {
swagger, err := loads.Spec("/tmp/swagger/api_v2.0.json")
assert.Nil(t, err)
swaggerExpanded, err := swagger.Expanded()
assert.Nil(t, err)
} Got. Error: Expected nil, but got: &errors.errorString{s:"child url is nil"} |
Hi, I submitted two pull request to fix this problem.
spec.ExpandOptions was added to provide configurations for expanding, currently there is only one option to use. type ExpandOptions struct {
RelativeBase string
} RelativeBase is the base location to use when resolving relative references. If this value is not given, the working directory ( Example: package main
import (
"testing"
"github.com/go-openapi/loads"
"github.com/stretchr/testify/assert"
)
func TestSpec(t *testing.T) {
swagger, err := loads.Spec("/tmp/swagger/api_v2.0.json")
assert.Nil(t, err)
swaggerExpanded, err := swagger.Expanded(&spec.ExpandOptions{
RelativeBase: "/tmp/swagger",
})
assert.Nil(t, err)
} |
pengsrc
changed the title
Got '&errors.errorString{s:"child url is nil"}' when expand spec.
Got '&errors.errorString{s:"child url is nil"}' when expanding spec.
Nov 3, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's my swagger json files.
I have also tried '"$ref": "http://127.0.0.1:9292/action.json#/TestAction0"', but same error.
The text was updated successfully, but these errors were encountered: