expose optional function to resolve remote files

This commit is contained in:
Federico Bevione
2023-06-21 19:06:55 +02:00
committed by quobix
parent 9e487a8c49
commit 0c0399abbe
5 changed files with 38 additions and 17 deletions

View File

@@ -3,7 +3,10 @@
package datamodel
import "net/url"
import (
"net/http"
"net/url"
)
// DocumentConfiguration is used to configure the document creation process. It was added in v0.6.0 to allow
// for more fine-grained control over controls and new features.
@@ -15,6 +18,10 @@ type DocumentConfiguration struct {
// Schema must be set to "http/https".
BaseURL *url.URL
// RemoteDocumentGetter is a function that will be used to retrieve remote documents. If not set, the default
// remote document getter will be used.
RemoteDocumentGetter func(url string) (*http.Response, error)
// If resolving locally, the BasePath will be the root from which relative references will be resolved from.
// It's usually the location of the root specification.
BasePath string // set the Base Path for resolving relative references if the spec is exploded.