oas 17.4.0 → 17.4.1
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/@types/utils.d.ts +2 -0
- package/CHANGELOG.md +18 -0
- package/dist/index.js +2 -3
- package/dist/operation.js +9 -0
- package/dist/utils.js +3 -0
- package/package.json +5 -5
- package/src/index.ts +1 -2
- package/src/operation.ts +11 -0
- package/src/utils.ts +4 -0
package/@types/utils.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import findSchemaDefinition from './lib/find-schema-definition';
|
|
2
2
|
import getSchema from './lib/get-schema';
|
|
3
|
+
declare const supportedMethods: Set<string>;
|
|
3
4
|
declare const _default: {
|
|
4
5
|
findSchemaDefinition: typeof findSchemaDefinition;
|
|
5
6
|
getSchema: typeof getSchema;
|
|
@@ -16,3 +17,4 @@ declare const _default: {
|
|
|
16
17
|
};
|
|
17
18
|
};
|
|
18
19
|
export default _default;
|
|
20
|
+
export { supportedMethods };
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
## <small>17.4.1 (2022-01-03)</small>
|
|
2
|
+
|
|
3
|
+
* chore(deps-dev): bump @commitlint/cli from 15.0.0 to 16.0.1 (#569) ([ca515a9](https://github.com/readmeio/oas/commit/ca515a9)), closes [#569](https://github.com/readmeio/oas/issues/569)
|
|
4
|
+
* chore(deps-dev): bump @commitlint/config-conventional (#567) ([c4c6cc0](https://github.com/readmeio/oas/commit/c4c6cc0)), closes [#567](https://github.com/readmeio/oas/issues/567)
|
|
5
|
+
* chore(deps-dev): bump @types/jest from 27.0.3 to 27.4.0 (#574) ([eb21296](https://github.com/readmeio/oas/commit/eb21296)), closes [#574](https://github.com/readmeio/oas/issues/574)
|
|
6
|
+
* chore(deps-dev): bump eslint from 8.3.0 to 8.6.0 (#570) ([0dd19b1](https://github.com/readmeio/oas/commit/0dd19b1)), closes [#570](https://github.com/readmeio/oas/issues/570)
|
|
7
|
+
* chore(deps-dev): bump eslint-plugin-jsdoc from 37.1.0 to 37.5.0 (#571) ([b21ebfe](https://github.com/readmeio/oas/commit/b21ebfe)), closes [#571](https://github.com/readmeio/oas/issues/571)
|
|
8
|
+
* chore(deps-dev): bump jest from 27.4.3 to 27.4.5 (#573) ([4266065](https://github.com/readmeio/oas/commit/4266065)), closes [#573](https://github.com/readmeio/oas/issues/573)
|
|
9
|
+
* chore(deps-dev): bump prettier from 2.5.0 to 2.5.1 (#568) ([b4548c0](https://github.com/readmeio/oas/commit/b4548c0)), closes [#568](https://github.com/readmeio/oas/issues/568)
|
|
10
|
+
* chore(deps-dev): bump ts-jest from 27.0.7 to 27.1.2 (#566) ([16edcb0](https://github.com/readmeio/oas/commit/16edcb0)), closes [#566](https://github.com/readmeio/oas/issues/566)
|
|
11
|
+
* chore(deps-dev): bump typescript from 4.5.2 to 4.5.4 (#565) ([7bafc0d](https://github.com/readmeio/oas/commit/7bafc0d)), closes [#565](https://github.com/readmeio/oas/issues/565)
|
|
12
|
+
* chore(deps): bump actions/setup-node from 2.5.0 to 2.5.1 (#564) ([125afbe](https://github.com/readmeio/oas/commit/125afbe)), closes [#564](https://github.com/readmeio/oas/issues/564)
|
|
13
|
+
* chore(deps): bump openapi-types from 9.3.1 to 10.0.0 (#572) ([43e681b](https://github.com/readmeio/oas/commit/43e681b)), closes [#572](https://github.com/readmeio/oas/issues/572)
|
|
14
|
+
* chore(deps): upgrading oas-normalize ([851cf95](https://github.com/readmeio/oas/commit/851cf95))
|
|
15
|
+
* fix: improved support for common params (#563) ([ae3cb83](https://github.com/readmeio/oas/commit/ae3cb83)), closes [#563](https://github.com/readmeio/oas/issues/563)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
1
19
|
## 17.4.0 (2021-12-17)
|
|
2
20
|
|
|
3
21
|
* feat: adding accessors for operation summary and description (#562) ([1dd6a9f](https://github.com/readmeio/oas/commit/1dd6a9f)), closes [#562](https://github.com/readmeio/oas/issues/562)
|
package/dist/index.js
CHANGED
|
@@ -78,7 +78,7 @@ var operation_1 = __importStar(require("./operation"));
|
|
|
78
78
|
exports.Operation = operation_1["default"];
|
|
79
79
|
exports.Callback = operation_1.Callback;
|
|
80
80
|
exports.Webhook = operation_1.Webhook;
|
|
81
|
-
var utils_1 =
|
|
81
|
+
var utils_1 = __importStar(require("./utils"));
|
|
82
82
|
exports.utils = utils_1["default"];
|
|
83
83
|
/**
|
|
84
84
|
* @param url URL to ensure that it has an HTTP protocol.
|
|
@@ -611,12 +611,11 @@ var Oas = /** @class */ (function () {
|
|
|
611
611
|
// the paths object that isn't a known HTTP method.
|
|
612
612
|
// https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#fixed-fields-7
|
|
613
613
|
// https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#fixed-fields-7
|
|
614
|
-
var supportedMethods = new Set(['get', 'put', 'post', 'delete', 'options', 'head', 'patch', 'trace']);
|
|
615
614
|
var paths = {};
|
|
616
615
|
Object.keys(this.api.paths ? this.api.paths : []).forEach(function (path) {
|
|
617
616
|
paths[path] = {};
|
|
618
617
|
Object.keys(_this.api.paths[path]).forEach(function (method) {
|
|
619
|
-
if (!supportedMethods.has(method))
|
|
618
|
+
if (!utils_1.supportedMethods.has(method))
|
|
620
619
|
return;
|
|
621
620
|
paths[path][method] = _this.operation(path, method);
|
|
622
621
|
});
|
package/dist/operation.js
CHANGED
|
@@ -46,6 +46,7 @@ var get_requestbody_examples_1 = __importDefault(require("./operation/get-reques
|
|
|
46
46
|
var get_callback_examples_1 = __importDefault(require("./operation/get-callback-examples"));
|
|
47
47
|
var get_response_examples_1 = __importDefault(require("./operation/get-response-examples"));
|
|
48
48
|
var matches_mimetype_1 = __importDefault(require("./lib/matches-mimetype"));
|
|
49
|
+
var utils_1 = require("./utils");
|
|
49
50
|
var Operation = /** @class */ (function () {
|
|
50
51
|
function Operation(api, path, method, operation) {
|
|
51
52
|
this.schema = operation;
|
|
@@ -59,10 +60,16 @@ var Operation = /** @class */ (function () {
|
|
|
59
60
|
}
|
|
60
61
|
Operation.prototype.getSummary = function () {
|
|
61
62
|
var _a;
|
|
63
|
+
if (this.api.paths[this.path].summary) {
|
|
64
|
+
return this.api.paths[this.path].summary;
|
|
65
|
+
}
|
|
62
66
|
return ((_a = this.schema) === null || _a === void 0 ? void 0 : _a.summary) ? this.schema.summary.trim() : undefined;
|
|
63
67
|
};
|
|
64
68
|
Operation.prototype.getDescription = function () {
|
|
65
69
|
var _a;
|
|
70
|
+
if (this.api.paths[this.path].description) {
|
|
71
|
+
return this.api.paths[this.path].description;
|
|
72
|
+
}
|
|
66
73
|
return ((_a = this.schema) === null || _a === void 0 ? void 0 : _a.description) ? this.schema.description.trim() : undefined;
|
|
67
74
|
};
|
|
68
75
|
Operation.prototype.getContentType = function () {
|
|
@@ -461,6 +468,8 @@ var Operation = /** @class */ (function () {
|
|
|
461
468
|
var exp = cb[expression];
|
|
462
469
|
if (!RMOAS.isRef(exp)) {
|
|
463
470
|
Object.keys(exp).forEach(function (method) {
|
|
471
|
+
if (!utils_1.supportedMethods.has(method))
|
|
472
|
+
return;
|
|
464
473
|
callbackOperations.push(_this.getCallback(callback, expression, method));
|
|
465
474
|
});
|
|
466
475
|
}
|
package/dist/utils.js
CHANGED
|
@@ -3,10 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
exports.__esModule = true;
|
|
6
|
+
exports.supportedMethods = void 0;
|
|
6
7
|
var find_schema_definition_1 = __importDefault(require("./lib/find-schema-definition"));
|
|
7
8
|
var get_schema_1 = __importDefault(require("./lib/get-schema"));
|
|
8
9
|
var matches_mimetype_1 = __importDefault(require("./lib/matches-mimetype"));
|
|
9
10
|
var get_parameters_as_json_schema_1 = require("./operation/get-parameters-as-json-schema");
|
|
11
|
+
var supportedMethods = new Set(['get', 'put', 'post', 'delete', 'options', 'head', 'patch', 'trace']);
|
|
12
|
+
exports.supportedMethods = supportedMethods;
|
|
10
13
|
exports["default"] = {
|
|
11
14
|
findSchemaDefinition: find_schema_definition_1["default"],
|
|
12
15
|
getSchema: get_schema_1["default"],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oas",
|
|
3
|
-
"version": "17.4.
|
|
3
|
+
"version": "17.4.1",
|
|
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)",
|
|
@@ -59,14 +59,14 @@
|
|
|
59
59
|
"jsonpointer": "^5.0.0",
|
|
60
60
|
"memoizee": "^0.4.14",
|
|
61
61
|
"minimist": "^1.2.0",
|
|
62
|
-
"oas-normalize": "^5.0
|
|
63
|
-
"openapi-types": "^
|
|
62
|
+
"oas-normalize": "^5.1.0",
|
|
63
|
+
"openapi-types": "^10.0.0",
|
|
64
64
|
"path-to-regexp": "^6.2.0",
|
|
65
65
|
"swagger-inline": "^5.0.2"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@commitlint/cli": "^
|
|
69
|
-
"@commitlint/config-conventional": "^
|
|
68
|
+
"@commitlint/cli": "^16.0.1",
|
|
69
|
+
"@commitlint/config-conventional": "^16.0.0",
|
|
70
70
|
"@readme/eslint-config": "^8.0.2",
|
|
71
71
|
"@readme/oas-examples": "^4.3.2",
|
|
72
72
|
"@types/jest": "^27.0.2",
|
package/src/index.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { pathToRegexp, match } from 'path-to-regexp';
|
|
|
7
7
|
import getAuth from './lib/get-auth';
|
|
8
8
|
import getUserVariable from './lib/get-user-variable';
|
|
9
9
|
import Operation, { Callback, Webhook } from './operation';
|
|
10
|
-
import utils from './utils';
|
|
10
|
+
import utils, { supportedMethods } from './utils';
|
|
11
11
|
|
|
12
12
|
type PathMatch = {
|
|
13
13
|
url: {
|
|
@@ -640,7 +640,6 @@ export default class Oas {
|
|
|
640
640
|
// the paths object that isn't a known HTTP method.
|
|
641
641
|
// https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#fixed-fields-7
|
|
642
642
|
// https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#fixed-fields-7
|
|
643
|
-
const supportedMethods = new Set(['get', 'put', 'post', 'delete', 'options', 'head', 'patch', 'trace']);
|
|
644
643
|
const paths: Record<string, Record<RMOAS.HttpMethods, Operation | Webhook>> = {};
|
|
645
644
|
|
|
646
645
|
Object.keys(this.api.paths ? this.api.paths : []).forEach(path => {
|
package/src/operation.ts
CHANGED
|
@@ -11,6 +11,7 @@ import getRequestBodyExamples from './operation/get-requestbody-examples';
|
|
|
11
11
|
import getCallbackExamples from './operation/get-callback-examples';
|
|
12
12
|
import getResponseExamples from './operation/get-response-examples';
|
|
13
13
|
import matchesMimeType from './lib/matches-mimetype';
|
|
14
|
+
import { supportedMethods } from './utils';
|
|
14
15
|
|
|
15
16
|
type SecurityType = 'Basic' | 'Bearer' | 'Query' | 'Header' | 'Cookie' | 'OAuth2' | 'http' | 'apiKey';
|
|
16
17
|
|
|
@@ -76,10 +77,18 @@ export default class Operation {
|
|
|
76
77
|
}
|
|
77
78
|
|
|
78
79
|
getSummary(): string {
|
|
80
|
+
if (this.api.paths[this.path].summary) {
|
|
81
|
+
return this.api.paths[this.path].summary;
|
|
82
|
+
}
|
|
83
|
+
|
|
79
84
|
return this.schema?.summary ? this.schema.summary.trim() : undefined;
|
|
80
85
|
}
|
|
81
86
|
|
|
82
87
|
getDescription(): string {
|
|
88
|
+
if (this.api.paths[this.path].description) {
|
|
89
|
+
return this.api.paths[this.path].description;
|
|
90
|
+
}
|
|
91
|
+
|
|
83
92
|
return this.schema?.description ? this.schema.description.trim() : undefined;
|
|
84
93
|
}
|
|
85
94
|
|
|
@@ -527,6 +536,8 @@ export default class Operation {
|
|
|
527
536
|
|
|
528
537
|
if (!RMOAS.isRef(exp)) {
|
|
529
538
|
Object.keys(exp).forEach((method: RMOAS.HttpMethods) => {
|
|
539
|
+
if (!supportedMethods.has(method)) return;
|
|
540
|
+
|
|
530
541
|
callbackOperations.push(this.getCallback(callback, expression, method));
|
|
531
542
|
});
|
|
532
543
|
}
|
package/src/utils.ts
CHANGED
|
@@ -3,9 +3,13 @@ import getSchema from './lib/get-schema';
|
|
|
3
3
|
import matchesMimeType from './lib/matches-mimetype';
|
|
4
4
|
import { types as jsonSchemaTypes } from './operation/get-parameters-as-json-schema';
|
|
5
5
|
|
|
6
|
+
const supportedMethods = new Set(['get', 'put', 'post', 'delete', 'options', 'head', 'patch', 'trace']);
|
|
7
|
+
|
|
6
8
|
export default {
|
|
7
9
|
findSchemaDefinition,
|
|
8
10
|
getSchema,
|
|
9
11
|
jsonSchemaTypes,
|
|
10
12
|
matchesMimeType,
|
|
11
13
|
};
|
|
14
|
+
|
|
15
|
+
export { supportedMethods };
|