You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adding a loader can result in i/o such as network to fetch the referenced schemas. Because of this they should be cancelable via a context.
I suggest that the URLLoader take a ctx. As a result a Compiler.Compile() call should take a context as well.
This would be a breaking change and could wait until a v7 release and/or the existing release could be updated with Context aware methods.
A proposal support in v6:
func (Compiler) CompileContext(ctx context.Context, locstring) (*Schema, error)
// MustCompile omitted as it seems less useful with a contextfunc (Compiler) RegisterLoaderContext(loaderURLLoaderContext)
typeURLLoaderContextinterface {
// This could also still just be Load(). there shouldn't be a use case to support both Load and LoadContext. LoadContext(ctx context.Context, url [string](https://pkg.go.dev/builtin#string)) ([any](https://pkg.go.dev/builtin#any), [error](https://pkg.go.dev/builtin#error))
}
```Internally the `defaultLoader` would always use the context version. `RegisterLoader()` would just then wrap a URLoader with one that adds a default context.Background() by default
The text was updated successfully, but these errors were encountered:
Adding a loader can result in i/o such as network to fetch the referenced schemas. Because of this they should be cancelable via a context.
I suggest that the
URLLoader
take actx
. As a result aCompiler.Compile()
call should take a context as well.This would be a breaking change and could wait until a v7 release and/or the existing release could be updated with Context aware methods.
A proposal support in v6:
The text was updated successfully, but these errors were encountered: