Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@openapi-contrib/json-schema-to-openapi-schema

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@openapi-contrib/json-schema-to-openapi-schema - npm Package Compare versions

Comparing version 2.2.2 to 2.2.3

4

dist/cjs/index.d.ts
import type { JSONSchema } from '@apidevtools/json-schema-ref-parser';
import type { Options } from './types';
import type { OpenAPI3 } from 'openapi-typescript';
declare const convert: <T = JSONSchema>(schema: T, options?: Options) => Promise<OpenAPI3>;
import type { OpenAPIV3 } from 'openapi-types';
declare const convert: <T = JSONSchema>(schema: T, options?: Options) => Promise<OpenAPIV3.Document>;
export default convert;

@@ -13,3 +13,3 @@ "use strict";

const json_schema_walker_1 = require("json-schema-walker");
const const_1 = require("./const");
const const_js_1 = require("./const.js");
class InvalidTypeError extends Error {

@@ -31,3 +31,3 @@ constructor(message) {

const walker = new json_schema_walker_1.Walker();
yield walker.loadSchema(Object.assign(Object.assign({}, def), { $schema: schema['$schema'] }), {
yield walker.loadSchema(Object.assign(Object.assign({ definitions: schema['definitions'] || [] }, def), { $schema: schema['$schema'] }), {
dereference: true,

@@ -42,2 +42,5 @@ cloneSchema: true,

yield walker.walk(convertSchema, walker.vocabularies.DRAFT_07);
if ('definitions' in walker.rootSchema) {
delete walker.rootSchema.definitions;
}
return walker.rootSchema;

@@ -219,3 +222,3 @@ }

.filter((keyword) => !keyword.startsWith(oasExtensionPrefix) &&
!const_1.allowedKeywords.includes(keyword))
!const_js_1.allowedKeywords.includes(keyword))
.forEach((keyword) => {

@@ -222,0 +225,0 @@ const key = `${oasExtensionPrefix}${keyword}`;

import type { JSONSchema } from '@apidevtools/json-schema-ref-parser';
import type { Options } from './types';
import type { OpenAPI3 } from 'openapi-typescript';
declare const convert: <T = JSONSchema>(schema: T, options?: Options) => Promise<OpenAPI3>;
import type { OpenAPIV3 } from 'openapi-types';
declare const convert: <T = JSONSchema>(schema: T, options?: Options) => Promise<OpenAPIV3.Document>;
export default convert;
import { Walker } from 'json-schema-walker';
import { allowedKeywords } from './const';
import { allowedKeywords } from './const.js';
class InvalidTypeError extends Error {

@@ -19,3 +19,7 @@ constructor(message) {

const walker = new Walker();
await walker.loadSchema({ ...def, $schema: schema['$schema'] }, {
await walker.loadSchema({
definitions: schema['definitions'] || [],
...def,
$schema: schema['$schema'],
}, {
dereference: true,

@@ -30,2 +34,5 @@ cloneSchema: true,

await walker.walk(convertSchema, walker.vocabularies.DRAFT_07);
if ('definitions' in walker.rootSchema) {
delete walker.rootSchema.definitions;
}
return walker.rootSchema;

@@ -32,0 +39,0 @@ }

{
"name": "@openapi-contrib/json-schema-to-openapi-schema",
"version": "2.2.2",
"version": "2.2.3",
"description": "Converts a JSON Schema to OpenAPI Schema Object",

@@ -39,2 +39,3 @@ "bin": {

"json-schema-walker": "^0.0.4",
"openapi-types": "^12.0.0",
"yargs": "^17.5.1"

@@ -52,6 +53,5 @@ },

"nock": "^13.2.9",
"openapi-typescript": "^5.4.1",
"prettier": "^2.7.1",
"typescript": "^4.7.4",
"vitest": "^0.20.3"
"vitest": "^0.21.0"
},

@@ -58,0 +58,0 @@ "prettier": {

Sorry, the diff of this file is not supported yet

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