oas 18.4.1 → 18.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ ## <small>18.4.4 (2022-08-23)</small>
2
+
3
+ * fix: bug in `getHeaders` where it wouldn't return `Authorization` if security was oauth2 (#680) ([9b49bec](https://github.com/readmeio/oas/commit/9b49bec)), closes [#680](https://github.com/readmeio/oas/issues/680)
4
+
5
+
6
+
7
+ ## <small>18.4.3 (2022-08-22)</small>
8
+
9
+ * fix: how we're importing `oas-normalize` ([071e282](https://github.com/readmeio/oas/commit/071e282))
10
+
11
+
12
+
13
+ ## <small>18.4.2 (2022-08-19)</small>
14
+
15
+ * fix: error handling in rare oas reducer cases ([9f9a798](https://github.com/readmeio/oas/commit/9f9a798))
16
+
17
+
18
+
1
19
  ## <small>18.4.1 (2022-08-19)</small>
2
20
 
3
21
  * fix: typing issue in the reducer ([332da95](https://github.com/readmeio/oas/commit/332da95))
@@ -24,6 +24,12 @@ function getUsedRefs(schema) {
24
24
  */
25
25
  function accumulateUsedRefs(schema, $refs, $ref) {
26
26
  var $refSchema = jsonpointer_1["default"].get(schema, $ref.substring(1));
27
+ if ($refSchema === undefined) {
28
+ // If the schema we have wasn't fully dereferenced or bundled for whatever reason and this
29
+ // `$ref` that we have doens't exist here we shouldn't try to search for more `$ref` pointers
30
+ // in a schema that doesn't exist.
31
+ return;
32
+ }
27
33
  getUsedRefs($refSchema).forEach(function (currRef) {
28
34
  // If we've already processed this $ref don't send us into an infinite loop.
29
35
  if ($refs.has(currRef)) {
package/dist/operation.js CHANGED
@@ -244,7 +244,7 @@ var Operation = /** @class */ (function () {
244
244
  return h.name;
245
245
  });
246
246
  }
247
- if (security.Bearer || security.Basic) {
247
+ if (security.Bearer || security.Basic || security.OAuth2) {
248
248
  this.headers.request.push('Authorization');
249
249
  }
250
250
  if (security.Cookie) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oas",
3
- "version": "18.4.1",
3
+ "version": "18.4.4",
4
4
  "description": "Working with OpenAPI definitions is hard. This makes it easier.",
5
5
  "license": "MIT",
6
6
  "author": "ReadMe <support@readme.io> (https://readme.com)",
@@ -3,7 +3,7 @@ const fs = require('fs');
3
3
  const cardinal = require('cardinal');
4
4
  const chalk = require('chalk');
5
5
  const glob = require('glob');
6
- const OASNormalize = require('oas-normalize');
6
+ const OASNormalize = require('oas-normalize').default;
7
7
  const swaggerInline = require('swagger-inline');
8
8
 
9
9
  exports.findSwagger = async function (info, cb) {
@@ -30,6 +30,13 @@ function getUsedRefs(schema: any) {
30
30
  */
31
31
  function accumulateUsedRefs(schema: Record<string, unknown>, $refs: Set<string>, $ref: string): void {
32
32
  const $refSchema = jsonPointer.get(schema, $ref.substring(1));
33
+ if ($refSchema === undefined) {
34
+ // If the schema we have wasn't fully dereferenced or bundled for whatever reason and this
35
+ // `$ref` that we have doens't exist here we shouldn't try to search for more `$ref` pointers
36
+ // in a schema that doesn't exist.
37
+ return;
38
+ }
39
+
33
40
  getUsedRefs($refSchema).forEach(currRef => {
34
41
  // If we've already processed this $ref don't send us into an infinite loop.
35
42
  if ($refs.has(currRef)) {
package/src/operation.ts CHANGED
@@ -260,7 +260,7 @@ export default class Operation {
260
260
  });
261
261
  }
262
262
 
263
- if (security.Bearer || security.Basic) {
263
+ if (security.Bearer || security.Basic || security.OAuth2) {
264
264
  this.headers.request.push('Authorization');
265
265
  }
266
266