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
101
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 1.0.3 to 1.0.4

7

lib/converters/HttpLlmConverter.js

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

return null;
return __assign(__assign({}, props.input), { oneOf: oneOf });
return __assign(__assign({}, props.input), { oneOf: flat(oneOf) });
}

@@ -271,1 +271,6 @@ else if (OpenApiTypeChecker_1.OpenApiTypeChecker.isObject(props.input)) {

};
var flat = function (elements) {
return elements
.map(function (elem) { return (OpenApiTypeChecker_1.OpenApiTypeChecker.isOneOf(elem) ? flat(elem.oneOf) : elem); })
.flat();
};

@@ -196,5 +196,3 @@ "use strict";

var e_2, _a;
var nullable = OpenApiTypeChecker_1.OpenApiTypeChecker.isNull(input) ||
(OpenApiTypeChecker_1.OpenApiTypeChecker.isOneOf(input) &&
input.oneOf.some(OpenApiTypeChecker_1.OpenApiTypeChecker.isNull));
var nullable = isNullable(new Set())(collection.original)(input);
var union = [];

@@ -311,3 +309,3 @@ var attribute = __assign({ title: input.title, description: input.description }, Object.fromEntries(Object.entries(input).filter(function (_a) {

: union.length === 1
? __assign({}, union[0]) : { oneOf: union.map(function (u) { return (__assign(__assign({}, u), { nullable: undefined })); }) })), attribute);
? __assign({}, union[0]) : { oneOf: union })), attribute);
};

@@ -332,2 +330,21 @@ };

};
var isNullable = function (visited) {
return function (components) {
return function (schema) {
var _a;
if (OpenApiTypeChecker_1.OpenApiTypeChecker.isNull(schema))
return true;
else if (OpenApiTypeChecker_1.OpenApiTypeChecker.isReference(schema)) {
if (visited.has(schema.$ref))
return false;
visited.add(schema.$ref);
var key = schema.$ref.split("/").pop();
var next = (_a = components.schemas) === null || _a === void 0 ? void 0 : _a[key];
return next ? isNullable(visited)(components)(next) : false;
}
return (OpenApiTypeChecker_1.OpenApiTypeChecker.isOneOf(schema) &&
schema.oneOf.some(isNullable(visited)(components)));
};
};
};
})(OpenApiV3Downgrader || (exports.OpenApiV3Downgrader = OpenApiV3Downgrader = {}));

@@ -217,5 +217,3 @@ "use strict";

var e_2, _a;
var nullable = OpenApiTypeChecker_1.OpenApiTypeChecker.isNull(input) ||
(OpenApiTypeChecker_1.OpenApiTypeChecker.isOneOf(input) &&
input.oneOf.some(OpenApiTypeChecker_1.OpenApiTypeChecker.isNull));
var nullable = isNullable(new Set())(collection.original)(input);
var union = [];

@@ -318,3 +316,3 @@ var attribute = __assign({ title: input.title, description: input.description }, Object.fromEntries(Object.entries(input).filter(function (_a) {

: union.length === 1
? __assign({}, union[0]) : { "x-oneOf": union.map(function (u) { return (__assign(__assign({}, u), { nullable: undefined })); }) })), attribute), (union.length > 1 ? { discriminator: undefined } : {}));
? __assign({}, union[0]) : { "x-oneOf": union })), attribute), (union.length > 1 ? { discriminator: undefined } : {}));
};

@@ -382,2 +380,21 @@ };

};
var isNullable = function (visited) {
return function (components) {
return function (schema) {
var _a;
if (OpenApiTypeChecker_1.OpenApiTypeChecker.isNull(schema))
return true;
else if (OpenApiTypeChecker_1.OpenApiTypeChecker.isReference(schema)) {
if (visited.has(schema.$ref))
return false;
visited.add(schema.$ref);
var key = schema.$ref.split("/").pop();
var next = (_a = components.schemas) === null || _a === void 0 ? void 0 : _a[key];
return next ? isNullable(visited)(components)(next) : false;
}
return (OpenApiTypeChecker_1.OpenApiTypeChecker.isOneOf(schema) &&
schema.oneOf.some(isNullable(visited)(components)));
};
};
};
})(SwaggerV2Downgrader || (exports.SwaggerV2Downgrader = SwaggerV2Downgrader = {}));

2

package.json
{
"name": "@samchon/openapi",
"version": "1.0.3",
"version": "1.0.4",
"description": "OpenAPI definitions and converters for 'typia' and 'nestia'.",

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

@@ -0,0 +0,0 @@ # `@samchon/openapi`

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

...props.input,
oneOf: oneOf as OpenApi.IJsonSchema[],
oneOf: flat(oneOf as OpenApi.IJsonSchema[]),
};

@@ -286,1 +286,6 @@ } else if (OpenApiTypeChecker.isObject(props.input)) {

};
const flat = (elements: OpenApi.IJsonSchema[]): OpenApi.IJsonSchema[] =>
elements
.map((elem) => (OpenApiTypeChecker.isOneOf(elem) ? flat(elem.oneOf) : elem))
.flat();

@@ -0,0 +0,0 @@ import { OpenApi } from "../OpenApi";

