@redocly/openapi-core 1.0.0-beta.65 → 1.0.0-beta.69
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/__tests__/__snapshots__/bundle.test.ts.snap +126 -0
- package/__tests__/bundle.test.ts +53 -1
- package/__tests__/fixtures/refs/definitions.yaml +3 -0
- package/__tests__/fixtures/refs/external-request-body.yaml +13 -0
- package/__tests__/fixtures/refs/externalref.yaml +35 -0
- package/__tests__/fixtures/refs/hosted.yaml +35 -0
- package/__tests__/fixtures/refs/rename.yaml +1 -0
- package/__tests__/fixtures/refs/requestBody.yaml +9 -0
- package/__tests__/fixtures/refs/simple.yaml +1 -0
- package/__tests__/fixtures/refs/vendor.schema.yaml +20 -0
- package/lib/bundle.d.ts +4 -0
- package/lib/bundle.js +25 -7
- package/lib/config/all.js +9 -1
- package/lib/config/config.js +1 -1
- package/lib/config/minimal.js +1 -0
- package/lib/config/recommended.js +1 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -1
- package/lib/lint.js +2 -0
- package/lib/redocly/index.d.ts +3 -14
- package/lib/redocly/index.js +19 -186
- package/lib/redocly/registry-api-types.d.ts +28 -0
- package/lib/redocly/registry-api-types.js +2 -0
- package/lib/redocly/registry-api.d.ts +11 -0
- package/lib/redocly/registry-api.js +94 -0
- package/lib/ref-utils.js +1 -2
- package/lib/rules/common/info-license-url.js +1 -0
- package/lib/rules/common/no-http-verbs-in-paths.d.ts +2 -0
- package/lib/rules/common/no-http-verbs-in-paths.js +33 -0
- package/lib/rules/common/operation-4xx-response.d.ts +2 -0
- package/lib/rules/common/operation-4xx-response.js +17 -0
- package/lib/rules/common/path-excludes-patterns.d.ts +2 -0
- package/lib/rules/common/path-excludes-patterns.js +22 -0
- package/lib/rules/common/path-segment-plural.d.ts +2 -0
- package/lib/rules/common/path-segment-plural.js +32 -0
- package/lib/rules/common/registry-dependencies.js +4 -7
- package/lib/rules/oas2/index.d.ts +6 -0
- package/lib/rules/oas2/index.js +12 -0
- package/lib/rules/oas2/request-mime-type.d.ts +2 -0
- package/lib/rules/oas2/request-mime-type.js +17 -0
- package/lib/rules/oas2/response-mime-type.d.ts +2 -0
- package/lib/rules/oas2/response-mime-type.js +17 -0
- package/lib/rules/oas3/index.js +12 -0
- package/lib/rules/oas3/no-server-trailing-slash.js +1 -1
- package/lib/rules/oas3/request-mime-type.d.ts +2 -0
- package/lib/rules/oas3/request-mime-type.js +31 -0
- package/lib/rules/oas3/response-mime-type.d.ts +2 -0
- package/lib/rules/oas3/response-mime-type.js +31 -0
- package/lib/types/oas3_1.js +6 -0
- package/lib/utils.d.ts +10 -0
- package/lib/utils.js +65 -1
- package/lib/walk.d.ts +2 -0
- package/lib/walk.js +7 -0
- package/package.json +5 -3
- package/src/__tests__/utils.test.ts +19 -1
- package/src/bundle.ts +51 -9
- package/src/config/all.ts +9 -1
- package/src/config/config.ts +2 -2
- package/src/config/minimal.ts +1 -0
- package/src/config/recommended.ts +1 -0
- package/src/index.ts +1 -1
- package/src/lint.ts +2 -0
- package/src/redocly/index.ts +17 -194
- package/src/redocly/registry-api-types.ts +31 -0
- package/src/redocly/registry-api.ts +106 -0
- package/src/ref-utils.ts +1 -3
- package/src/rules/common/__tests__/info-license.test.ts +1 -1
- package/src/rules/common/__tests__/operation-4xx-response.test.ts +108 -0
- package/src/rules/common/info-license-url.ts +1 -0
- package/src/rules/common/no-http-verbs-in-paths.ts +36 -0
- package/src/rules/common/operation-4xx-response.ts +17 -0
- package/src/rules/common/path-excludes-patterns.ts +23 -0
- package/src/rules/common/path-segment-plural.ts +31 -0
- package/src/rules/common/registry-dependencies.ts +6 -8
- package/src/rules/oas2/index.ts +12 -0
- package/src/rules/oas2/request-mime-type.ts +17 -0
- package/src/rules/oas2/response-mime-type.ts +17 -0
- package/src/rules/oas3/__tests__/no-server-trailing-slash.test.ts +19 -0
- package/src/rules/oas3/index.ts +12 -0
- package/src/rules/oas3/no-server-trailing-slash.ts +1 -1
- package/src/rules/oas3/request-mime-type.ts +31 -0
- package/src/rules/oas3/response-mime-type.ts +31 -0
- package/src/rules/utils.ts +1 -1
- package/src/types/oas3_1.ts +7 -0
- package/src/utils.ts +75 -0
- package/src/walk.ts +10 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/lib/redocly/query.d.ts +0 -4
- package/lib/redocly/query.js +0 -44
- package/src/redocly/query.ts +0 -38
package/lib/redocly/query.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.GqlRequestError = exports.query = void 0;
|
|
13
|
-
const node_fetch_1 = require("node-fetch");
|
|
14
|
-
const GRAPHQL_ENDPOINT = process.env.REDOCLY_DOMAIN
|
|
15
|
-
? `https://api.${process.env.REDOCLY_DOMAIN}/graphql`
|
|
16
|
-
: 'https://api.redoc.ly/graphql';
|
|
17
|
-
function query(query, variables = {}, headers = {}) {
|
|
18
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
-
headers = Object.assign(Object.assign({}, headers), { 'Content-Type': 'application/json' });
|
|
20
|
-
const gQLResponse = yield node_fetch_1.default(GRAPHQL_ENDPOINT, {
|
|
21
|
-
method: 'POST',
|
|
22
|
-
headers,
|
|
23
|
-
body: JSON.stringify({
|
|
24
|
-
query,
|
|
25
|
-
variables,
|
|
26
|
-
}),
|
|
27
|
-
});
|
|
28
|
-
if (!gQLResponse.ok) {
|
|
29
|
-
throw new GqlRequestError(`Failed to execute query: ${gQLResponse.status}`);
|
|
30
|
-
}
|
|
31
|
-
const response = yield gQLResponse.json();
|
|
32
|
-
if (response.errors && response.errors.length) {
|
|
33
|
-
throw new GqlRequestError(`Query failed: ${response.errors[0].message}`);
|
|
34
|
-
}
|
|
35
|
-
return response.data;
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
exports.query = query;
|
|
39
|
-
class GqlRequestError extends Error {
|
|
40
|
-
constructor(message) {
|
|
41
|
-
super(message);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
exports.GqlRequestError = GqlRequestError;
|
package/src/redocly/query.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import fetch from 'node-fetch';
|
|
2
|
-
|
|
3
|
-
const GRAPHQL_ENDPOINT = process.env.REDOCLY_DOMAIN
|
|
4
|
-
? `https://api.${process.env.REDOCLY_DOMAIN}/graphql`
|
|
5
|
-
: 'https://api.redoc.ly/graphql';
|
|
6
|
-
|
|
7
|
-
export async function query(query: string, variables = {}, headers = {}): Promise<any> {
|
|
8
|
-
headers = {
|
|
9
|
-
...headers,
|
|
10
|
-
'Content-Type': 'application/json',
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const gQLResponse = await fetch(GRAPHQL_ENDPOINT, {
|
|
14
|
-
method: 'POST',
|
|
15
|
-
headers,
|
|
16
|
-
body: JSON.stringify({
|
|
17
|
-
query,
|
|
18
|
-
variables,
|
|
19
|
-
}),
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
if (!gQLResponse.ok) {
|
|
23
|
-
throw new GqlRequestError(`Failed to execute query: ${gQLResponse.status}`);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const response = await gQLResponse.json();
|
|
27
|
-
if (response.errors && response.errors.length) {
|
|
28
|
-
throw new GqlRequestError(`Query failed: ${response.errors[0].message}`);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return response.data;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export class GqlRequestError extends Error {
|
|
35
|
-
constructor(message: string) {
|
|
36
|
-
super(message);
|
|
37
|
-
}
|
|
38
|
-
}
|