Socket
Socket
Sign inDemoInstall

@samchon/openapi

Package Overview
Dependencies
0
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.17 to 0.1.18

2

lib/internal/OpenApiV3_1Converter.js

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

var _a, _b;
return (Object.assign(Object.assign({}, input), { parameters: pathItem.parameters !== undefined || input.parameters === undefined
return (Object.assign(Object.assign({}, input), { parameters: pathItem.parameters !== undefined || input.parameters !== undefined
? [...((_a = pathItem.parameters) !== null && _a !== void 0 ? _a : []), ...((_b = input.parameters) !== null && _b !== void 0 ? _b : [])]

@@ -53,0 +53,0 @@ .map((p) => {

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

return;
collection.downgraded.schemas[`${key}.Nullable`] =
OpenApiV3Downgrader.downgradeSchema(collection)(found);
else if (collection.downgraded.schemas[`${key}.Nullable`] === undefined) {
collection.downgraded.schemas[`${key}.Nullable`] = {};
collection.downgraded.schemas[`${key}.Nullable`] =
OpenApiV3Downgrader.downgradeSchema(collection)(found);
}
schema.$ref += ".Nullable";
};
})(OpenApiV3Downgrader || (exports.OpenApiV3Downgrader = OpenApiV3Downgrader = {}));

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

info: input.info,
host: (_b = (_a = input.servers) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.url,
host: ((_b = (_a = input.servers) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.url)
? input.servers[0].url.split("://").pop()
: "",
definitions: collection.downgraded,

@@ -53,3 +55,3 @@ securityDefinitions: ((_c = input.components) === null || _c === void 0 ? void 0 : _c.securitySchemes)

var _a;
return (Object.assign(Object.assign({}, input), { parameters: input.parameters || input.requestBody
return (Object.assign(Object.assign(Object.assign({}, input), { parameters: input.parameters !== undefined || input.requestBody !== undefined
? [

@@ -68,3 +70,6 @@ ...((_a = input.parameters) !== null && _a !== void 0 ? _a : []).map(downgradeParameter(collection)),

]))
: undefined }));
: undefined }), {
requestBody: undefined,
servers: undefined,
}));
};

@@ -112,3 +117,3 @@ const downgradeParameter = (collection) => (input, i) => {

if (value !== undefined)
collection.downgraded[`#/definitions/${key.split("/").pop()}`] =
collection.downgraded[key.split("/").pop()] =
SwaggerV2Downgrader.downgradeSchema(collection)(value);

@@ -130,5 +135,6 @@ }

OpenApiTypeChecker_1.OpenApiTypeChecker.isNumber(schema) ||
OpenApiTypeChecker_1.OpenApiTypeChecker.isString(schema) ||
OpenApiTypeChecker_1.OpenApiTypeChecker.isReference(schema))
OpenApiTypeChecker_1.OpenApiTypeChecker.isString(schema))
union.push(Object.assign({}, schema));
else if (OpenApiTypeChecker_1.OpenApiTypeChecker.isReference(schema))
union.push({ $ref: `#/definitions/${schema.$ref.split("/").pop()}` });
else if (OpenApiTypeChecker_1.OpenApiTypeChecker.isArray(schema))

@@ -200,3 +206,3 @@ union.push(Object.assign(Object.assign({}, schema), { items: SwaggerV2Downgrader.downgradeSchema(collection)(schema.items) }));

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

@@ -211,4 +217,7 @@ const downgradeNullableReference = (collection) => (schema) => {

return;
collection.downgraded[`${key}.Nullable`] =
SwaggerV2Downgrader.downgradeSchema(collection)(found);
else if (collection.downgraded[`${key}.Nullable`] === undefined) {
collection.downgraded[`${key}.Nullable`] = {};
collection.downgraded[`${key}.Nullable`] =
SwaggerV2Downgrader.downgradeSchema(collection)(found);
}
schema.$ref += ".Nullable";

@@ -215,0 +224,0 @@ };

{
"name": "@samchon/openapi",
"version": "0.1.17",
"version": "0.1.18",
"description": "OpenAPI definitions and converters for 'typia' and 'nestia'.",

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

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

parameters:
pathItem.parameters !== undefined || input.parameters === undefined
pathItem.parameters !== undefined || input.parameters !== undefined
? [...(pathItem.parameters ?? []), ...(input.parameters ?? [])]

@@ -89,0 +89,0 @@ .map((p) => {

@@ -298,9 +298,15 @@ import { OpenApi } from "../OpenApi";

if (key.endsWith(".Nullable")) return;
const found = collection.original.schemas?.[key];
const found: OpenApi.IJsonSchema | undefined =
collection.original.schemas?.[key];
if (found === undefined) return;
collection.downgraded.schemas![`${key}.Nullable`] =
downgradeSchema(collection)(found);
else if (
collection.downgraded.schemas![`${key}.Nullable`] === undefined
) {
collection.downgraded.schemas![`${key}.Nullable`] = {};
collection.downgraded.schemas![`${key}.Nullable`] =
downgradeSchema(collection)(found);
}
schema.$ref += ".Nullable";
};
}

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

info: input.info,
host: input.servers?.[0]?.url,
host: input.servers?.[0]?.url
? input.servers[0].url.split("://").pop()!
: "",
definitions: collection.downgraded,

@@ -84,3 +86,3 @@ securityDefinitions: input.components?.securitySchemes

parameters:
input.parameters || input.requestBody
input.parameters !== undefined || input.requestBody !== undefined
? [

@@ -103,2 +105,6 @@ ...(input.parameters ?? []).map(downgradeParameter(collection)),

: undefined,
...{
requestBody: undefined,
servers: undefined,
},
});

@@ -169,3 +175,3 @@

if (value !== undefined)
collection.downgraded[`#/definitions/${key.split("/").pop()}`] =
collection.downgraded[key.split("/").pop()!] =
downgradeSchema(collection)(value);

@@ -200,6 +206,7 @@ }

OpenApiTypeChecker.isNumber(schema) ||
OpenApiTypeChecker.isString(schema) ||
OpenApiTypeChecker.isReference(schema)
OpenApiTypeChecker.isString(schema)
)
union.push({ ...schema });
else if (OpenApiTypeChecker.isReference(schema))
union.push({ $ref: `#/definitions/${schema.$ref.split("/").pop()}` });
else if (OpenApiTypeChecker.isArray(schema))

@@ -289,3 +296,3 @@ union.push({

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

@@ -300,7 +307,11 @@ };

if (key.endsWith(".Nullable")) return;
const found = collection.original.schemas?.[key];
const found: OpenApi.IJsonSchema | undefined =
collection.original.schemas?.[key];
if (found === undefined) return;
collection.downgraded[`${key}.Nullable`] =
downgradeSchema(collection)(found);
else if (collection.downgraded[`${key}.Nullable`] === undefined) {
collection.downgraded[`${key}.Nullable`] = {};
collection.downgraded[`${key}.Nullable`] =
downgradeSchema(collection)(found);
}
schema.$ref += ".Nullable";

@@ -307,0 +318,0 @@ };

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc