New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@redocly/openapi-core

Package Overview
Dependencies
Maintainers
5
Versions
192
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@redocly/openapi-core - npm Package Compare versions

Comparing version 1.0.0-beta.86 to 1.0.0-beta.87

4

__tests__/utils.ts

@@ -47,3 +47,3 @@ import * as path from 'path';

export function makeConfigForRuleset(rules: Oas3RuleSet, plugin?: Partial<Plugin>) {
export function makeConfigForRuleset(rules: Oas3RuleSet, plugin?: Partial<Plugin>, version: string = 'oas3') {
const rulesConf: Record<string, RuleConfig> = {};

@@ -60,3 +60,3 @@ const ruleId = 'test';

id: ruleId,
rules: { oas3: rules },
rules: { [version]: rules },
},

@@ -63,0 +63,0 @@ ],

@@ -146,2 +146,86 @@ import outdent from 'outdent';

it('should run nested visitors correctly oas2', async () => {
const calls: string[] = [];
const testRuleSet: Oas3RuleSet = {
test: jest.fn(() => {
return {
Operation: {
enter: jest.fn((op) => calls.push(`enter operation: ${op.operationId}`)),
leave: jest.fn((op) => calls.push(`leave operation: ${op.operationId}`)),
Parameter: {
enter: jest.fn((param, _ctx, parents) =>
calls.push(
`enter operation ${parents.Operation.operationId} > param ${param.name}`,
),
),
leave: jest.fn((param, _ctx, parents) =>
calls.push(
`leave operation ${parents.Operation.operationId} > param ${param.name}`,
),
),
},
},
Parameter: {
enter: jest.fn((param) => calls.push(`enter param ${param.name}`)),
leave: jest.fn((param) => calls.push(`leave param ${param.name}`)),
},
};
}),
};
const document = parseYamlToDocument(
outdent`
swagger: "2.0"
info:
contact: {}
license: {}
paths:
/pet:
parameters:
- name: path-param
get:
operationId: get
parameters:
- name: get_a
- name: get_b
post:
operationId: post
parameters:
- name: post_a
`,
'',
);
await lintDocument({
externalRefResolver: new BaseResolver(),
document,
config: makeConfigForRuleset(testRuleSet, undefined, 'oas2'),
});
expect(calls).toMatchInlineSnapshot(`
Array [
"enter param path-param",
"leave param path-param",
"enter operation: get",
"enter operation get > param get_a",
"enter param get_a",
"leave param get_a",
"leave operation get > param get_a",
"enter operation get > param get_b",
"enter param get_b",
"leave param get_b",
"leave operation get > param get_b",
"leave operation: get",
"enter operation: post",
"enter operation post > param post_a",
"enter param post_a",
"leave param post_a",
"leave operation post > param post_a",
"leave operation: post",
]
`);
});
it('should resolve refs', async () => {

@@ -148,0 +232,0 @@ const calls: string[] = [];

@@ -21,2 +21,3 @@ "use strict";

const TOKEN_FILENAME = '.redocly-config.json';
let REDOCLY_DOMAIN; // workaround for the isRedoclyRegistryURL, see more below
class RedoclyClient {

@@ -30,3 +31,7 @@ constructor(region) {

: process.env.REDOCLY_DOMAIN || config_1.DOMAINS[config_1.DEFAULT_REGION];
process.env.REDOCLY_DOMAIN = this.domain; // isRedoclyRegistryURL depends on the value to be set
/*
* We can't use process.env here because it is replaced by a const in some client-side bundles,
* which breaks assignment.
*/
REDOCLY_DOMAIN = this.domain; // isRedoclyRegistryURL depends on the value to be set
this.registryApi = new registry_api_1.RegistryApi(this.accessTokens, this.region);

@@ -149,3 +154,3 @@ }

function isRedoclyRegistryURL(link) {
const domain = process.env.REDOCLY_DOMAIN || config_1.DOMAINS[config_1.DEFAULT_REGION];
const domain = REDOCLY_DOMAIN || process.env.REDOCLY_DOMAIN || config_1.DOMAINS[config_1.DEFAULT_REGION];
const legacyDomain = domain === 'redocly.com' ? 'redoc.ly' : domain;

@@ -152,0 +157,0 @@ if (!link.startsWith(`https://api.${domain}/registry/`) &&

@@ -58,2 +58,3 @@ "use strict";

$ref: { type: 'string' },
parameters: _1.listOf('Parameter'),
get: 'Operation',

@@ -66,3 +67,2 @@ put: 'Operation',

patch: 'Operation',
parameters: _1.listOf('Parameter'),
},

@@ -69,0 +69,0 @@ };

{
"name": "@redocly/openapi-core",
"version": "1.0.0-beta.86",
"version": "1.0.0-beta.87",
"description": "",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -12,2 +12,3 @@ import { existsSync, readFileSync, writeFileSync, unlinkSync } from 'fs';

let REDOCLY_DOMAIN: string; // workaround for the isRedoclyRegistryURL, see more below
export class RedoclyClient {

@@ -26,3 +27,7 @@ private accessTokens: AccessTokens = {};

process.env.REDOCLY_DOMAIN = this.domain; // isRedoclyRegistryURL depends on the value to be set
/*
* We can't use process.env here because it is replaced by a const in some client-side bundles,
* which breaks assignment.
*/
REDOCLY_DOMAIN = this.domain; // isRedoclyRegistryURL depends on the value to be set
this.registryApi = new RegistryApi(this.accessTokens, this.region);

@@ -175,3 +180,3 @@ }

export function isRedoclyRegistryURL(link: string): boolean {
const domain = process.env.REDOCLY_DOMAIN || DOMAINS[DEFAULT_REGION];
const domain = REDOCLY_DOMAIN || process.env.REDOCLY_DOMAIN || DOMAINS[DEFAULT_REGION];

@@ -178,0 +183,0 @@ const legacyDomain = domain === 'redocly.com' ? 'redoc.ly' : domain;

@@ -63,2 +63,4 @@ import { NodeType, listOf, mapOf } from '.';

$ref: { type: 'string' }, // TODO: verify special $ref handling for Path Item
parameters: listOf('Parameter'),
get: 'Operation',

@@ -71,3 +73,2 @@ put: 'Operation',

patch: 'Operation',
parameters: listOf('Parameter'),
},

@@ -74,0 +75,0 @@ };

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc