From 4a61a4bfee6b33daf7084f27e0eb14c27c926792 Mon Sep 17 00:00:00 2001 From: Jon Ursenbach Date: Wed, 26 Feb 2025 15:35:44 -0800 Subject: [PATCH 1/2] fix: `http.timeout` default does not match the documentation --- lib/resolvers/http.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/resolvers/http.ts b/lib/resolvers/http.ts index 9d1a4621..36c9880d 100644 --- a/lib/resolvers/http.ts +++ b/lib/resolvers/http.ts @@ -23,7 +23,7 @@ export default { /** * HTTP request timeout (in milliseconds). */ - timeout: 60_000, // 60 seconds + timeout: 5000, // 5 seconds /** * The maximum number of HTTP redirects to follow. From db338ecf9466c4dbdb0c4db63decbb7dcb0961d5 Mon Sep 17 00:00:00 2001 From: Jon Ursenbach Date: Wed, 26 Feb 2025 15:44:06 -0800 Subject: [PATCH 2/2] fix: changing the default in the docs to match what the default is --- docs/options.md | 2 +- lib/resolvers/http.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/options.md b/docs/options.md index 5d78e6dd..6154717e 100644 --- a/docs/options.md +++ b/docs/options.md @@ -69,7 +69,7 @@ JSON Schema $Ref Parser comes with built-in support for HTTP and HTTPS, as well | `file.order` `http.order` | `number` | Resolvers run in a specific order, relative to other resolvers. For example, a resolver with `order: 5` will run _before_ a resolver with `order: 10`. If a resolver is unable to successfully resolve a path, then the next resolver is tried, until one succeeds or they all fail.

You can change the order in which resolvers run, which is useful if you know that most of your file references will be a certain type, or if you add [your own custom resolver](plugins/resolvers.md) that you want to run _first_. | | `file.canRead` `http.canRead` | `boolean`, `RegExp`, `string`, `array`, `function` | Determines which resolvers will be used for which files.

A regular expression can be used to match files by their full path. A string (or array of strings) can be used to match files by their file extension. Or a function can be used to perform more complex matching logic. See the [custom resolver](plugins/resolvers.md) docs for details. | | `http.headers` | `object` | You can specify any HTTP headers that should be sent when downloading files. For example, some servers may require you to set the `Accept` or `Referrer` header. | -| `http.timeout` | `number` | The amount of time (in milliseconds) to wait for a response from the server when downloading files. The default is 5 seconds. | +| `http.timeout` | `number` | The amount of time (in milliseconds) to wait for a response from the server when downloading files. The default is 60 seconds. | | `http.redirects` | `number` | The maximum number of HTTP redirects to follow per file. The default is 5. To disable automatic following of redirects, set this to zero. | | `http.withCredentials` | `boolean` | Set this to `true` if you're downloading files from a CORS-enabled server that requires authentication | diff --git a/lib/resolvers/http.ts b/lib/resolvers/http.ts index 36c9880d..9d1a4621 100644 --- a/lib/resolvers/http.ts +++ b/lib/resolvers/http.ts @@ -23,7 +23,7 @@ export default { /** * HTTP request timeout (in milliseconds). */ - timeout: 5000, // 5 seconds + timeout: 60_000, // 60 seconds /** * The maximum number of HTTP redirects to follow.