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

@samchon/openapi

Package Overview
Dependencies
Maintainers
1
Versions
147
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@samchon/openapi - npm Package Compare versions

Comparing version 0.1.2-dev.20240411-3 to 0.1.2-dev.20240411-4

33

lib/internal/OpenApiV3_1Converter.js

@@ -6,14 +6,15 @@ "use strict";

(function (OpenApiV3_1Converter) {
OpenApiV3_1Converter.convert = (input) => (Object.assign(Object.assign({}, input), { components: input.components
? convertComponents(input.components)
: undefined, paths: input.paths
? Object.fromEntries(Object.entries(input.paths)
.filter(([_, v]) => v !== undefined)
.map(([key, value]) => [key, convertPathItem(input)(value)]))
: undefined, webhooks: input.webhooks
? Object.fromEntries(Object.entries(input.webhooks)
.filter(([_, v]) => v !== undefined)
.map(([key, value]) => [key, convertWebhooks(input)(value)])
.filter(([_, value]) => value !== undefined))
: undefined }));
OpenApiV3_1Converter.convert = (input) => {
var _a;
return (Object.assign(Object.assign({}, input), { components: convertComponents((_a = input.components) !== null && _a !== void 0 ? _a : {}), paths: input.paths
? Object.fromEntries(Object.entries(input.paths)
.filter(([_, v]) => v !== undefined)
.map(([key, value]) => [key, convertPathItem(input)(value)]))
: undefined, webhooks: input.webhooks
? Object.fromEntries(Object.entries(input.webhooks)
.filter(([_, v]) => v !== undefined)
.map(([key, value]) => [key, convertWebhooks(input)(value)])
.filter(([_, value]) => value !== undefined))
: undefined }));
};
/* -----------------------------------------------------------

@@ -118,7 +119,5 @@ OPERATORS

return ({
schemas: input.schemas
? Object.fromEntries(Object.entries((_a = input.schemas) !== null && _a !== void 0 ? _a : {})
.filter(([_, v]) => v !== undefined)
.map(([key, value]) => [key, convertSchema(value)]))
: undefined,
schemas: Object.fromEntries(Object.entries((_a = input.schemas) !== null && _a !== void 0 ? _a : {})
.filter(([_, v]) => v !== undefined)
.map(([key, value]) => [key, convertSchema(value)])),
securitySchemes: input.securitySchemes,

@@ -125,0 +124,0 @@ });

@@ -6,9 +6,10 @@ "use strict";

(function (OpenApiV3Converter) {
OpenApiV3Converter.convert = (input) => (Object.assign(Object.assign({}, input), { components: input.components
? convertComponents(input.components)
: undefined, paths: input.paths
? Object.fromEntries(Object.entries(input.paths)
.filter(([_, v]) => v !== undefined)
.map(([key, value]) => [key, convertPathItem(input)(value)]))
: undefined, openapi: "3.1.0" }));
OpenApiV3Converter.convert = (input) => {
var _a;
return (Object.assign(Object.assign({}, input), { components: convertComponents((_a = input.components) !== null && _a !== void 0 ? _a : {}), paths: input.paths
? Object.fromEntries(Object.entries(input.paths)
.filter(([_, v]) => v !== undefined)
.map(([key, value]) => [key, convertPathItem(input)(value)]))
: undefined, openapi: "3.1.0" }));
};
/* -----------------------------------------------------------

@@ -103,10 +104,11 @@ OPERATORS

----------------------------------------------------------- */
const convertComponents = (input) => ({
schemas: input.schemas
? Object.fromEntries(Object.entries(input.schemas)
const convertComponents = (input) => {
var _a;
return ({
schemas: Object.fromEntries(Object.entries((_a = input.schemas) !== null && _a !== void 0 ? _a : {})
.filter(([_, v]) => v !== undefined)
.map(([key, value]) => [key, convertSchema(value)]))
: undefined,
securitySchemes: input.securitySchemes,
});
.map(([key, value]) => [key, convertSchema(value)])),
securitySchemes: input.securitySchemes,
});
};
const convertSchema = (input) => {

@@ -113,0 +115,0 @@ const nullable = { value: false };

@@ -105,15 +105,16 @@ "use strict";

----------------------------------------------------------- */
const convertComponents = (input) => ({
schemas: input.definitions
? Object.fromEntries(Object.entries(input.definitions)
const convertComponents = (input) => {
var _a;
return ({
schemas: Object.fromEntries(Object.entries((_a = input.definitions) !== null && _a !== void 0 ? _a : {})
.filter(([_, v]) => v !== undefined)
.map(([key, value]) => [key, convertSchema(value)]))
: undefined,
securitySchemes: input.securityDefinitions
? Object.fromEntries(Object.entries(input.securityDefinitions)
.filter(([_, v]) => v !== undefined)
.map(([key, value]) => [key, convertSecurityScheme(value)])
.filter(([_, v]) => v !== undefined))
: undefined,
});
.map(([key, value]) => [key, convertSchema(value)])),
securitySchemes: input.securityDefinitions
? Object.fromEntries(Object.entries(input.securityDefinitions)
.filter(([_, v]) => v !== undefined)
.map(([key, value]) => [key, convertSecurityScheme(value)])
.filter(([_, v]) => v !== undefined))
: undefined,
});
};
const convertSecurityScheme = (input) => {

@@ -120,0 +121,0 @@ if (input.type === "apiKey")

@@ -22,3 +22,3 @@ import { OpenApiV3 } from "./OpenApiV3";

info?: IDocument.IInfo;
components?: IComponents;
components: IComponents;
paths?: Record<string, IPathItem>;

@@ -106,9 +106,4 @@ webhooks?: Record<string, IJsonSchema.IReference<`#/components/pathItems/${string}`> | IPathItem>;

interface IComponents {
schemas?: Record<string, IJsonSchema>;
pathItems?: Record<string, IPathItem>;
responses?: Record<string, IOperation.IResponse>;
parameters?: Record<string, IOperation.IParameter>;
requestBodies?: Record<string, IOperation.IRequestBody>;
schemas: Record<string, IJsonSchema>;
securitySchemes?: Record<string, ISecurityScheme>;
headers?: Record<string, IOperation.IParameter>;
}

@@ -115,0 +110,0 @@ type IJsonSchema = IJsonSchema.IConstant | IJsonSchema.IBoolean | IJsonSchema.IInteger | IJsonSchema.INumber | IJsonSchema.IString | IJsonSchema.IArray | IJsonSchema.IObject | IJsonSchema.IReference | IJsonSchema.IOneOf | IJsonSchema.INull | IJsonSchema.IUnknown;

{
"name": "@samchon/openapi",
"version": "0.1.2-dev.20240411-3",
"version": "0.1.2-dev.20240411-4",
"description": "",

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

@@ -7,5 +7,3 @@ import { OpenApi } from "../OpenApi";

...input,
components: input.components
? convertComponents(input.components)
: undefined,
components: convertComponents(input.components ?? {}),
paths: input.paths

@@ -201,9 +199,7 @@ ? Object.fromEntries(

): OpenApi.IComponents => ({
schemas: input.schemas
? Object.fromEntries(
Object.entries(input.schemas ?? {})
.filter(([_, v]) => v !== undefined)
.map(([key, value]) => [key, convertSchema(value)] as const),
)
: undefined,
schemas: Object.fromEntries(
Object.entries(input.schemas ?? {})
.filter(([_, v]) => v !== undefined)
.map(([key, value]) => [key, convertSchema(value)] as const),
),
securitySchemes: input.securitySchemes,

@@ -210,0 +206,0 @@ });

@@ -7,5 +7,3 @@ import { OpenApi } from "../OpenApi";

...input,
components: input.components
? convertComponents(input.components)
: undefined,
components: convertComponents(input.components ?? {}),
paths: input.paths

@@ -179,9 +177,7 @@ ? Object.fromEntries(

): OpenApi.IComponents => ({
schemas: input.schemas
? Object.fromEntries(
Object.entries(input.schemas)
.filter(([_, v]) => v !== undefined)
.map(([key, value]) => [key, convertSchema(value)]),
)
: undefined,
schemas: Object.fromEntries(
Object.entries(input.schemas ?? {})
.filter(([_, v]) => v !== undefined)
.map(([key, value]) => [key, convertSchema(value)]),
),
securitySchemes: input.securitySchemes,

@@ -188,0 +184,0 @@ });

@@ -158,9 +158,7 @@ import { OpenApi } from "../OpenApi";

): OpenApi.IComponents => ({
schemas: input.definitions
? Object.fromEntries(
Object.entries(input.definitions)
.filter(([_, v]) => v !== undefined)
.map(([key, value]) => [key, convertSchema(value)]),
)
: undefined,
schemas: Object.fromEntries(
Object.entries(input.definitions ?? {})
.filter(([_, v]) => v !== undefined)
.map(([key, value]) => [key, convertSchema(value)]),
),
securitySchemes: input.securityDefinitions

@@ -167,0 +165,0 @@ ? Object.fromEntries(

@@ -46,3 +46,3 @@ import { OpenApiV3 } from "./OpenApiV3";

info?: IDocument.IInfo;
components?: IComponents;
components: IComponents;
paths?: Record<string, IPathItem>;

@@ -145,9 +145,4 @@ webhooks?: Record<

export interface IComponents {
schemas?: Record<string, IJsonSchema>;
pathItems?: Record<string, IPathItem>;
responses?: Record<string, IOperation.IResponse>;
parameters?: Record<string, IOperation.IParameter>;
requestBodies?: Record<string, IOperation.IRequestBody>;
schemas: Record<string, IJsonSchema>;
securitySchemes?: Record<string, ISecurityScheme>;
headers?: Record<string, IOperation.IParameter>;
}

@@ -154,0 +149,0 @@

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