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 2.0.0-dev.20241112 to 2.0.0-dev.20241113

2

lib/converters/HttpLlmConverter.js

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

path: route.path,
messages: ["Failed to escape $ref"], // @todo
messages: ["Failed to escape $ref"],
operation: function () { return route.operation(); },

@@ -96,0 +96,0 @@ route: function () { return route; },

@@ -55,6 +55,12 @@ "use strict";

return null;
return OpenApiV3Downgrader_1.OpenApiV3Downgrader.downgradeSchema({
var downgraded = OpenApiV3Downgrader_1.OpenApiV3Downgrader.downgradeSchema({
original: {},
downgraded: {},
})(resolved);
LlmTypeCheckerV3_1.LlmTypeCheckerV3.visit(downgraded, function (schema) {
if (LlmTypeCheckerV3_1.LlmTypeCheckerV3.isOneOf(schema) &&
schema.discriminator !== undefined)
delete schema.discriminator;
});
return downgraded;
};

@@ -61,0 +67,0 @@ LlmConverterV3.separate = function (props) {

@@ -203,3 +203,2 @@ "use strict";

var visit = function (schema) {
var _a, _b;
if (OpenApiTypeChecker_1.OpenApiTypeChecker.isBoolean(schema))

@@ -216,10 +215,16 @@ union.push({ type: "boolean" });

else if (OpenApiTypeChecker_1.OpenApiTypeChecker.isTuple(schema))
visit(__assign(__assign(__assign({}, schema), { type: "array", items: {
oneOf: __spreadArray(__spreadArray([], __read(schema.prefixItems), false), __read((typeof schema.additionalItems === "object" &&
schema.additionalItems !== null
? [schema.additionalItems]
: [])), false),
}, minItems: (_a = schema.minItems) !== null && _a !== void 0 ? _a : schema.prefixItems.length, maxItems: (_b = schema.maxItems) !== null && _b !== void 0 ? _b : (schema.additionalItems === true
union.push(__assign(__assign(__assign({}, schema), { items: (function () {
if (schema.additionalItems === true)
return {};
var elements = __spreadArray(__spreadArray([], __read(schema.prefixItems), false), __read((typeof schema.additionalItems === "object"
? [OpenApiV3Downgrader.downgradeSchema(collection)(schema.additionalItems)]
: [])), false);
if (elements.length === 0)
return {};
return {
oneOf: elements.map(OpenApiV3Downgrader.downgradeSchema(collection)),
};
})(), minItems: schema.prefixItems.length, maxItems: !!schema.additionalItems === true
? undefined
: schema.prefixItems.length) }), {
: schema.prefixItems.length }), {
prefixItems: undefined,

@@ -226,0 +231,0 @@ additionalItems: undefined,

@@ -224,3 +224,2 @@ "use strict";

var visit = function (schema) {
var _a, _b;
if (OpenApiTypeChecker_1.OpenApiTypeChecker.isBoolean(schema))

@@ -242,13 +241,21 @@ union.push({ type: "boolean" });

else if (OpenApiTypeChecker_1.OpenApiTypeChecker.isTuple(schema))
visit(__assign(__assign(__assign({}, schema), { type: "array", items: {
oneOf: __spreadArray(__spreadArray([], __read(schema.prefixItems), false), __read((typeof schema.additionalItems === "object" &&
schema.additionalItems !== null
? [schema.additionalItems]
: [])), false),
}, minItems: (_a = schema.minItems) !== null && _a !== void 0 ? _a : schema.prefixItems.length, maxItems: (_b = schema.maxItems) !== null && _b !== void 0 ? _b : (schema.additionalItems === true
union.push(__assign(__assign(__assign(__assign({}, schema), { items: (function () {
if (schema.additionalItems === true)
return {};
var elements = __spreadArray(__spreadArray([], __read(schema.prefixItems), false), __read((typeof schema.additionalItems === "object"
? [SwaggerV2Downgrader.downgradeSchema(collection)(schema.additionalItems)]
: [])), false);
if (elements.length === 0)
return {};
return {
"x-oneOf": elements.map(SwaggerV2Downgrader.downgradeSchema(collection)),
};
})(), minItems: schema.prefixItems.length, maxItems: !!schema.additionalItems === true
? undefined
: schema.prefixItems.length) }), {
: schema.prefixItems.length }), {
prefixItems: undefined,
additionalItems: undefined,
}));
}), { examples: schema.examples
? Object.values(schema.examples)
: undefined }));
else if (OpenApiTypeChecker_1.OpenApiTypeChecker.isObject(schema))

@@ -277,8 +284,6 @@ union.push(__assign(__assign({}, schema), { properties: schema.properties

var visitConstant = function (schema) {
var e_3, _a;
var insert = function (value) {
var _a;
var matched = union.find(function (u) {
return u.type ===
typeof value;
return u.type === value;
});

@@ -291,20 +296,7 @@ if (matched !== undefined) {

union.push({ type: typeof value, enum: [value] });
if (OpenApiTypeChecker_1.OpenApiTypeChecker.isConstant(schema))
insert(schema.const);
else if (OpenApiTypeChecker_1.OpenApiTypeChecker.isOneOf(schema))
schema.oneOf.forEach(insert);
};
if (OpenApiTypeChecker_1.OpenApiTypeChecker.isConstant(schema))
insert(schema.const);
else if (OpenApiTypeChecker_1.OpenApiTypeChecker.isOneOf(schema))
try {
for (var _b = __values(schema.oneOf), _c = _b.next(); !_c.done; _c = _b.next()) {
var u = _c.value;
if (OpenApiTypeChecker_1.OpenApiTypeChecker.isConstant(u))
insert(u.const);
}
}
catch (e_3_1) { e_3 = { error: e_3_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_3) throw e_3.error; }
}
};

@@ -311,0 +303,0 @@ visit(input);

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

return undefined;
return __assign(__assign({}, props), { oneOf: filtered.map(function (v) { return flat(props.components, v); }).flat(), discriminator: undefined });
return __assign(__assign({}, props), { oneOf: filtered.map(function (v) { return flat(props.components, v); }).flat() });
}

@@ -227,0 +227,0 @@ else if (OpenApiTypeChecker.isObject(props.schema)) {

{
"name": "@samchon/openapi",
"version": "2.0.0-dev.20241112",
"version": "2.0.0-dev.20241113",
"description": "OpenAPI definitions and converters for 'typia' and 'nestia'.",

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

"source-map-support": "^0.5.21",
"ts-node": "^10.9.2",
"ts-patch": "^3.2.1",
"typescript": "5.5.4",
"typescript": "^5.6.3",
"typescript-transform-paths": "^3.4.7",

@@ -67,4 +68,3 @@ "typia": "^6.9.0",

"README.md"
],
"packageManager": "pnpm@9.5.0+sha512.140036830124618d624a2187b50d04289d5a087f326c9edfc0ccd733d76c4f52c3a313d4fc148794a2a9d81553016004e6742e8cf850670268a7387fc220c903"
]
}

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

path: route.path,
messages: ["Failed to escape $ref"], // @todo
messages: ["Failed to escape $ref"],
operation: () => route.operation(),

@@ -84,0 +84,0 @@ route: () => route as any as Route,

@@ -19,6 +19,14 @@ import { OpenApi } from "../OpenApi";

if (resolved === null) return null;
return OpenApiV3Downgrader.downgradeSchema({
const downgraded: ILlmSchemaV3 = OpenApiV3Downgrader.downgradeSchema({
original: {},
downgraded: {},
})(resolved);
})(resolved) as ILlmSchemaV3;
LlmTypeCheckerV3.visit(downgraded, (schema) => {
if (
LlmTypeCheckerV3.isOneOf(schema) &&
(schema as any).discriminator !== undefined
)
delete (schema as any).discriminator;
});
return downgraded;
};

@@ -25,0 +33,0 @@

@@ -211,20 +211,22 @@ import { OpenApi } from "../OpenApi";

else if (OpenApiTypeChecker.isTuple(schema))
visit({
union.push({
...schema,
type: "array",
items: {
oneOf: [
items: ((): OpenApiV3.IJsonSchema => {
if (schema.additionalItems === true) return {};
const elements = [
...schema.prefixItems,
...(typeof schema.additionalItems === "object" &&
schema.additionalItems !== null
? [schema.additionalItems]
...(typeof schema.additionalItems === "object"
? [downgradeSchema(collection)(schema.additionalItems)]
: []),
],
},
minItems: schema.minItems ?? schema.prefixItems.length,
];
if (elements.length === 0) return {};
return {
oneOf: elements.map(downgradeSchema(collection) as any),
};
})(),
minItems: schema.prefixItems.length,
maxItems:
schema.maxItems ??
(schema.additionalItems === true
!!schema.additionalItems === true
? undefined
: schema.prefixItems.length),
: schema.prefixItems.length,
...{

@@ -234,3 +236,3 @@ prefixItems: undefined,

},
} satisfies OpenApi.IJsonSchema.IArray);
});
else if (OpenApiTypeChecker.isObject(schema))

@@ -237,0 +239,0 @@ union.push({

@@ -231,20 +231,22 @@ import { OpenApi } from "../OpenApi";

else if (OpenApiTypeChecker.isTuple(schema))
visit({
union.push({
...schema,
type: "array",
items: {
oneOf: [
items: ((): SwaggerV2.IJsonSchema => {
if (schema.additionalItems === true) return {};
const elements = [
...schema.prefixItems,
...(typeof schema.additionalItems === "object" &&
schema.additionalItems !== null
? [schema.additionalItems]
...(typeof schema.additionalItems === "object"
? [downgradeSchema(collection)(schema.additionalItems)]
: []),
],
},
minItems: schema.minItems ?? schema.prefixItems.length,
];
if (elements.length === 0) return {};
return {
"x-oneOf": elements.map(downgradeSchema(collection) as any),
};
})(),
minItems: schema.prefixItems.length,
maxItems:
schema.maxItems ??
(schema.additionalItems === true
!!schema.additionalItems === true
? undefined
: schema.prefixItems.length),
: schema.prefixItems.length,
...{

@@ -254,3 +256,6 @@ prefixItems: undefined,

},
} satisfies OpenApi.IJsonSchema.IArray);
examples: schema.examples
? Object.values(schema.examples)
: undefined,
});
else if (OpenApiTypeChecker.isObject(schema))

@@ -285,4 +290,3 @@ union.push({

(u) =>
(u as SwaggerV2.IJsonSchema.__ISignificant<any>).type ===
typeof value,
(u as SwaggerV2.IJsonSchema.__ISignificant<any>).type === value,
) as SwaggerV2.IJsonSchema.INumber | undefined;

@@ -293,7 +297,6 @@ if (matched !== undefined) {

} else union.push({ type: typeof value as "number", enum: [value] });
if (OpenApiTypeChecker.isConstant(schema)) insert(schema.const);
else if (OpenApiTypeChecker.isOneOf(schema))
schema.oneOf.forEach(insert);
};
if (OpenApiTypeChecker.isConstant(schema)) insert(schema.const);
else if (OpenApiTypeChecker.isOneOf(schema))
for (const u of schema.oneOf)
if (OpenApiTypeChecker.isConstant(u)) insert(u.const);
};

@@ -300,0 +303,0 @@

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

oneOf: filtered.map((v) => flat(props.components, v)).flat(),
discriminator: undefined,
};

@@ -207,0 +206,0 @@ } else if (isObject(props.schema)) {

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