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

@@ -4,12 +4,13 @@
package index
import (
"golang.org/x/sync/syncmap"
"gopkg.in/yaml.v3"
"net/http"
"net/url"
"os"
"sync"
"golang.org/x/sync/syncmap"
"gopkg.in/yaml.v3"
)
// Constants used to determine if resolving is local, file based or remote file based.
@@ -60,6 +61,10 @@ type SpecIndexConfig struct {
// More details on relative references can be found in issue #73: https://github.com/pb33f/libopenapi/issues/73
BaseURL *url.URL // set the Base URL for resolving relative references if the spec is exploded.
// If resolving remotely, the RemoteDocumentGetter will be used to fetch the remote document.
// If not set, the default http client 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
BasePath string // set the Base Path for resolving relative references if the spec is exploded.