@@ -0,0 +0,0 @@ import { OpenApi } from "../OpenApi";

@@ -0,0 +0,0 @@ import { OpenApi } from "../OpenApi";

@@ -0,0 +0,0 @@ import { OpenApi } from "../OpenApi";

@@ -0,0 +0,0 @@ import { OpenApi } from "../OpenApi";

@@ -179,6 +179,5 @@ import { OpenApi } from "../OpenApi";

(input: OpenApi.IJsonSchema): OpenApiV3.IJsonSchema => {
const nullable: boolean =
OpenApiTypeChecker.isNull(input) ||
(OpenApiTypeChecker.isOneOf(input) &&
input.oneOf.some(OpenApiTypeChecker.isNull));
const nullable: boolean = isNullable(new Set())(collection.original)(
input,
);
const union: OpenApiV3.IJsonSchema[] = [];

@@ -290,3 +289,3 @@ const attribute: OpenApiV3.IJsonSchema.__IAttribute = {

? { ...union[0] }
: { oneOf: union.map((u) => ({ ...u, nullable: undefined })) }),
: { oneOf: union }),
...attribute,

@@ -314,2 +313,20 @@ };

};
const isNullable =
(visited: Set<string>) =>
(components: OpenApi.IComponents) =>
(schema: OpenApi.IJsonSchema): boolean => {
if (OpenApiTypeChecker.isNull(schema)) return true;
else if (OpenApiTypeChecker.isReference(schema)) {
if (visited.has(schema.$ref)) return false;
visited.add(schema.$ref);
const key: string = schema.$ref.split("/").pop()!;
const next: OpenApi.IJsonSchema | undefined = components.schemas?.[key];
return next ? isNullable(visited)(components)(next) : false;
}
return (
OpenApiTypeChecker.isOneOf(schema) &&
schema.oneOf.some(isNullable(visited)(components))
);
};
}

@@ -0,0 +0,0 @@ import { OpenApi } from "../OpenApi";

@@ -190,6 +190,5 @@ import { OpenApi } from "../OpenApi";

(input: OpenApi.IJsonSchema): SwaggerV2.IJsonSchema => {
const nullable: boolean =
OpenApiTypeChecker.isNull(input) ||
(OpenApiTypeChecker.isOneOf(input) &&
input.oneOf.some(OpenApiTypeChecker.isNull));
const nullable: boolean = isNullable(new Set())(collection.original)(
input,
);
const union: SwaggerV2.IJsonSchema[] = [];

@@ -301,3 +300,3 @@ const attribute: SwaggerV2.IJsonSchema.__IAttribute = {

? { ...union[0] }
: { "x-oneOf": union.map((u) => ({ ...u, nullable: undefined })) }),
: { "x-oneOf": union }),
...attribute,

@@ -368,2 +367,20 @@ ...(union.length > 1 ? { discriminator: undefined } : {}),

};
const isNullable =
(visited: Set<string>) =>
(components: OpenApi.IComponents) =>
(schema: OpenApi.IJsonSchema): boolean => {
if (OpenApiTypeChecker.isNull(schema)) return true;
else if (OpenApiTypeChecker.isReference(schema)) {
if (visited.has(schema.$ref)) return false;
visited.add(schema.$ref);
const key: string = schema.$ref.split("/").pop()!;
const next: OpenApi.IJsonSchema | undefined = components.schemas?.[key];
return next ? isNullable(visited)(components)(next) : false;
}
return (
OpenApiTypeChecker.isOneOf(schema) &&
schema.oneOf.some(isNullable(visited)(components))
);
};
}

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ import type { HttpLlm } from "../HttpLlm";

@@ -0,0 +0,0 @@ import type { HttpMigration } from "../HttpMigration";

@@ -0,0 +0,0 @@ import { HttpMigration } from "./HttpMigration";

@@ -0,0 +0,0 @@ import { OpenApi } from "./OpenApi";

@@ -0,0 +0,0 @@ // STRUCTURES

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

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /// <reference lib="dom" />

@@ -0,0 +0,0 @@ import { OpenApi } from "../OpenApi";

@@ -0,0 +0,0 @@ import { OpenApi } from "../OpenApi";

@@ -0,0 +0,0 @@ import { OpenApi } from "../OpenApi";

@@ -0,0 +0,0 @@ import { OpenApi } from "../OpenApi";

@@ -0,0 +0,0 @@ import { ILlmFunction } from "./ILlmFunction";

@@ -0,0 +0,0 @@ import { ILlmSchema } from "./ILlmSchema";

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ export namespace Escaper {

@@ -0,0 +0,0 @@ import { IHttpLlmFunction } from "../structures/IHttpLlmFunction";

@@ -0,0 +0,0 @@ import { IHttpLlmFunction } from "../structures/IHttpLlmFunction";

@@ -0,0 +0,0 @@ import { ILlmSchema } from "../structures/ILlmSchema";

@@ -0,0 +0,0 @@ export namespace MapUtil {

@@ -0,0 +0,0 @@ import { StringUtil } from "./StringUtil";

@@ -0,0 +0,0 @@ import { OpenApi } from "../OpenApi";

@@ -0,0 +0,0 @@ import { NamingConvention } from "./NamingConvention";

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

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

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

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