jsschema
jsschema copied to clipboard
How do I resolve {"$ref": "./file#path"}
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
}