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

@kubb/swagger

Package Overview
Dependencies
Maintainers
1
Versions
576
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kubb/swagger - npm Package Compare versions

Comparing version 2.0.0-beta.12 to 2.0.0-beta.13

dist/chunk-5EEGXMWG.cjs

1

dist/hooks.js
import { createRequire } from 'module';
import './chunk-PUSDFDIP.js';
import { useApp, usePlugin, usePluginManager, useFile } from '@kubb/react';

@@ -3,0 +4,0 @@

86

dist/index.js
import { createRequire } from 'module';
import { getSchemas, isReference, isOpenApiV3Document, convertSwagger2ToOpenApi } from './chunk-AWEHKPOS.js';
import { __privateAdd, __privateSet, __privateGet, __privateMethod } from './chunk-PUSDFDIP.js';
import path, { resolve } from 'path';

@@ -9,85 +11,6 @@ import { createPlugin, Generator } from '@kubb/core';

import OASNormalize from 'oas-normalize';
import swagger2openapi from 'swagger2openapi';
import transformers from '@kubb/core/transformers';
import { findSchemaDefinition } from 'oas/utils';
import { isRef } from 'oas/types';
createRequire(import.meta.url);
var __accessCheck = (obj, member, msg) => {
if (!member.has(obj))
throw TypeError("Cannot " + msg);
};
var __privateGet = (obj, member, getter) => {
__accessCheck(obj, member, "read from private field");
return getter ? getter.call(obj) : member.get(obj);
};
var __privateAdd = (obj, member, value) => {
if (member.has(obj))
throw TypeError("Cannot add the same private member more than once");
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
};
var __privateSet = (obj, member, value, setter) => {
__accessCheck(obj, member, "write to private field");
setter ? setter.call(obj, value) : member.set(obj, value);
return value;
};
var __privateMethod = (obj, member, method) => {
__accessCheck(obj, member, "access private method");
return method;
};
// src/utils/getSchemas.ts
function getSchemas({
oas,
contentType,
includes = ["schemas", "requestBodies", "responses"]
}) {
const components = oas.getDefinition().components;
let schemas = {};
if (includes.includes("schemas")) {
schemas = {
...schemas,
...components?.schemas || {}
};
}
const requestBodies = components?.requestBodies || {};
if (includes.includes("responses")) {
const responses = components?.responses || {};
Object.entries(responses).forEach(([name, response]) => {
if (response.content && !schemas[name]) {
const firstContentType = Object.keys(response.content)[0] || "application/json";
schemas[name] = response.content?.[contentType || firstContentType]?.schema;
}
});
}
if (includes.includes("requestBodies")) {
Object.entries(requestBodies).forEach(([name, request]) => {
if (request.content && !schemas[name]) {
const firstContentType = Object.keys(request.content)[0] || "application/json";
schemas[name] = request.content?.[contentType || firstContentType]?.schema;
}
});
}
return schemas;
}
function convertSwagger2ToOpenApi(document) {
const options = { anchors: true };
return new Promise((resolve2, reject) => {
swagger2openapi.convertObj(document, options, (err, value) => {
if (err) {
reject(err);
} else {
resolve2(value.openapi);
}
});
});
}
// src/utils/isOpenApiV3Document.ts
function isOpenApiV3Document(doc) {
return doc && "openapi" in doc;
}
// src/OasManager.ts
var _options, _oas;

@@ -259,7 +182,2 @@ var _OasManager = class _OasManager {

_context = new WeakMap();
function isReference(obj) {
return !!obj && isRef(obj);
}
// src/OperationGenerator.ts
var _getOptions, getOptions_fn, _getParametersSchema, getParametersSchema_fn, _getResponseSchema, getResponseSchema_fn, _getRequestSchema, getRequestSchema_fn, _methods, methods_get;

@@ -266,0 +184,0 @@ var OperationGenerator = class extends Generator {

import { createRequire } from 'module';
import swagger2openapi from 'swagger2openapi';
export { convertSwagger2ToOpenApi, getSchemas, isOpenApiV3Document, isReference } from './chunk-AWEHKPOS.js';
import './chunk-PUSDFDIP.js';
import transformers from '@kubb/core/transformers';

@@ -9,17 +10,5 @@ import { URLPath, renderTemplate, FunctionParams } from '@kubb/core/utils';

import { LogLevel } from '@kubb/core/logger';
import { isSchema, isRef } from 'oas/types';
import { isSchema } from 'oas/types';
createRequire(import.meta.url);
function convertSwagger2ToOpenApi(document) {
const options = { anchors: true };
return new Promise((resolve, reject) => {
swagger2openapi.convertObj(document, options, (err, value) => {
if (err) {
reject(err);
} else {
resolve(value.openapi);
}
});
});
}
function getComments(operation) {

@@ -125,37 +114,2 @@ return [

}
// src/utils/getSchemas.ts
function getSchemas({
oas,
contentType,
includes = ["schemas", "requestBodies", "responses"]
}) {
const components = oas.getDefinition().components;
let schemas = {};
if (includes.includes("schemas")) {
schemas = {
...schemas,
...components?.schemas || {}
};
}
const requestBodies = components?.requestBodies || {};
if (includes.includes("responses")) {
const responses = components?.responses || {};
Object.entries(responses).forEach(([name, response]) => {
if (response.content && !schemas[name]) {
const firstContentType = Object.keys(response.content)[0] || "application/json";
schemas[name] = response.content?.[contentType || firstContentType]?.schema;
}
});
}
if (includes.includes("requestBodies")) {
Object.entries(requestBodies).forEach(([name, request]) => {
if (request.content && !schemas[name]) {
const firstContentType = Object.keys(request.content)[0] || "application/json";
schemas[name] = request.content?.[contentType || firstContentType]?.schema;
}
});
}
return schemas;
}
function isJSONSchema(obj) {

@@ -165,10 +119,2 @@ return !!obj && isSchema(obj);

// src/utils/isOpenApiV3Document.ts
function isOpenApiV3Document(doc) {
return doc && "openapi" in doc;
}
function isReference(obj) {
return !!obj && isRef(obj);
}
// src/utils/isRequired.ts

@@ -193,4 +139,4 @@ function isRequired(schema) {

export { convertSwagger2ToOpenApi, getASTParams, getComments, getGroupedByTagFiles, getParams, getSchemaFactory, getSchemas, isJSONSchema, isOpenApiV3Document, isOpenApiV3_1Document, isParameterObject, isReference, isRequired, refsSorter };
export { getASTParams, getComments, getGroupedByTagFiles, getParams, getSchemaFactory, isJSONSchema, isOpenApiV3_1Document, isParameterObject, isRequired, refsSorter };
//# sourceMappingURL=out.js.map
//# sourceMappingURL=utils.js.map
{
"name": "@kubb/swagger",
"version": "2.0.0-beta.12",
"version": "2.0.0-beta.13",
"description": "Generator swagger",

@@ -62,4 +62,4 @@ "keywords": [

"swagger2openapi": "^7.0.8",
"@kubb/core": "2.0.0-beta.12",
"@kubb/react": "2.0.0-beta.12"
"@kubb/core": "2.0.0-beta.13",
"@kubb/react": "2.0.0-beta.13"
},

@@ -78,3 +78,3 @@ "devDependencies": {

"peerDependencies": {
"@kubb/react": "2.0.0-beta.12"
"@kubb/react": "2.0.0-beta.13"
},

@@ -81,0 +81,0 @@ "packageManager": "pnpm@8.3.0",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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