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
144
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 3.2.2 to 3.2.3

9

dist/cjs/index.js

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

const prettier_1 = __importDefault(require("prettier"));
const parser_typescript_1 = __importDefault(require("prettier/parser-typescript"));
const utils_1 = require("./utils");

@@ -39,3 +40,6 @@ const index_1 = require("./transform/index");

`;
let prettierOptions = { parser: "typescript" };
let prettierOptions = {
parser: "typescript",
plugins: [parser_typescript_1.default],
};
if (options && options.prettierConfig) {

@@ -45,4 +49,5 @@ try {

prettierOptions = {
...(userOptions || {}),
...prettierOptions,
...userOptions,
plugins: [...prettierOptions.plugins, ...((userOptions && userOptions.plugins) || [])],
};

@@ -49,0 +54,0 @@ }

@@ -37,3 +37,6 @@ "use strict";

Object.entries(response.content).forEach(([contentType, contentResponse]) => {
output += ` ${readonly}"${contentType}": ${schema_1.transformSchemaObj(contentResponse.schema, options)};\n`;
const responseType = contentResponse && contentResponse.schema
? schema_1.transformSchemaObj(contentResponse.schema, options)
: "unknown";
output += ` ${readonly}"${contentType}": ${responseType};\n`;
});

@@ -40,0 +43,0 @@ output += ` }\n`;

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

}
if (Array.isArray(obj.enum)) {
if (Array.isArray(obj.enum) && obj.enum.length) {
return "enum";

@@ -51,2 +51,5 @@ }

if ("swagger" in definition) {
if (typeof definition.swagger === "number" && Math.round(definition.swagger) === 2) {
return 2;
}
if (parseInt(definition.swagger, 10) === 2) {

@@ -53,0 +56,0 @@ return 2;

import path from "path";
import prettier from "prettier";
import parserTypescript from "prettier/parser-typescript";
import { swaggerVersion } from "./utils";

@@ -22,3 +23,6 @@ import { transformAll } from "./transform/index";

`;
let prettierOptions = { parser: "typescript" };
let prettierOptions = {
parser: "typescript",
plugins: [parserTypescript],
};
if (options && options.prettierConfig) {

@@ -28,4 +32,5 @@ try {

prettierOptions = {
...(userOptions || {}),
...prettierOptions,
...userOptions,
plugins: [...prettierOptions.plugins, ...((userOptions && userOptions.plugins) || [])],
};

@@ -32,0 +37,0 @@ }

@@ -34,3 +34,6 @@ import { comment, transformRef, tsReadonly } from "../utils";

Object.entries(response.content).forEach(([contentType, contentResponse]) => {
output += ` ${readonly}"${contentType}": ${transformSchemaObj(contentResponse.schema, options)};\n`;
const responseType = contentResponse && contentResponse.schema
? transformSchemaObj(contentResponse.schema, options)
: "unknown";
output += ` ${readonly}"${contentType}": ${responseType};\n`;
});

@@ -37,0 +40,0 @@ output += ` }\n`;

@@ -20,3 +20,3 @@ export function comment(text) {

}
if (Array.isArray(obj.enum)) {
if (Array.isArray(obj.enum) && obj.enum.length) {
return "enum";

@@ -45,2 +45,5 @@ }

if ("swagger" in definition) {
if (typeof definition.swagger === "number" && Math.round(definition.swagger) === 2) {
return 2;
}
if (parseInt(definition.swagger, 10) === 2) {

@@ -47,0 +50,0 @@ return 2;

{
"name": "openapi-typescript",
"description": "Generate TypeScript types from Swagger OpenAPI specs",
"version": "3.2.2",
"version": "3.2.3",
"engines": {

@@ -6,0 +6,0 @@ "node": ">= 10.0.0"

import path from "path";
import prettier from "prettier";
import parserTypescript from "prettier/parser-typescript";
import { swaggerVersion } from "./utils";

@@ -33,3 +34,6 @@ import { transformAll } from "./transform/index";

// 3. Prettify output
let prettierOptions: prettier.Options = { parser: "typescript" };
let prettierOptions: prettier.Options = {
parser: "typescript",
plugins: [parserTypescript],
};
if (options && options.prettierConfig) {

@@ -39,4 +43,5 @@ try {

prettierOptions = {
...(userOptions || {}),
...prettierOptions,
...userOptions,
plugins: [...(prettierOptions.plugins as prettier.Plugin[]), ...((userOptions && userOptions.plugins) || [])],
};

@@ -43,0 +48,0 @@ } catch (err) {

@@ -50,6 +50,7 @@ import { RequestBody } from "../types";

Object.entries(response.content).forEach(([contentType, contentResponse]) => {
output += ` ${readonly}"${contentType}": ${transformSchemaObj(
(contentResponse as any).schema,
options
)};\n`;
const responseType =
contentResponse && (contentResponse as any).schema
? transformSchemaObj((contentResponse as any).schema, options)
: "unknown";
output += ` ${readonly}"${contentType}": ${responseType};\n`;
});

@@ -56,0 +57,0 @@ output += ` }\n`; //close content

@@ -34,3 +34,3 @@ import { OpenAPI2, OpenAPI3, ReferenceObject } from "./types";

// enum
if (Array.isArray(obj.enum)) {
if (Array.isArray(obj.enum) && obj.enum.length) {
return "enum";

@@ -67,2 +67,3 @@ }

if ("openapi" in definition) {
// OpenAPI version requires semver, therefore will always be string
if (parseInt(definition.openapi, 10) === 3) {

@@ -75,2 +76,6 @@ return 3;

if ("swagger" in definition) {
// note: swagger 2.0 may be parsed as a number
if (typeof definition.swagger === "number" && Math.round(definition.swagger as number) === 2) {
return 2;
}
if (parseInt(definition.swagger, 10) === 2) {

@@ -77,0 +82,0 @@ return 2;

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