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

openapi-typescript

Package Overview
Dependencies
Maintainers
1
Versions
145
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openapi-typescript - npm Package Compare versions

Comparing version 6.2.5 to 6.2.6

33

dist/utils.js

@@ -76,12 +76,25 @@ import c from "ansi-colors";

return { filename: ".", path: [] };
if (!ref.includes("#"))
return { filename: ref, path: [] };
const [filename, path] = ref.split("#");
return {
filename: filename || ".",
path: path
.split("/")
.filter((p) => !!p && p !== "properties")
.map(decodeRef),
};
if (ref.includes("#/")) {
const [filename, pathStr] = ref.split("#");
const parts = pathStr.split("/");
const path = [];
for (const part of parts) {
if (!part || part === "properties")
continue;
path.push(decodeRef(part));
}
return { filename: filename || ".", path };
}
else if (ref.includes('["')) {
const parts = ref.split('["');
const path = [];
for (const part of parts) {
const sanitized = part.replace('"]', "").trim();
if (!sanitized || sanitized === "properties")
continue;
path.push(sanitized);
}
return { filename: ".", path };
}
return { filename: ref, path: [] };
}

@@ -88,0 +101,0 @@ export function parseTSIndex(type) {

{
"name": "openapi-typescript",
"description": "Generate TypeScript types from Swagger OpenAPI specs",
"version": "6.2.5",
"version": "6.2.6",
"author": {

@@ -6,0 +6,0 @@ "name": "Drew Powers",

@@ -109,11 +109,27 @@ import c from "ansi-colors";

if (typeof ref !== "string") return { filename: ".", path: [] };
if (!ref.includes("#")) return { filename: ref, path: [] };
const [filename, path] = ref.split("#");
return {
filename: filename || ".",
path: path
.split("/") // split by special character
.filter((p) => !!p && p !== "properties") // remove empty parts and "properties" (gets flattened by TS)
.map(decodeRef), // decode encoded chars
};
// OpenAPI $ref
if (ref.includes("#/")) {
const [filename, pathStr] = ref.split("#");
const parts = pathStr.split("/");
const path: string[] = [];
for (const part of parts) {
if (!part || part === "properties") continue; // remove empty parts and "properties" (gets flattened by TS)
path.push(decodeRef(part));
}
return { filename: filename || ".", path };
}
// js-yaml $ref
else if (ref.includes('["')) {
const parts = ref.split('["');
const path: string[] = [];
for (const part of parts) {
const sanitized = part.replace('"]', "").trim();
if (!sanitized || sanitized === "properties") continue;
path.push(sanitized);
}
return { filename: ".", path };
}
// remote $ref
return { filename: ref, path: [] };
}

@@ -120,0 +136,0 @@

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