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.3.5 to 6.3.6

30

dist/utils.js

@@ -35,9 +35,9 @@ import c from "ansi-colors";

if (v.title)
output.push(`${v.title} `);
output.push(v.title);
if (v.summary)
output.push(`${v.summary} `);
output.push(v.summary);
if (v.format)
output.push(`Format: ${v.format} `);
output.push(`Format: ${v.format}`);
if (v.deprecated)
output.push(`@deprecated `);
output.push("@deprecated");
const supportedJsDocTags = ["description", "default", "example"];

@@ -53,6 +53,6 @@ for (const field of supportedJsDocTags) {

const serialized = typeof v[field] === "object" ? JSON.stringify(v[field], null, 2) : v[field];
output.push(`@${field} ${serialized} `);
output.push(`@${field} ${serialized}`);
}
if ("const" in v)
output.push(`@constant `);
output.push("@constant");
if (v.enum) {

@@ -72,4 +72,8 @@ let type = "unknown";

return `/** ${commentText} */`;
const ln = indent(" * ", indentLv ?? 0);
return ["/**", `${ln}${commentText.replace(LB_RE, `\n${ln}`)}`, indent(" */", indentLv ?? 0)].join("\n");
const star = indent(" *", indentLv ?? 0);
const body = commentText.split(LB_RE).map((ln) => {
ln = ln.trimEnd();
return ln.length > 0 ? `${star} ${ln}` : star;
});
return ["/**", body.join("\n"), indent(" */", indentLv ?? 0)].join("\n");
}

@@ -125,4 +129,7 @@ export function parseRef(ref) {

}
function parenthesise(type) {
return TS_UNION_INTERSECTION_RE.test(type) ? `(${type})` : type;
}
export function tsArrayOf(type) {
return `(${type})[]`;
return `${parenthesise(type)}[]`;
}

@@ -135,3 +142,3 @@ export function tsIntersectionOf(...types) {

return String(types[0]);
return types.map((t) => (TS_UNION_INTERSECTION_RE.test(t) ? `(${t})` : t)).join(" & ");
return types.map((t) => parenthesise(t)).join(" & ");
}

@@ -186,4 +193,3 @@ export function tsNonNullable(type) {

const t = memberArr[i];
const escaped = TS_UNION_INTERSECTION_RE.test(t) ? `(${t})` : t;
out += escaped;
out += parenthesise(t);
if (i !== memberArr.length - 1)

@@ -190,0 +196,0 @@ out += " | ";

4

package.json
{
"name": "openapi-typescript",
"description": "Generate TypeScript types from Swagger OpenAPI specs",
"version": "6.3.5",
"version": "6.3.6",
"author": {

@@ -63,3 +63,3 @@ "name": "Drew Powers",

"download:schemas": "vite-node ./scripts/download-schemas.ts",
"format": "pnpm run prettier -w .",
"format": "prettier --write \"src/**/*\"",
"lint": "run-p -s lint:*",

@@ -66,0 +66,0 @@ "lint:js": "eslint \"src/**/*.{js,ts}\"",

@@ -58,9 +58,9 @@ import c from "ansi-colors";

// * Not JSDOC tags: [title, format]
if (v.title) output.push(`${v.title} `);
if (v.summary) output.push(`${v.summary} `);
if (v.format) output.push(`Format: ${v.format} `);
if (v.title) output.push(v.title);
if (v.summary) output.push(v.summary);
if (v.format) output.push(`Format: ${v.format}`);
// * JSDOC tags without value
// 'Deprecated' without value
if (v.deprecated) output.push(`@deprecated `);
if (v.deprecated) output.push("@deprecated");

@@ -78,7 +78,7 @@ // * JSDOC tags with value

const serialized = typeof v[field] === "object" ? JSON.stringify(v[field], null, 2) : v[field];
output.push(`@${field} ${serialized} `);
output.push(`@${field} ${serialized}`);
}
// * JSDOC 'Constant' without value
if ("const" in v) output.push(`@constant `);
if ("const" in v) output.push("@constant");

@@ -104,4 +104,10 @@ // * JSDOC 'Enum' with type

// if multi-line comment
const ln = indent(" * ", indentLv ?? 0);
return ["/**", `${ln}${commentText.replace(LB_RE, `\n${ln}`)}`, indent(" */", indentLv ?? 0)].join("\n");
const star = indent(" *", indentLv ?? 0);
const body = commentText.split(LB_RE).map((ln) => {
ln = ln.trimEnd();
return ln.length > 0 ? `${star} ${ln}` : star;
});
return ["/**", body.join("\n"), indent(" */", indentLv ?? 0)].join("\n");
}

@@ -168,5 +174,10 @@

/** if the type has & or | we should parenthesise it for safety */
function parenthesise(type: string) {
return TS_UNION_INTERSECTION_RE.test(type) ? `(${type})` : type;
}
/** T[] */
export function tsArrayOf(type: string): string {
return `(${type})[]`;
return `${parenthesise(type)}[]`;
}

@@ -179,3 +190,3 @@

if (types.length === 1) return String(types[0]); // don’t add parentheses around one thing
return types.map((t) => (TS_UNION_INTERSECTION_RE.test(t) ? `(${t})` : t)).join(" & ");
return types.map((t) => parenthesise(t)).join(" & ");
}

@@ -260,7 +271,3 @@

const t = memberArr[i];
// if the type has & or | we should parenthesise it for safety
const escaped = TS_UNION_INTERSECTION_RE.test(t) ? `(${t})` : t;
out += escaped;
out += parenthesise(t);
if (i !== memberArr.length - 1) out += " | ";

@@ -267,0 +274,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