Skip to content
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

How do I resolve {"$ref": "./file#path"} #19

Open
syavorsky opened this issue Sep 24, 2019 · 0 comments
Open

How do I resolve {"$ref": "./file#path"} #19

syavorsky opened this issue Sep 24, 2019 · 0 comments

Comments

@syavorsky
Copy link

Thanks for the awesome package. Could you explain following part please

this package does not really care about loading external schemas from various locations (it's just easier to just gather all the schemas in your local system). It is possible to do this via go-jsref if you really want to do it.

I am trying to figure out how {"$ref": "./local-file.json#/definitions/Something"} is being resolved. These lines make me believe I could just have a provider loaded with external files, but I don't see how custom provider can be passed

func (s *Schema) initialize() {
	resolver := jsref.New()

	mp := provider.NewMap()
	mp.Set(SchemaURL, &_schema)
	mp.Set(HyperSchemaURL, &_hyperSchema)
	resolver.AddProvider(mp)

	s.resolvedSchemas = make(map[string]interface{})
	s.resolver = resolver
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant